html, body {
    margin: 0;
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    font-size: 14px;
    background: #F2F2F7;
    color: #1D1D1F;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    html, body {
        background: #1C1C1E;
        color: #F5F5F7;
        color-scheme: dark;
    }
}

.whodecides-light {
    color-scheme: light;
    --whodecides-sidebar: #FBFBFD;
    --whodecides-sidebar-border: #E5E5EA;
    --whodecides-card: #FFFFFF;
    --whodecides-inset: #F2F2F7;
    --whodecides-track: #E5E5EA;
    --whodecides-line: #E5E5EA;
    --whodecides-text: #1D1D1F;
    --whodecides-text-2: #6C6C70;
    --whodecides-link: #0066CC;
    --whodecides-link-hover: #004F9E;
    --whodecides-fill: #0071E3;
    --whodecides-on-fill: #FFFFFF;
    --whodecides-tint: rgba(0, 113, 227, 0.10);
    --whodecides-tint-text: #0058B0;
    --whodecides-local: #FF9500;
    --whodecides-local-text: #B25000;
    --whodecides-local-tint: rgba(255, 149, 0, 0.14);
    --whodecides-cloud: #AF52DE;
    --whodecides-cloud-text: #8E3FC4;
    --whodecides-cloud-tint: rgba(175, 82, 222, 0.14);
    --whodecides-backdrop: rgba(0, 0, 0, 0.3);
    --whodecides-positive: #1A7F37;
    --whodecides-positive-tint: rgba(26, 127, 55, 0.12);
    --whodecides-negative: #C62828;
    --whodecides-indigo-text: #4B49C8;
    --whodecides-indigo-tint: rgba(88, 86, 214, 0.12);
    --whodecides-teal-text: #0E7C8C;
    --whodecides-teal-tint: rgba(48, 176, 199, 0.14);
    --whodecides-yellow-text: #8A6A00;
    --whodecides-yellow-tint: rgba(255, 204, 0, 0.20);
}

.whodecides-dark {
    color-scheme: dark;
    --whodecides-sidebar: #161618;
    --whodecides-sidebar-border: #2C2C2E;
    --whodecides-card: #2C2C2E;
    --whodecides-inset: #232325;
    --whodecides-track: #3A3A3C;
    --whodecides-line: #38383A;
    --whodecides-text: #F5F5F7;
    --whodecides-text-2: #AEAEB2;
    --whodecides-link: #3B9BFF;
    --whodecides-link-hover: #6CB4FF;
    --whodecides-fill: #0071E3;
    --whodecides-on-fill: #FFFFFF;
    --whodecides-tint: rgba(10, 132, 255, 0.16);
    --whodecides-tint-text: #6CB4FF;
    --whodecides-local: #FF9F0A;
    --whodecides-local-text: #FF9F0A;
    --whodecides-local-tint: rgba(255, 159, 10, 0.14);
    --whodecides-cloud: #D08CF7;
    --whodecides-cloud-text: #D08CF7;
    --whodecides-cloud-tint: rgba(191, 90, 242, 0.16);
    --whodecides-backdrop: rgba(0, 0, 0, 0.55);
    --whodecides-positive: #4ADE80;
    --whodecides-positive-tint: rgba(74, 222, 128, 0.14);
    --whodecides-negative: #F87181;
    --whodecides-indigo-text: #A5A3FF;
    --whodecides-indigo-tint: rgba(94, 92, 230, 0.22);
    --whodecides-teal-text: #64D2E6;
    --whodecides-teal-tint: rgba(64, 200, 224, 0.16);
    --whodecides-yellow-text: #FFD60A;
    --whodecides-yellow-tint: rgba(255, 214, 10, 0.16);
}

.whodecides-root {
    min-height: 100vh;
    background: var(--mud-palette-background);
    color: var(--whodecides-text);
    overflow-wrap: anywhere;
}

.whodecides-root a {
    color: var(--whodecides-link);
    text-decoration: none;
}

.whodecides-root a:hover {
    color: var(--whodecides-link-hover);
}

.whodecides-root .mud-primary-text,
.whodecides-root .mud-button-text.mud-button-text-primary,
.whodecides-root .mud-button-outlined.mud-button-outlined-primary,
.whodecides-root .mud-icon-button.mud-primary-text {
    color: var(--whodecides-link) !important;
}

.whodecides-root .mud-paper,
.whodecides-root .mud-button-filled {
    box-shadow: none;
}

.whodecides-root .mud-button-root:not(.mud-icon-button) {
    min-height: 44px;
    padding-left: 18px;
    padding-right: 18px;
    border-radius: 10px;
}

.whodecides-sidebar-footer .mud-menu,
.whodecides-sidebar-footer .mud-menu-activator {
    display: block !important;
    width: 100%;
    border-radius: 10px;
}

.whodecides-sidebar-footer .mud-menu-activator:focus-visible {
    outline: 2px solid var(--whodecides-link);
    outline-offset: 2px;
}

.whodecides-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--whodecides-text);
}

.whodecides-logo-name {
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -0.01em;
}

.whodecides-shell {
    display: flex;
    min-height: 100vh;
}

.whodecides-sidebar {
    flex: none;
    width: 248px;
    box-sizing: border-box;
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 20px 12px 16px;
    background: var(--whodecides-sidebar);
    border-right: 1px solid var(--whodecides-sidebar-border);
    display: flex;
    flex-direction: column;
    gap: 22px;
    overflow-y: auto;
}

.whodecides-sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
}

.whodecides-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.whodecides-root a.whodecides-nav-item,
.whodecides-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--whodecides-text);
    font-size: 14px;
    font-weight: 500;
    box-sizing: border-box;
}

.whodecides-nav-item .mud-icon-root {
    color: var(--whodecides-link);
    font-size: 18px;
}

.whodecides-root a.whodecides-nav-item:hover {
    color: var(--whodecides-text);
    background: var(--whodecides-tint);
}

.whodecides-root a.whodecides-nav-item.active {
    background: var(--whodecides-fill);
    color: var(--whodecides-on-fill);
    font-weight: 600;
}

.whodecides-root a.whodecides-nav-item.active .mud-icon-root {
    color: var(--whodecides-on-fill);
}

.whodecides-nav-item[aria-disabled="true"] {
    color: var(--whodecides-text-2);
    cursor: default;
}

.whodecides-nav-item[aria-disabled="true"] .mud-icon-root {
    color: var(--whodecides-text-2);
}

/* A nav item that opens a group, such as Admin, and the items under it, set in a little. */
.whodecides-nav-group {
    width: 100%;
    border: 0;
    background: transparent;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.whodecides-nav-group:hover {
    background: var(--whodecides-tint);
}

.whodecides-nav-group:focus-visible {
    outline: 2px solid var(--whodecides-link);
    outline-offset: 2px;
}

.whodecides-nav-chevron {
    margin-left: auto;
    display: inline-flex;
    transition: transform 0.15s ease;
}

.whodecides-nav-chevron .mud-icon-root {
    color: var(--whodecides-text-2);
}

.whodecides-nav-group:not(.open) .whodecides-nav-chevron {
    transform: rotate(-90deg);
}

.whodecides-nav-sub {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 14px;
}

.whodecides-soon {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--whodecides-track);
    color: var(--whodecides-text-2);
    font-size: 11px;
    font-weight: 600;
}

.whodecides-sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.whodecides-account {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 6px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--whodecides-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.whodecides-account:hover {
    background: var(--whodecides-tint);
}

.whodecides-avatar {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--whodecides-tint);
    color: var(--whodecides-tint-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.whodecides-account-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.whodecides-account-name > span:first-child {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.whodecides-account-name > span:last-child {
    font-size: 12px;
    color: var(--whodecides-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.whodecides-main {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    padding: 28px 32px 48px;
}

.whodecides-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.whodecides-topbar {
    display: none;
}

.whodecides-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--whodecides-link);
    cursor: pointer;
}

.whodecides-icon-button:hover {
    background: var(--whodecides-tint);
}

.whodecides-backdrop {
    display: none;
}

@media (max-width: 900px) {
    .whodecides-topbar {
        display: flex;
        align-items: center;
        gap: 8px;
        position: sticky;
        top: 0;
        z-index: 20;
        padding: 6px 12px;
        background: var(--whodecides-sidebar);
        border-bottom: 1px solid var(--whodecides-sidebar-border);
    }

    .whodecides-shell {
        display: block;
    }

    .whodecides-sidebar {
        position: fixed;
        z-index: 40;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: none;
    }

    .whodecides-sidebar.open {
        transform: none;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
    }

    .whodecides-backdrop.open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 30;
        border: 0;
        background: var(--whodecides-backdrop);
    }

    .whodecides-main {
        padding: 20px 16px 40px;
    }
}

@media (max-width: 900px), (pointer: coarse) {
    .whodecides-root input,
    .whodecides-root textarea,
    .whodecides-root select,
    .whodecides-root .mud-input,
    .whodecides-root .mud-select-input {
        font-size: 16px !important;
    }
}

.whodecides-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.whodecides-page-header h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.whodecides-page-header p {
    margin: 6px 0 0;
    max-width: 600px;
    color: var(--whodecides-text-2);
    line-height: 1.5;
}

.whodecides-page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.whodecides-card {
    padding: 18px;
    border-radius: 12px;
    background: var(--whodecides-card);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.whodecides-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.whodecides-badge .mud-icon-root {
    font-size: 12px;
}

.whodecides-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--whodecides-local);
}

.whodecides-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.whodecides-muted {
    color: var(--whodecides-text-2);
}

.whodecides-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.whodecides-option {
    display: flex;
    flex-direction: column;
}

.whodecides-option-hint {
    font-size: 12px;
    color: var(--whodecides-text-2);
}

.whodecides-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    box-sizing: border-box;
}

.whodecides-auth-card {
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    padding: 32px 28px;
    border-radius: 16px;
    background: var(--whodecides-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.whodecides-auth-card .whodecides-logo-name {
    font-size: 26px;
}

.whodecides-auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.whodecides-auth-note {
    margin: 0;
    text-align: center;
    color: var(--whodecides-text-2);
    line-height: 1.5;
}

.whodecides-pill {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--whodecides-track);
    color: var(--whodecides-text-2);
    font-size: 11px;
    font-weight: 600;
}

.whodecides-users {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.whodecides-user-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.whodecides-user-features {
    width: 22rem;
    max-width: 50vw;
}

.whodecides-root .whodecides-select-group {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--whodecides-text-2);
    line-height: 1;
    padding-top: 12px;
    padding-bottom: 6px;
}

.whodecides-command {
    margin: 8px 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--whodecides-track);
    font-family: "SF Mono", ui-monospace, Menlo, monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    user-select: all;
}

.whodecides-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 160px;
    padding: 24px 16px;
    border: 2px dashed var(--whodecides-line);
    border-radius: 12px;
    background: var(--whodecides-inset);
    color: var(--whodecides-text-2);
    text-align: center;
    transition: border-color 0.15s, background-color 0.15s;
}

.whodecides-dropzone:hover,
.whodecides-dropzone.dragging {
    border-color: var(--whodecides-fill);
    background: var(--whodecides-tint);
    color: var(--whodecides-tint-text);
}

.whodecides-dropzone:focus-within {
    outline: 2px solid var(--whodecides-fill);
    outline-offset: 2px;
}

.whodecides-dropzone.busy {
    border-style: solid;
}

.whodecides-dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.whodecides-dropzone.busy .whodecides-dropzone-input {
    cursor: progress;
}

.whodecides-dropzone-title {
    font-weight: 600;
    color: var(--whodecides-text);
}

.whodecides-dropzone-button {
    margin-top: 4px;
    padding: 6px 16px;
    border-radius: 8px;
    background: var(--whodecides-fill);
    color: var(--whodecides-on-fill);
    font-weight: 500;
}

.whodecides-chip {
    align-self: flex-start;
    margin-top: 2px;
    padding: 2px 8px;
    border: 0;
    border-radius: 999px;
    background: var(--whodecides-tint);
    color: var(--whodecides-tint-text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.whodecides-chip:hover {
    text-decoration: underline;
}

.whodecides-chip-new {
    background: var(--whodecides-local-tint);
    color: var(--whodecides-local-text);
}

.whodecides-chip-known {
    background: var(--whodecides-inset);
    color: var(--whodecides-text-2);
}

.mud-list-item.whodecides-select-heading {
    min-height: 32px;
    padding-top: 10px;
    opacity: 1;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--whodecides-text-2);
}

.mud-list-item.whodecides-select-indented {
    padding-left: 28px;
}

.whodecides-warning {
    color: var(--whodecides-local-text);
    font-size: 13px;
}

/* ---- Components (WhoDecides.Web.Design/Components): our layer over MudBlazor ---- */

.whodecides-root .whodecides-button {
    text-transform: none;
    font-weight: 600;
    border-radius: 8px;
}

.whodecides-root .mud-chip.whodecides-chip {
    margin: 0;
    font-weight: 600;
}

.whodecides-root .mud-chip.whodecides-chip .mud-chip-icon {
    font-size: 14px;
}

.whodecides-root .mud-chip.whodecides-chip-neutral { background-color: var(--whodecides-track) !important; color: var(--whodecides-text-2) !important; }
.whodecides-root .mud-chip.whodecides-chip-positive { background-color: var(--whodecides-positive-tint) !important; color: var(--whodecides-positive) !important; }
.whodecides-root .mud-chip.whodecides-chip-local { background-color: var(--whodecides-local-tint) !important; color: var(--whodecides-local-text) !important; }
.whodecides-root .mud-chip.whodecides-chip-cloud { background-color: var(--whodecides-cloud-tint) !important; color: var(--whodecides-cloud-text) !important; }
.whodecides-root .mud-chip.whodecides-chip-indigo { background-color: var(--whodecides-indigo-tint) !important; color: var(--whodecides-indigo-text) !important; }
.whodecides-root .mud-chip.whodecides-chip-teal { background-color: var(--whodecides-teal-tint) !important; color: var(--whodecides-teal-text) !important; }
.whodecides-root .mud-chip.whodecides-chip-yellow { background-color: var(--whodecides-yellow-tint) !important; color: var(--whodecides-yellow-text) !important; }

.whodecides-root .mud-toolbar.whodecides-toolbar {
    height: auto;
    min-height: 0;
    gap: 12px;
}

.whodecides-toolbar-text {
    min-width: 0;
}

.whodecides-toolbar h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.whodecides-toolbar p {
    margin: 2px 0 0;
    color: var(--whodecides-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.whodecides-toolbar-actions {
    display: flex;
    gap: 8px;
    flex: none;
}

.whodecides-root .mud-table.whodecides-table {
    background: transparent;
}

.whodecides-table .whodecides-cell-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

/* Columns of chips are centred, header and cells, so a chip's padding does not set it off from its header. */
.whodecides-root .whodecides-table th.whodecides-cell-center,
.whodecides-root .whodecides-table td.whodecides-cell-center {
    text-align: center;
}

.whodecides-table .whodecides-cell-center .whodecides-cell-chips {
    justify-content: center;
}

.whodecides-table .whodecides-cell-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Cells wrap only between words, never letter by letter, and headers stay on one line; a table too wide for the
   window scrolls sideways instead. */
.whodecides-root .whodecides-table th,
.whodecides-root .whodecides-table td {
    overflow-wrap: normal;
}

.whodecides-root .whodecides-table th {
    white-space: nowrap;
}

.whodecides-root .whodecides-table.mud-simple-table table th,
.whodecides-root .whodecides-table.mud-simple-table table td {
    padding-left: 12px;
    padding-right: 12px;
}

.whodecides-root .whodecides-table .mud-table-container {
    overflow-x: auto;
}

.whodecides-table .whodecides-cell-name {
    min-width: 7em;
}

.whodecides-table-empty {
    color: var(--whodecides-text-2);
}

/*
 * A dialog: its title on top, its actions at the bottom, both fixed, and its body scrolling between them when it
 * is taller than the window. MudBlazor scrolls the whole content (actions too), so the content is a column instead.
 */
.whodecides-dialog.mud-dialog,
.whodecides-dialog .mud-dialog {
    max-height: calc(100dvh - 64px);
}

.whodecides-dialog .mud-dialog-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    padding-bottom: 12px;
}

.whodecides-dialog .mud-dialog-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0;
}

.whodecides-dialog-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.whodecides-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    /* Room for the outlined fields' labels at the top, their focus rings at the sides, and on the right a scroll bar,
       which macOS draws over the content. The margins keep the content where it would be without them. */
    padding: 8px 16px 16px 4px;
    margin: -8px -16px 0 -4px;
}

.whodecides-dialog-body p {
    margin: 0;
    color: var(--whodecides-text-2);
}

.whodecides-dialog-body p.whodecides-error {
    color: var(--whodecides-negative);
}

.whodecides-dialog-actions {
    display: flex;
    flex: none;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 0 16px;
    border-top: 1px solid var(--whodecides-line);
}

.whodecides-error {
    margin: 0;
    color: var(--whodecides-negative);
}

/* A cell's main text with a smaller line of detail under it. */
.whodecides-root .whodecides-stacked { display: flex; flex-direction: column; line-height: 1.3; }
.whodecides-root .whodecides-stacked-detail { color: var(--whodecides-text-2); font-size: 0.8125rem; white-space: nowrap; }
.whodecides-root .whodecides-nowrap { white-space: nowrap; }

/* Tabs: a row of quiet tabs over the page's content. */
.whodecides-root .whodecides-tabs .mud-tabs-tabbar { background: transparent; border-bottom: 1px solid var(--whodecides-line); }
.whodecides-root .whodecides-tabs .mud-tab { text-transform: none; font-weight: 600; min-width: 96px; color: var(--whodecides-text-2); }
.whodecides-root .whodecides-tabs .mud-tab.mud-tab-active { color: var(--whodecides-text); }
.whodecides-root .whodecides-tabs .mud-tab-slider { background: var(--whodecides-fill); }
.whodecides-root .whodecides-tab-panel { padding-top: 20px; display: flex; flex-direction: column; gap: 20px; }

/* A link back to the page above. */
.whodecides-back {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--whodecides-link);
    font-size: 13px;
    text-decoration: none;
}

.whodecides-back:hover {
    color: var(--whodecides-link-hover);
}

.whodecides-root .whodecides-dialog-start {
    margin-right: auto;
}

.whodecides-slider {
    display: flex;
    flex-direction: column;
    /* Half a thumb on each side, so a thumb at either end is not cut off. */
    padding: 0 8px;
}

.whodecides-slider-label {
    font-size: 13px;
    font-weight: 500;
}

.whodecides-slider-ends {
    display: flex;
    justify-content: space-between;
    margin-top: -4px;
    color: var(--whodecides-text-2);
    font-size: 12px;
}

.whodecides-link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--whodecides-link);
    font: inherit;
    cursor: pointer;
}
