* { box-sizing: border-box; }

:root {
    --app-primary-drawer-width: 240px;
    --app-secondary-drawer-width: 280px;
    --app-topbar-height: 64px;
}

html,
body {
    margin: 0;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-background);
}

a {
    color: inherit;
    text-decoration: none;
}

.mud-layout,
.mud-main-content {
    background: var(--mud-palette-background);
}

.auth-layout,
.auth-layout .mud-main-content {
    min-height: 100vh;
    background: #e6e7e9;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(440px, 100%);
    padding: 32px;
    border-radius: var(--mud-default-borderradius);
}

.auth-brand {
    align-items: center;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--mud-palette-text-secondary);
    font-size: 14px;
}

.app-topbar .mud-toolbar {
    min-height: 64px;
    gap: 12px;
}

.app-header-copy {
    display: flex;
    align-items: baseline;
    gap: 32px;
    min-width: 0;
    margin-left: 4px;
    color: #fff;
}

.app-title {
    flex: 0 0 auto;
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
    white-space: nowrap;
}

.app-welcome-text {
    min-width: 0;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-welcome-text strong {
    color: #fff;
    font-style: italic;
    font-weight: 800;
}

.app-header-divider {
    display: inline-block;
    margin: 0 5px;
    opacity: 0.9;
}

.app-header-change {
    margin-left: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-style: italic;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
}

.app-header-change:hover,
.app-header-change:focus-visible {
    text-decoration: underline;
}

.topbar-user-menu .mud-button-root {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    overflow: hidden;
}

.topbar-user-menu.has-photo .mud-button-root {
    background-image: var(--topbar-user-photo);
    background-position: center;
    background-size: cover;
    color: transparent;
}

.topbar-user-menu .mud-button-label {
    min-width: 0;
}

.operating-context-divider {
    align-self: stretch;
    width: 1px;
    min-height: 32px;
    background: rgba(255, 255, 255, 0.34);
}

.operating-context-menu {
    min-width: 0;
}

.operating-context-menu .mud-button-root {
    max-width: min(420px, 36vw);
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    text-transform: none;
    transition: background-color 120ms ease, border-color 120ms ease;
}

.operating-context-menu .mud-button-root:hover,
.operating-context-menu .mud-button-root:focus-visible {
    border-color: rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

.operating-context-menu .mud-button-label {
    min-width: 0;
    overflow: hidden;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.operating-context-option-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.operating-context-popover {
    width: min(460px, calc(100vw - 24px));
    padding: 6px 0;
}

.operating-context-popover-heading {
    display: grid;
    gap: 2px;
    padding: 10px 16px 12px;
}

.operating-context-search {
    padding: 10px 12px;
}

.operating-context-search .mud-input-control {
    margin: 0;
}

.operating-context-option-list {
    max-height: min(420px, calc(100vh - 210px));
    overflow-x: hidden;
    overflow-y: auto;
}

.operating-context-empty {
    display: block;
    padding: 18px 16px;
    text-align: center;
}

.operating-context-option {
    width: 100%;
    min-width: 280px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 3px 0;
}

.operating-context-option-name {
    overflow: hidden;
    color: var(--mud-palette-text-primary);
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.operating-context-option-detail {
    overflow: hidden;
    color: var(--mud-palette-text-secondary);
    font-size: 11px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 820px) {
    .app-header-copy {
        gap: 10px;
    }

    .app-title {
        font-size: 17px;
    }

    .operating-context-menu .mud-button-root {
        max-width: 42vw;
    }
}

@media (max-width: 620px) {
    .app-title,
    .operating-context-divider {
        display: none;
    }

    .operating-context-menu .mud-button-root {
        max-width: 48vw;
    }
}

.topbar-profile-greeting {
    max-width: 320px;
    padding: 16px 20px 14px;
}

.topbar-profile-greeting .mud-typography {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--mud-palette-text-secondary);
    font-weight: 700;
}

.topbar-profile-greeting span {
    color: var(--mud-palette-primary);
    font-style: italic;
    font-weight: 900;
}

.topbar-action-icon {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.topbar-action-icon:hover {
    background: rgba(255, 255, 255, 0.22);
}

.topbar-notifications-menu .mud-badge-root {
    display: inline-flex;
}

.topbar-notifications-panel {
    min-width: 260px;
    padding: 16px 18px;
}

.topbar-user-avatar {
    border: 2px solid rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.drawer-shell {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.drawer-organisation-panel {
    display: grid;
    gap: 10px;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-surface) 94%, var(--mud-palette-primary) 6%);
}

.drawer-organisation-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 7;
    min-height: 96px;
    border: 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    border-radius: 0;
    background: #fff;
    color: var(--mud-palette-primary);
    overflow: hidden;
}

.drawer-organisation-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
}

.drawer-organisation-logo span {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 0;
}

.drawer-organisation-name,
.drawer-solution-name {
    padding: 0 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-context-summary {
    display: grid;
    gap: 4px;
    padding: 0 12px;
}

.drawer-context-summary .drawer-solution-name,
.drawer-context-summary .drawer-organisation-name,
.drawer-context-summary .drawer-role-name {
    padding: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-context-summary .drawer-solution-name {
    color: var(--mud-palette-primary);
    font-size: 19px;
    font-weight: 900;
    line-height: 1.15;
}

.drawer-context-summary .drawer-organisation-name {
    color: var(--mud-palette-text-primary);
    font-weight: 750;
}

.drawer-role-block {
    display: grid;
    gap: 3px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.drawer-role-label {
    color: var(--mud-palette-text-secondary);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.drawer-role-row {
    gap: 8px;
    min-width: 0;
}

.drawer-context-summary .drawer-role-name {
    color: var(--mud-palette-primary);
    font-size: 12px;
    font-weight: 400;
    font-style: italic;
}

.drawer-context-change-badge {
    flex: 0 0 auto;
    min-height: 24px;
    padding: 3px 9px;
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 28%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, var(--mud-palette-surface));
    color: var(--mud-palette-primary);
    cursor: pointer;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.drawer-context-change-badge:hover,
.drawer-context-change-badge:focus-visible {
    background: var(--mud-palette-primary);
    color: #fff;
}

.profile-view-as-panel {
    width: 320px;
    max-width: calc(100vw - 32px);
    padding: 12px 16px;
}

.drawer-nav {
    flex: 1 1 auto;
}

.access-portals-nav {
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 8px 0;
}

.access-portals-nav-heading {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin: 0 12px 8px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 18%, var(--mud-palette-lines-default));
    border-radius: 14px;
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-surface));
}

.access-portals-nav-empty {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 9px;
    margin: 6px 12px;
    padding: 14px 12px;
    border: 1px dashed var(--mud-palette-lines-default);
    border-radius: 12px;
}

.access-portal-option {
    width: 100%;
    min-height: 62px;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 10px;
    padding: 9px 14px 9px 24px;
    border: 0;
    border-left: 3px solid transparent;
    background: transparent;
    color: var(--mud-palette-text-primary);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.access-portal-option:hover,
.access-portal-option:focus-visible {
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
    color: var(--mud-palette-primary);
    outline: none;
}

.access-portal-option.is-selected {
    border-left-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, var(--mud-palette-surface));
    color: var(--mud-palette-primary);
}

.access-portal-option-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.access-portal-option-name,
.access-portal-option-detail {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.access-portal-option-name {
    font-size: 14px;
    font-weight: 600;
}

.access-portal-option-detail {
    color: var(--mud-palette-text-secondary);
    font-size: 11px;
}

.drawer-section-launcher {
    width: 100%;
    min-height: 48px;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 24px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--mud-palette-text-primary);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}

.drawer-section-launcher:hover,
.drawer-section-launcher:focus-visible {
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
    color: var(--mud-palette-primary);
    outline: none;
}

.drawer-section-launcher.is-active {
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, var(--mud-palette-surface));
    color: var(--mud-palette-primary);
    font-weight: 600;
}

.drawer-section-launcher > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-section-launcher-chevron {
    transition: transform 180ms ease;
}

.drawer-section-launcher.is-active .drawer-section-launcher-chevron {
    transform: translateX(2px);
}

.stc-nav-menu .mud-nav-link {
    width: 100%;
    min-height: 48px;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 24px !important;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
}

.stc-nav-menu .mud-nav-link .mud-nav-link-icon {
    margin: 0 !important;
}

.stc-nav-menu .mud-nav-link .mud-nav-link-text {
    min-width: 0;
    margin: 0 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.secondary-nav-drawer {
    position: fixed;
    z-index: 1099;
    top: var(--app-topbar-height);
    bottom: 0;
    left: var(--app-primary-drawer-width);
    width: var(--app-secondary-drawer-width);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    box-shadow: 8px 0 22px rgba(15, 23, 42, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-18px);
    pointer-events: none;
    transition:
        opacity 180ms ease,
        transform 220ms ease,
        visibility 220ms step-end;
}

.secondary-nav-drawer.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
    transition:
        opacity 180ms ease,
        transform 220ms ease,
        visibility 0ms step-start;
}

.secondary-drawer-header {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
}

.secondary-nav-drawer > .mud-divider {
    flex: 0 0 auto;
}

.secondary-drawer-heading {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.secondary-drawer-heading .mud-typography {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.secondary-drawer-heading .mud-typography-h6 {
    color: var(--mud-palette-primary);
    font-size: 18px;
    font-weight: 900;
}

.secondary-drawer-nav {
    flex: 1 1 auto;
    padding: 8px;
    overflow-y: auto;
}

.secondary-drawer-nav .mud-nav-link-text {
    min-width: 0;
    flex: 1 1 auto;
}

.secondary-nav-link-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.secondary-nav-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 1.45rem;
    height: 1.25rem;
    padding: 0 .38rem;
    border-radius: 999px;
    background: var(--mud-palette-error);
    color: #fff;
    font-size: .68rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.secondary-drawer-context-label {
    margin: 4px 8px 8px;
    padding: 7px 10px;
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 20%, transparent);
    border-radius: 9px;
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, transparent);
    color: var(--mud-palette-primary);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .02em;
}

.agreement-gate-overlay {
    position: fixed;
    z-index: 2200;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.64);
    backdrop-filter: blur(3px);
}

.agreement-gate-dialog {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: min(820px, 100%);
    max-height: calc(100vh - 48px);
    padding: 24px;
    overflow: hidden;
}

.agreement-gate-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.agreement-gate-context {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agreement-content-text {
    min-height: 180px;
    padding: 20px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    background: color-mix(in srgb, var(--mud-palette-background) 70%, var(--mud-palette-surface));
    line-height: 1.65;
    overflow-y: auto;
    white-space: pre-wrap;
}

.agreement-content-text h2,
.agreement-content-text h3 {
    margin: 0.75em 0 0.35em;
    line-height: 1.25;
}

.agreement-content-text p,
.agreement-content-text blockquote,
.agreement-content-text ul,
.agreement-content-text ol {
    margin: 0.65em 0;
}

.agreement-content-text blockquote {
    padding: 8px 14px;
    border-left: 4px solid var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, transparent);
}

.agreement-content-text hr {
    margin: 18px 0;
    border: 0;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.agreement-content-text img {
    display: block;
    max-width: 100%;
    max-height: 420px;
    margin: 14px auto;
    border-radius: 8px;
    object-fit: contain;
}

.agreement-rich-editor {
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    background: var(--mud-palette-surface);
}

.agreement-rich-editor:focus-within {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 0 0 1px var(--mud-palette-primary);
}

.agreement-rich-editor-label {
    display: block;
    padding: 10px 12px 4px;
    color: var(--mud-palette-text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.agreement-rich-editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
    padding: 8px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-background) 78%, var(--mud-palette-surface));
}

.agreement-rich-editor-style,
.agreement-rich-editor-button {
    height: 34px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--mud-palette-text-primary);
}

.agreement-rich-editor-style {
    min-width: 116px;
    padding: 0 8px;
}

.agreement-rich-editor-button {
    display: inline-grid;
    width: 34px;
    place-items: center;
    cursor: pointer;
}

.agreement-rich-editor-button:hover,
.agreement-rich-editor-button:focus-visible,
.agreement-rich-editor-style:hover,
.agreement-rich-editor-style:focus-visible {
    border-color: var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-primary) 9%, transparent);
    outline: none;
}

.agreement-rich-editor-separator {
    width: 1px;
    height: 24px;
    margin: 0 3px;
    background: var(--mud-palette-lines-default);
}

.agreement-rich-editor-spacer {
    flex: 1 1 auto;
}

.agreement-rich-editor-content {
    min-height: 330px;
    max-height: 600px;
    padding: 18px;
    overflow-y: auto;
    line-height: 1.65;
    outline: none;
}

.agreement-rich-editor.compact .agreement-rich-editor-content {
    min-height: 150px;
    max-height: 280px;
    padding: 12px;
}

.agreement-rich-editor.compact .agreement-rich-editor-label,
.agreement-rich-editor.compact .agreement-rich-editor-helper {
    display: none;
}

.agreement-rich-editor-content:empty::before {
    content: attr(data-placeholder);
    color: var(--mud-palette-text-disabled);
    pointer-events: none;
}

.agreement-rich-editor-helper {
    padding: 6px 12px 10px;
    color: var(--mud-palette-text-secondary);
    font-size: 12px;
}

.agreement-rich-editor.disabled {
    opacity: 0.65;
}

.agreement-rich-editor.disabled .agreement-rich-editor-content {
    background: var(--mud-palette-action-disabled-background);
}

.agreement-policy-view-dialog {
    width: min(1040px, 100%);
}

.agreement-acceptance-statement {
    border: 1px solid var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-surface));
}

.agreement-policy-acceptances {
    min-height: 90px;
    overflow: auto;
}

.topbar-notification-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .65rem;
    width: 20rem;
    padding: .3rem 0;
}

.topbar-notification-item > span {
    display: grid;
    gap: .15rem;
    white-space: normal;
}

.topbar-notification-item strong,
.topbar-notification-item small {
    display: block;
}

.topbar-notification-item small {
    color: var(--mud-palette-text-secondary);
    line-height: 1.3;
}

.topbar-notification-item.is-unread strong {
    color: var(--mud-palette-primary);
}

.system-template-view-frame {
    min-width: 0;
    overflow: hidden;
}

.system-template-library-view {
    animation: system-template-library-enter 220ms ease-out both;
}

.system-template-scope-categories {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 14px;
}

.system-template-scope-category {
    appearance: none;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 11px;
    align-items: center;
    min-width: 0;
    padding: 14px;
    text-align: left;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.system-template-scope-category:hover {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}

.system-template-scope-category:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--mud-palette-primary) 30%, transparent);
    outline-offset: 2px;
}

.system-template-scope-category.is-selected {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 7%, var(--mud-palette-surface));
    box-shadow: inset 0 0 0 1px var(--mud-palette-primary);
}

.system-template-scope-category strong,
.system-template-scope-category small {
    display: block;
}

.system-template-scope-category small {
    margin-top: 2px;
    color: var(--mud-palette-text-secondary);
    line-height: 1.3;
}

.system-template-scope-category-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 11%, transparent);
    border-radius: 10px;
}

.system-template-scope-category-count {
    min-width: 30px;
    padding: 4px 8px;
    text-align: center;
    font-size: .78rem;
    font-weight: 700;
    color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    border-radius: 999px;
}

.system-template-grid {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    overflow: hidden;
}

.system-template-grid .mud-table-head .mud-table-cell {
    white-space: nowrap;
    font-weight: 700;
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-surface));
}

.system-template-grid .mud-table-cell {
    vertical-align: middle;
}

.system-template-grid .mud-table-head .mud-table-cell:last-child,
.system-template-grid .mud-table-body .mud-table-row .mud-table-cell:last-child {
    position: sticky;
    right: 0;
    z-index: 2;
    min-width: 78px;
    background: var(--mud-palette-surface);
    box-shadow: -6px 0 10px rgba(15, 23, 42, .04);
}

.system-template-grid .mud-table-head .mud-table-cell:last-child {
    z-index: 3;
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-surface));
}

.system-template-grid .mud-table-container {
    overflow-x: auto;
}

.system-template-name-link {
    appearance: none;
    padding: 0;
    color: var(--mud-palette-primary);
    background: transparent;
    border: 0;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.system-template-name-link:hover {
    text-decoration: underline;
}

.system-template-name-link:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 3px;
    border-radius: 2px;
}

.system-template-editor-view {
    min-width: 0;
    animation: system-template-editor-enter 300ms cubic-bezier(.22, .8, .28, 1) both;
}

.system-template-editor-grid {
    display: grid;
    grid-template-columns: minmax(300px, 32%) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.system-template-settings-column,
.system-template-designer-column {
    min-width: 0;
}

.system-template-settings-column {
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.system-template-designer-column {
    overflow: hidden;
}

.system-template-signee-options {
    flex-wrap: wrap;
}

@keyframes system-template-editor-enter {
    from { opacity: 0; transform: translateX(46px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes system-template-library-enter {
    from { opacity: 0; transform: translateX(-22px); }
    to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 900px) {
    .system-template-scope-categories {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .system-template-scope-category {
        transition: none;
    }
}

.template-designer-shell {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 760px;
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    background: #eef2f6;
}

.template-designer-palette,
.template-designer-inspector {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 12;
    width: min(320px, calc(100% - 40px));
    padding: 16px;
    overflow-y: auto;
    background: var(--mud-palette-surface);
    box-shadow: 0 18px 42px rgba(15, 23, 42, .2);
    transition: transform 220ms cubic-bezier(.22, .8, .28, 1), opacity 160ms ease;
}

.template-designer-palette {
    left: 0;
    border-right: 1px solid var(--mud-palette-lines-default);
    transform: translateX(0);
}

.template-designer-inspector {
    top: 60px;
    right: 0;
    border-left: 1px solid var(--mud-palette-lines-default);
    min-width: 0;
    transform: translateX(0);
}

.template-designer-shell.layout-drawer-closed .template-designer-palette {
    transform: translateX(-104%);
}

.template-designer-shell.inspector-drawer-closed .template-designer-inspector {
    transform: translateX(104%);
}

.template-designer-shell.layout-drawer-closed .template-designer-palette,
.template-designer-shell.inspector-drawer-closed .template-designer-inspector {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.template-designer-workspace {
    grid-column: 1;
}

.template-designer-panel-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.template-designer-panel-heading.compact {
    margin-bottom: 8px;
}

.template-designer-panel-heading > div {
    display: grid;
    min-width: 0;
}

.template-designer-panel-heading strong {
    font-size: 14px;
}

.template-designer-panel-heading span {
    color: var(--mud-palette-text-secondary);
    font-size: 11px;
}

.template-designer-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.template-designer-preset-grid button,
.template-block-palette button,
.template-smart-field {
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.template-designer-preset-grid button:hover,
.template-block-palette button:hover,
.template-smart-field:hover {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-surface));
    transform: translateY(-1px);
}

.template-designer-preset-grid button {
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 8px 4px;
    border-radius: 7px;
    font-size: 10px;
}

.template-column-preset {
    display: grid;
    grid-auto-flow: column;
    gap: 2px;
    width: 42px;
    height: 26px;
    padding: 3px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 3px;
}

.template-column-preset i {
    display: block;
    background: color-mix(in srgb, var(--mud-palette-primary) 20%, transparent);
    border-radius: 2px;
}

.template-block-palette {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.template-block-palette button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 6px;
    cursor: grab;
    font-size: 11px;
}

.template-block-palette button:active,
.template-smart-field:active {
    cursor: grabbing;
}

.template-smart-field-list {
    display: grid;
    gap: 5px;
    max-height: 350px;
    margin-top: 10px;
    overflow-y: auto;
}

.template-smart-field-category {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 7px 3px 3px;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.template-smart-field {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    cursor: grab;
    text-align: left;
    user-select: none;
}

.template-smart-field > span {
    display: grid;
    min-width: 0;
}

.template-smart-field strong {
    font-size: 11px;
}

.template-smart-field small {
    overflow: hidden;
    color: var(--mud-palette-text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-designer-workspace {
    min-width: 0;
    overflow: hidden;
}

.template-designer-workspace-toolbar {
    position: relative;
    z-index: 14;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
}

.template-designer-workspace-toolbar > div:first-child {
    display: grid;
}

.template-designer-workspace-toolbar span {
    color: var(--mud-palette-text-secondary);
    font-size: 11px;
}

.template-designer-stage {
    height: 700px;
    padding: 28px;
    overflow: auto;
    background-color: #e5eaf0;
    background-image: radial-gradient(#c5ced8 0.7px, transparent 0.7px);
    background-size: 14px 14px;
}

.template-designer-panel-heading > .mud-icon-button-root {
    margin-left: auto;
}

.template-page-shell {
    display: grid;
    gap: 8px;
    width: 720px;
    max-width: none;
    margin: 0 auto 30px;
}

.template-page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 30px;
    color: #506176;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.template-designer-page {
    width: 100%;
    min-height: 1018px;
    padding: var(--template-page-padding, 28px);
    margin: 0;
    overflow: hidden;
    border-radius: 3px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.17);
    color: #1f3249;
}

.template-page-actions {
    min-width: 0;
}

.template-designer-shell.preview-only {
    grid-template-columns: minmax(0, 1fr);
    border: 0;
    border-radius: 0;
    background: transparent;
}

.template-designer-shell.preview-only .template-designer-palette,
.template-designer-shell.preview-only .template-designer-inspector {
    display: none;
}

.template-designer-shell.preview-only .template-designer-workspace-toolbar {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px 8px 0 0;
}

.template-designer-shell.preview-only .template-designer-stage {
    height: auto;
    min-height: calc(100vh - 180px);
}

.template-designer-shell.preview-only .template-page-toolbar .mud-button-root {
    display: none;
}

.system-template-preview-page {
    display: grid;
    gap: 16px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px;
}

.system-template-preview-toolbar {
    position: sticky;
    z-index: 20;
    top: 8px;
}

.system-template-preview-heading,
.system-template-preview-footer {
    display: grid;
    gap: 3px;
    padding: 12px 18px;
    border-left: 4px solid var(--template-primary, #18688f);
    border-radius: 5px;
    background: #fff;
    color: #1f3249;
}

.system-template-preview-heading span,
.system-template-preview-footer {
    color: #64748b;
    font-size: 12px;
}

.system-template-preview-heading strong {
    color: var(--template-primary, #18688f);
    font-size: 20px;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    html,
    body,
    body:has(.system-template-preview-page) .mud-layout,
    body:has(.system-template-preview-page) .mud-main-content {
        width: 210mm;
        min-width: 210mm;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    body:has(.system-template-preview-page) .mud-appbar,
    body:has(.system-template-preview-page) .mud-drawer,
    body:has(.system-template-preview-page) .mud-overlay,
    body:has(.system-template-preview-page) #blazor-error-ui,
    .system-template-preview-toolbar,
    .template-designer-workspace-toolbar,
    .template-page-toolbar,
    .system-template-preview-heading,
    .system-template-preview-footer {
        display: none !important;
    }

    .system-template-preview-page,
    .template-designer-shell.preview-only,
    .template-designer-shell.preview-only .template-designer-workspace,
    .template-designer-shell.preview-only .template-designer-stage {
        display: block;
        width: 210mm;
        max-width: none;
        min-height: 0;
        margin: 0;
        padding: 0;
        overflow: visible;
        border: 0;
        background: #fff !important;
        background-image: none;
    }

    .template-page-shell {
        display: block;
        width: 210mm;
        margin: 0;
        break-after: page;
        page-break-after: always;
    }

    .template-page-shell:last-child {
        break-after: auto;
        page-break-after: auto;
    }

    .template-designer-page {
        width: 210mm;
        min-height: 297mm;
        margin: 0;
        overflow: visible;
        border: 0;
        border-radius: 0;
        box-shadow: none !important;
    }

    .template-designer-page,
    .template-designer-page * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .template-table-preview {
        overflow: visible;
    }
}

.template-canvas-section {
    position: relative;
    min-height: 70px;
    border: 1px solid transparent;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.template-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--template-component-heading-color, #1d2d3f);
}

.template-section-title::after {
    flex: 1;
    height: 1px;
    background: #cfdbe6;
    content: "";
}

.template-section-title > span {
    display: grid;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 4px;
    background: var(--template-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.template-section-title > strong {
    font-size: 16px;
}

.template-section-document-header {
    border-bottom: 3px solid var(--template-primary) !important;
}

.template-section-reference-strip .template-canvas-column + .template-canvas-column {
    border-left: 1px solid #cfdae4;
    padding-left: 12px;
}

.template-section-highlight {
    border-top-width: 0 !important;
    border-left: 5px solid var(--template-primary);
}

.template-section-declaration {
    padding-top: 0 !important;
}

.template-section-footer {
    border-top: 1px solid #cfdae4 !important;
}

.template-designer-stage.design .template-canvas-section:hover,
.template-designer-stage.design .template-canvas-section.selected {
    z-index: 2;
    border-color: color-mix(in srgb, var(--template-primary) 70%, #fff);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--template-primary) 30%, transparent);
}

.template-section-handle {
    position: absolute;
    z-index: 5;
    top: -31px;
    left: -1px;
    display: none;
    align-items: center;
    justify-content: space-between;
    width: calc(100% + 2px);
    min-height: 31px;
    padding-left: 8px;
    border-radius: 6px 6px 0 0;
    background: var(--template-primary);
    color: #fff;
    font-size: 11px;
    box-shadow: 0 -5px 14px rgba(15, 23, 42, 0.12);
}

.template-section-handle > span {
    display: flex;
    align-items: center;
}

.template-section-handle .mud-icon-button {
    color: #fff;
}

.template-canvas-section.selected {
    margin-top: 31px;
}

.template-canvas-section.selected .template-section-handle {
    display: flex;
}

.template-canvas-columns {
    display: grid;
    gap: 16px;
}

.template-canvas-column {
    min-width: 0;
    min-height: 52px;
    border: 1px dashed transparent;
    border-radius: 5px;
    transition: border-color 120ms ease, background 120ms ease;
}

.template-column-card,
.template-column-highlight-card,
.template-column-practitioner-card,
.template-column-declaration-panel {
    overflow: hidden;
    border: 1px solid #cfdae4;
    border-radius: 5px;
    background: #fff;
}

.template-column-highlight-card {
    border-color: #9fcceb;
    background: #eaf4fc;
}

.template-column-highlight-card > .template-column-title {
    background: #dceffa;
    color: #005f99;
}

.template-column-highlight-card .template-table-compact-card tbody th,
.template-column-highlight-card .template-table-compact-card tbody td {
    background: transparent;
}

.template-column-practitioner-card {
    background: #f5f8fa;
}

.template-column-practitioner-card .template-table-compact-card table,
.template-column-practitioner-card .template-table-compact-card tbody,
.template-column-practitioner-card .template-table-compact-card tr,
.template-column-practitioner-card .template-table-compact-card th,
.template-column-practitioner-card .template-table-compact-card td {
    display: block;
    width: 100%;
}

.template-column-practitioner-card .template-table-compact-card tr {
    padding: 5px 7px 6px;
    border-top: 1px solid #dde6ed;
}

.template-column-practitioner-card .template-table-compact-card tr:first-child {
    border-top: 0;
}

.template-column-practitioner-card .template-table-compact-card th,
.template-column-practitioner-card .template-table-compact-card td {
    padding: 0;
    border: 0;
}

.template-column-practitioner-card .template-table-compact-card th {
    margin-bottom: 2px;
}

.template-column-title {
    padding: 9px 12px 7px;
    background: var(--template-component-heading-bg, #f4f7fa);
    color: var(--template-component-heading-color, #00609b);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.template-column-card > .template-canvas-block,
.template-column-highlight-card > .template-canvas-block,
.template-column-practitioner-card > .template-canvas-block,
.template-column-declaration-panel > .template-canvas-block {
    margin-inline: 10px;
}

.template-designer-stage.design .template-canvas-column.selected {
    border-color: color-mix(in srgb, var(--template-primary) 48%, transparent);
    background: color-mix(in srgb, var(--template-primary) 2%, transparent);
}

.template-designer-stage.design .template-canvas-column.drag-target-ready {
    border-color: color-mix(in srgb, var(--template-primary) 32%, transparent);
    background: color-mix(in srgb, var(--template-primary) 3%, transparent);
}

.template-canvas-block {
    position: relative;
    min-height: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: grab;
    user-select: none;
    transition: opacity 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.template-canvas-block:active {
    cursor: grabbing;
}

.template-canvas-block.dragging {
    opacity: 0.32;
}

.template-designer-stage.design .template-canvas-block:hover,
.template-designer-stage.design .template-canvas-block.selected {
    border-color: var(--template-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--template-primary) 11%, transparent);
}

.template-block-drag-handle {
    position: absolute;
    top: -11px;
    right: 5px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 5px;
    border-radius: 999px;
    background: var(--template-primary);
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.03em;
    opacity: 0;
    pointer-events: none;
    transform: translateY(3px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.template-canvas-block:hover .template-block-drag-handle,
.template-canvas-block.selected .template-block-drag-handle {
    opacity: 1;
    transform: translateY(0);
}

.template-block-drop-zone {
    position: relative;
    z-index: 4;
    height: 0;
    overflow: visible;
    color: transparent;
    font-size: 9px;
    font-weight: 700;
    opacity: 0;
    transition: opacity 120ms ease;
}

.template-block-drop-zone.visible {
    color: color-mix(in srgb, var(--template-primary) 75%, #475569);
    opacity: 1;
}

.template-block-drop-zone.visible > span {
    position: absolute;
    top: -7px;
    left: 0;
    right: 0;
    display: grid;
    height: 14px;
    place-items: center;
    border: 1px dashed color-mix(in srgb, var(--template-primary) 36%, #cbd5e1);
    border-radius: 5px;
    background: color-mix(in srgb, var(--template-primary) 5%, rgba(255, 255, 255, 0.92));
    transition: height 120ms ease, top 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.template-block-drop-zone.active > span {
    top: -12px;
    height: 24px;
    border-color: var(--template-primary);
    background: color-mix(in srgb, var(--template-primary) 12%, #fff);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--template-primary) 25%, transparent);
}

.template-designer-stage.preview .template-canvas-block {
    cursor: default;
}

.template-block-preview {
    min-width: 0;
}

.template-block-eyebrow {
    color: var(--template-primary);
    letter-spacing: .055em;
    text-transform: uppercase;
}

.template-block-document-title {
    color: #17273a;
    line-height: 1.1;
}

.template-block-subtitle,
.template-block-muted {
    color: #5f6f81;
}

.template-block-badge {
    padding: 8px 10px;
    border-radius: 5px;
    background: color-mix(in srgb, var(--template-primary) 9%, #fff);
    color: #00609b;
    line-height: 1.2;
}

.template-rich-text-preview h2,
.template-rich-text-preview h3,
.template-rich-text-preview p,
.template-rich-text-preview ul,
.template-rich-text-preview ol,
.template-rich-text-preview blockquote {
    margin-top: 0;
    margin-bottom: 0.55em;
}

.template-smart-value {
    display: grid;
    gap: 2px;
}

.template-smart-value small {
    color: #6b7787;
    font-size: 0.68em;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.template-signature-block {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.template-signature-label,
.template-signature-statement {
    color: #6b7787;
    font-size: .68em;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.template-signature-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #53656d;
    font-size: 9px;
}

.template-signature-meta strong { color: #263f47; }
.template-signature-meta span { white-space: nowrap; }

.template-signature-pending {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px;
    border: 1px dashed #b9cbd0;
    border-radius: 7px;
    background: #f8fafb;
    color: #6c7d84;
    font-size: 10px;
    text-align: center;
}

.template-image-preview {
    display: block;
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.template-logo-placeholder {
    display: grid;
    gap: 5px;
    place-items: center;
    min-height: 82px;
    padding: 12px;
    border: 1px dashed #b9c4cf;
    border-radius: 6px;
    background: #f6f8fa;
    color: #718096;
    font-size: 10px;
    text-align: center;
}

.template-block-divider {
    margin: 8px 0;
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--template-primary) 45%, #d9e0e6);
}

.template-table-preview {
    overflow-x: auto;
}

.template-table-title {
    padding: 8px 10px;
    background: var(--template-component-heading-bg, #f4f7fa);
    color: var(--template-component-heading-color, #00609b);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.template-table-preview table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.template-table-preview th,
.template-table-preview td {
    padding: 8px 9px;
    border: 1px solid #dce3ea;
    text-align: left;
}

.template-table-preview thead th {
    background: color-mix(in srgb, var(--template-primary) 10%, #fff);
    color: #263a51;
}

.template-table-preview tbody th {
    width: 34%;
    background: #f7f9fb;
}

.template-table-compact-card th,
.template-table-compact-card td {
    padding: 5px 7px;
    border: 0;
    vertical-align: top;
}

.template-table-compact-card tbody th {
    width: 39%;
    background: transparent;
    color: #5e6e80;
    font-size: 9px;
    text-transform: uppercase;
}

.template-table-equipment table {
    table-layout: fixed;
}

.template-table-equipment thead th {
    border-color: #0069a7;
    background: #0069a7;
    color: #fff;
    font-size: 9px;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.template-table-equipment tbody td {
    padding: 7px 8px;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal;
}

.template-designer-stage.preview .template-section-handle {
    display: none !important;
}

.template-designer-stage.preview .template-canvas-section {
    min-height: 0;
    margin-top: 0;
}

.template-designer-stage.preview .template-canvas-column {
    min-height: 0;
}

.template-table-inspector-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) auto;
    gap: 5px;
    align-items: center;
}

.template-table-inspector-actions {
    display: flex;
    align-items: center;
    gap: 1px;
}

@media (max-width: 1450px) {
    .template-designer-stage {
        padding: 12px;
    }

    .template-designer-palette,
    .template-designer-inspector {
        padding: 12px;
    }

    .template-block-palette {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .system-template-editor-grid {
        grid-template-columns: 1fr;
    }

    .system-template-settings-column {
        max-height: none;
    }
}

@media (max-width: 1050px) {
    .template-designer-shell {
        grid-template-columns: 1fr;
    }

    .template-designer-palette,
    .template-designer-inspector {
        max-height: 430px;
        border: 0;
        border-bottom: 1px solid var(--mud-palette-lines-default);
    }


    .template-block-palette {
        grid-template-columns: repeat(3, 1fr);
    }
}

.agreement-gate-actions {
    flex: 0 0 auto;
}

.agreement-evidence-note {
    text-align: right;
}

@media (max-width: 600px) {
    .agreement-gate-overlay {
        padding: 10px;
    }

    .agreement-gate-dialog {
        max-height: calc(100vh - 20px);
        padding: 16px;
    }
}

.app-main-content {
    min-width: 0;
    transition: margin-left 220ms ease;
}

@media (min-width: 960px) {
    .app-main-content.secondary-drawer-open {
        margin-left: calc(var(--app-primary-drawer-width) + var(--app-secondary-drawer-width)) !important;
    }
}

@media (max-width: 959.98px) {
    .secondary-nav-drawer {
        width: min(var(--app-secondary-drawer-width), calc(100vw - var(--app-primary-drawer-width)));
    }
}

.drawer-footer {
    display: grid;
    gap: 4px;
    margin-top: auto;
    padding: 12px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.drawer-footer .mud-button-root {
    justify-content: flex-end;
}

.drawer-footer .mud-button-label {
    justify-content: flex-end;
}

.page-container {
    padding: 24px;
}

.page-heading {
    flex-wrap: wrap;
    gap: 16px;
}

.metric-card {
    min-height: 112px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.table-selection-cell {
    width: 48px;
    text-align: center;
}

.table-primary-link {
    color: var(--mud-palette-primary);
    font-weight: 400;
}

.table-primary-link:hover {
    text-decoration: underline;
}

.identifier-inline {
    flex-wrap: nowrap;
    min-width: 0;
}

.identifier-inline span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-chip-list {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    max-width: 220px;
}

.compact-chip-list span {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--mud-palette-text-primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.compact-chip-list span.muted {
    color: var(--mud-palette-text-secondary);
    font-weight: 500;
}

.compact-chip-list span.success {
    border-color: #bbf7d0;
    background: #dcfce7;
    color: #166534;
}

.compact-chip-list span.warning {
    border-color: #fde68a;
    background: #fef3c7;
    color: #92400e;
}

.compact-chip-list span.danger {
    border-color: #fecaca;
    background: #fee2e2;
    color: #991b1b;
}

.relationship-assignment-chips {
    max-width: 280px;
}

.relationship-assignment-chips span {
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relationship-count-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: max-content;
    margin-top: 4px;
    font-weight: 700;
}

.membership-compact-list {
    display: grid;
    gap: 5px;
    min-width: 190px;
}

.membership-compact-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 26px;
}

.membership-organisation-cell {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.membership-organisation-cell > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
}

.membership-organisation-cell > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--mud-palette-text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.membership-status-text {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--mud-palette-text-secondary);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

.membership-status-text > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mud-palette-info);
}

.membership-status-text.success > span {
    background: var(--mud-palette-success);
}

.membership-status-text.warning > span {
    background: var(--mud-palette-warning);
}

.membership-status-text.danger > span {
    background: var(--mud-palette-error);
}

.user-role-chips {
    max-width: 260px;
}

.user-role-chips span {
    max-width: 116px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-action-icons {
    align-items: center;
    flex-wrap: nowrap;
}

.credential-upload-form {
    display: block;
}

.native-field {
    display: grid;
    gap: 5px;
}

.native-field label {
    color: var(--mud-palette-text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.native-field input,
.native-field select,
.native-field textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font: inherit;
}

.native-field textarea {
    resize: vertical;
}

.native-check-field {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 9px;
    color: var(--mud-palette-text-primary);
    cursor: pointer;
    font-size: 13px;
    line-height: 1.45;
}

.native-check-field input {
    margin-top: 3px;
    accent-color: var(--mud-palette-primary);
}

.credential-selfie-capture {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 35%, var(--mud-palette-lines-default));
    border-radius: 12px;
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-surface));
}

.credential-selfie-capture[hidden] {
    display: none;
}

.selfie-guide-copy {
    display: grid;
    gap: 3px;
    color: var(--mud-palette-text-primary);
    font-size: 13px;
    line-height: 1.45;
}

.selfie-guide-copy span,
.selfie-capture-status {
    color: var(--mud-palette-text-secondary);
}

.selfie-camera-frame {
    position: relative;
    width: min(100%, 310px);
    aspect-ratio: 4 / 5;
    margin-inline: auto;
    overflow: hidden;
    border-radius: 18px;
    background: #15202b;
    isolation: isolate;
}

.selfie-camera-frame video,
.selfie-camera-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.selfie-camera-frame video {
    transform: scaleX(-1);
}

.selfie-face-guide {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.selfie-face-oval {
    position: absolute;
    top: 11%;
    left: 22%;
    width: 56%;
    height: 69%;
    border: 3px solid rgba(255, 255, 255, 0.95);
    border-radius: 50% 50% 46% 46%;
    box-shadow: 0 0 0 999px rgba(9, 18, 27, 0.42);
}

.selfie-eye-line {
    position: absolute;
    top: 39%;
    left: 31%;
    width: 38%;
    border-top: 1px dashed rgba(255, 255, 255, 0.85);
}

.selfie-camera-placeholder {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-content: center;
    gap: 7px;
    padding: 28px;
    color: #fff;
    text-align: center;
}

.selfie-camera-placeholder > span {
    font-size: 28px;
    color: var(--mud-palette-primary-lighten);
}

.selfie-camera-placeholder small {
    color: rgba(255, 255, 255, 0.72);
}

.selfie-capture-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.selfie-action {
    min-height: 38px;
    padding: 7px 14px;
    border: 1px solid var(--mud-palette-primary);
    border-radius: var(--mud-default-borderradius);
    background: transparent;
    color: var(--mud-palette-primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.selfie-action.primary {
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
}

.selfie-action:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--mud-palette-primary) 32%, transparent);
    outline-offset: 2px;
}

.selfie-capture-status {
    min-height: 20px;
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.flow-step {
    min-height: 94px;
    padding: 16px;
}

.solution-action-panel {
    height: 100%;
    padding: 16px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
}

.solution-form-drawer {
    width: min(560px, 100vw);
}

.solution-summary-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.solution-stat {
    min-height: 76px;
    padding: 12px;
    justify-content: center;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
}

.solution-landing-card {
    height: 100%;
    min-height: 248px;
    padding: 18px;
    border: 1px solid var(--mud-palette-lines-default);
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.solution-landing-card.selected {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 10px 24px rgba(0, 120, 200, 0.16);
}

.solution-card-actions {
    margin-top: auto;
    flex-wrap: wrap;
}

.profile-actions {
    flex-wrap: wrap;
}

.profile-tabs > .mud-tabs-tabbar,
.profile-tabs .mud-tabs-tabbar {
    margin-bottom: 10px !important;
}

.user-profile-panel,
.profile-side-card {
    height: fit-content;
}

.connected-orgs-panel {
    position: sticky;
    top: 84px;
}

.profile-access-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.profile-access-metrics div {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: #f8fafc;
}

.profile-access-metrics span {
    color: var(--mud-palette-text-secondary);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.profile-access-metrics strong {
    color: var(--mud-palette-primary);
    font-size: 22px;
    line-height: 1;
}

.profile-org-summary-list {
    display: grid;
    gap: 6px;
    margin-top: 4px;
}

.profile-org-summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 66px;
    padding: 10px 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    text-align: left;
    cursor: pointer;
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.profile-org-summary-card:hover,
.profile-org-summary-card.selected {
    border-color: var(--mud-palette-primary);
    background: #f4faff;
    box-shadow: 0 8px 20px rgba(0, 120, 200, 0.10);
}

.profile-org-summary-main,
.profile-org-summary-side {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.profile-org-summary-side {
    justify-items: end;
    flex: 0 0 auto;
}

.profile-org-summary-side > span:first-child {
    color: var(--mud-palette-text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.profile-org-summary-title {
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-org-summary-meta {
    color: var(--mud-palette-text-secondary);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.personal-contact-card,
.company-details-card,
.profile-side-card {
    border: 1px solid var(--mud-palette-lines-default);
}

.profile-card-header {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 6px 0 20px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    text-align: center;
}

.profile-card-heading {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-width: 0;
    width: 100%;
}

.profile-inline-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    color: var(--mud-palette-text-secondary);
    font-size: 13px;
}

.profile-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-height: 26px;
    padding: 4px 9px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--mud-palette-text-secondary);
    font-size: 12px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-info-badge.status.success {
    border-color: #bbf7d0;
    background: #dcfce7;
    color: #166534;
}

.profile-info-badge.status.warning {
    border-color: #fde68a;
    background: #fef3c7;
    color: #92400e;
}

.profile-info-badge.status.danger {
    border-color: #fecaca;
    background: #fee2e2;
    color: #991b1b;
}

.image-upload-control {
    position: relative;
    width: 100%;
    border-radius: var(--mud-default-borderradius);
    overflow: hidden;
    cursor: pointer;
}

.profile-avatar-upload {
    width: 156px;
    min-width: 156px;
    border-radius: 50%;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
}

.profile-avatar-native-upload {
    display: grid;
    justify-items: center;
    gap: 12px;
}

.image-upload-surface {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 164px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: #f8fafc;
    overflow: hidden;
}

.image-upload-surface img {
    display: block;
    width: 100%;
    height: 100%;
}

.profile-photo-surface {
    aspect-ratio: 1 / 1;
}

.profile-avatar-surface {
    width: 156px;
    height: 156px;
    min-height: 156px;
    border-radius: 50%;
    background: #eaf5fc;
    color: var(--mud-palette-primary);
    border: 4px solid #fff;
}

.profile-avatar-surface img {
    object-fit: cover;
}

.profile-photo-surface img {
    object-fit: cover;
}

.avatar-overlay {
    border-radius: 50%;
}

.company-section-header {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.company-logo-column {
    height: 100%;
    align-items: flex-end;
}

.company-logo-upload {
    width: 100%;
    max-width: 260px;
}

.company-logo-native-upload {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 260px;
}

.company-logo-surface {
    height: 178px;
    background: #f8fafc;
}

.company-logo-surface img {
    object-fit: contain;
    padding: 16px;
}

.organisation-logo-upload {
    width: 100%;
    max-width: 240px;
}

.organisation-logo-simple-upload {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.organisation-logo-upload.uploading {
    cursor: wait;
}

.organisation-logo-surface {
    height: 150px;
    background: #f8fafc;
}

.organisation-logo-surface img {
    object-fit: contain;
    padding: 14px;
}

.organisation-logo-static-surface {
    min-height: 150px;
}

.organisation-logo-upload-action {
    justify-content: center;
}

.native-image-upload-form {
    display: flex;
    justify-content: center;
    width: 100%;
}

.organisation-logo-edit-surface {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 210px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: #f8fafc;
    cursor: pointer;
    overflow: hidden;
}

.organisation-logo-edit-surface img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 210px;
    object-fit: contain;
    padding: 18px;
}

.organisation-logo-edit-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    color: #fff;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
    z-index: 2;
}

.organisation-logo-edit-overlay {
    position: absolute;
    inset: auto 0 0;
    display: flex;
    justify-content: center;
    padding: 10px;
    background: rgba(15, 23, 42, 0.66);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    opacity: 0;
    transition: opacity 140ms ease;
}

.organisation-logo-edit-surface:hover .organisation-logo-edit-overlay,
.organisation-logo-edit-surface:focus-within .organisation-logo-edit-overlay {
    opacity: 1;
}

.organisation-logo-upload.uploading .image-upload-overlay {
    opacity: 1;
}

.image-empty-state {
    display: grid;
    gap: 8px;
    align-items: center;
    justify-items: center;
    width: 100%;
    color: var(--mud-palette-primary);
    text-align: center;
    font-weight: 800;
}

.profile-avatar-empty {
    font-size: 13px;
}

.company-logo-empty {
    min-height: 140px;
    padding: 18px;
    color: #475569;
}

.company-logo-empty span {
    color: var(--mud-palette-text-secondary);
    font-size: 13px;
}

.recent-activity-card {
    border: 1px solid var(--mud-palette-lines-default);
}

.recent-activity-heading {
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.recent-activity-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.recent-activity-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: #f8fafc;
}

.recent-activity-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #eaf5fc;
    color: var(--mud-palette-primary);
}

.recent-activity-content {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.recent-activity-title-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.recent-activity-title-line span {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    font-weight: 800;
}

.image-upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.62);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease;
}

.image-upload-control:hover .image-upload-overlay,
.image-upload-control:focus-within .image-upload-overlay {
    opacity: 1;
}

.image-upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.user-image-preview,
.user-logo-preview {
    width: 100%;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
    overflow: hidden;
}

.user-image-preview img,
.user-logo-preview img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    padding: 10px;
}

.user-image-preview img {
    object-fit: cover;
    padding: 0;
}

.abn-section-heading,
.abn-lookup-actions {
    gap: 12px;
    flex-wrap: wrap;
}

.user-abn-expansion .mud-expand-panel {
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: none;
}

.abn-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
}

.abn-detail-tile {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: #f8fafc;
}

.abn-detail-tile span {
    color: var(--mud-palette-text-secondary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.abn-detail-tile strong {
    overflow-wrap: anywhere;
    font-size: 13px;
    font-weight: 700;
}

.abn-history-table {
    max-height: 360px;
    overflow: auto;
}

.access-console {
    align-items: stretch;
}

.access-org-sidebar,
.access-detail-card {
    height: 100%;
}

.access-org-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.access-org-card {
    display: grid;
    gap: 6px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    text-align: left;
    cursor: pointer;
}

.access-org-card:hover,
.access-org-card.selected {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 10px 24px rgba(0, 120, 200, 0.14);
}

.access-org-card-title {
    font-weight: 700;
}

.access-org-card-meta {
    color: var(--mud-palette-text-secondary);
    font-size: 13px;
}

.access-organisation-heading,
.access-solution-heading {
    gap: 12px;
    flex-wrap: wrap;
}

.access-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 12px;
}

.access-summary-tile {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: #f8fafc;
}

.access-summary-tile span {
    color: var(--mud-palette-text-secondary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.access-summary-tile strong {
    font-size: 22px;
    line-height: 1;
}

.access-chip-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.access-chip-list span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--mud-palette-text-primary);
    font-size: 13px;
    font-weight: 700;
}

.access-list-table {
    max-height: 420px;
    overflow: auto;
}

.access-solution-expansion .mud-expand-panel {
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: none;
}

.drawer-heading {
    width: 100%;
}

.form-action {
    display: flex;
    align-items: center;
    padding-top: 14px;
}

.align-end {
    justify-content: flex-end;
}

.checkbox-field {
    display: flex;
    align-items: center;
    min-height: 56px;
}

.mud-input > input.mud-input-root,
.mud-input > textarea.mud-input-root {
    padding-top: 11.5px;
    padding-bottom: 11.5px;
}

.relationship-panel {
    padding: 20px;
}

.relationship-header {
    gap: 18px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.status-stack {
    justify-content: flex-end;
}

.embedded-table {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    overflow: hidden;
}

.organisation-logo-preview {
    width: 100%;
    max-width: 220px;
    height: 140px;
    object-fit: contain;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
    padding: 12px;
}

.logo-placeholder {
    width: 100%;
    max-width: 220px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
}

.abn-status-icons {
    min-height: 28px;
}

.abn-info-hover {
    display: inline-flex;
    align-items: center;
}

.abn-popover {
    min-width: 260px;
    max-width: 340px;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.pill.success {
    background: #dcfce7;
    color: #166534;
}

.pill.warning {
    background: #fef3c7;
    color: #92400e;
}

.pill.danger {
    background: #fee2e2;
    color: #991b1b;
}

.stack-line {
    display: grid;
    gap: 2px;
    margin-bottom: 8px;
}

.stack-line span {
    color: #64748b;
    font-size: 13px;
}

.solution-table-expansion {
    width: min(560px, 100%);
}

.solution-table-expansion .mud-expand-panel {
    border: 1px solid #e2e8f0;
    box-shadow: none;
}

.solution-table-expansion .mud-expand-panel-header {
    min-height: 36px;
    padding: 0 12px;
}

.solution-table-expansion .mud-expand-panel-content {
    padding: 12px;
}

@media (max-width: 900px) {
    .page-container {
        padding: 16px;
    }

    .form-action {
        padding-top: 0;
    }

    .status-stack {
        justify-content: flex-start;
    }

    .access-summary-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .abn-detail-grid {
        grid-template-columns: 1fr;
    }

    .connected-orgs-panel {
        position: static;
    }

    .profile-card-header {
        align-items: flex-start;
    }

    .profile-org-summary-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .profile-org-summary-side {
        justify-items: start;
    }
}

.rec-report-chart-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    contain: inline-size;
}

.rec-report-chart-card-content {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.rec-report-chart-host {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    contain: inline-size;
}

.rec-report-chart-scroll {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    contain: inline-size;
    overscroll-behavior-inline: contain;
}

.rec-report-chart-scroll.rec-report-chart-spacing-drag {
    cursor: ew-resize;
    user-select: none;
}

.rec-report-chart {
    display: block;
}

.rec-report-time-chart {
    max-width: none;
    flex: none;
}

.rec-report-chart .rec-report-chart-mark {
    cursor: help;
}

.rec-report-chart .rec-report-chart-bar {
    transition: x 320ms ease, y 320ms ease, width 320ms ease, height 320ms ease;
}

.rec-report-chart .rec-report-chart-point {
    transition: cx 320ms ease, cy 320ms ease, r 140ms ease;
}

.rec-report-chart .rec-report-chart-point:hover {
    r: 6px;
}

.rec-report-chart .rec-report-chart-line {
    transition: d 320ms ease;
}

.rec-report-chart .rec-report-chart-label,
.rec-report-chart .rec-report-chart-value {
    transition: transform 320ms ease;
}

@media (prefers-reduced-motion: reduce) {
    .rec-report-chart .rec-report-chart-bar,
    .rec-report-chart .rec-report-chart-point,
    .rec-report-chart .rec-report-chart-line,
    .rec-report-chart .rec-report-chart-label,
    .rec-report-chart .rec-report-chart-value {
        transition: none;
    }
}

.mud-table-row.billing-plan-detail-row {
    background: color-mix(in srgb, var(--mud-palette-surface) 94%, var(--mud-palette-primary) 6%);
}

.mud-table-row.billing-plan-detail-row:hover {
    background: color-mix(in srgb, var(--mud-palette-surface) 89%, var(--mud-palette-primary) 11%);
}

.mud-table-row.billing-plan-detail-row > .mud-table-cell:first-child {
    padding-left: 48px;
    border-left: 4px solid color-mix(in srgb, var(--mud-palette-primary) 45%, transparent);
}

.mud-table-row.billing-plan-detail-row > .mud-table-cell:nth-child(2) {
    padding-left: 72px;
}

.billing-plan-group-content {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

.mud-datagrid-group > div > .mud-table-row-expander {
    align-self: flex-start;
    margin-top: 16px;
    z-index: 1;
}

.billing-plan-parent-row,
.billing-plan-inner-header {
    display: grid;
    grid-template-columns: 64px 20fr 14fr 12fr 12fr 13fr 17fr 12fr 72px;
    width: calc(100% + 50px);
    margin-left: -34px;
}

.billing-plan-grid .mud-table-root {
    min-width: 1120px;
    table-layout: fixed;
}

.billing-plan-grid .mud-datagrid-group.py-1 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.billing-plan-grid .mud-table-head .mud-table-cell:nth-child(1) {
    width: 64px !important;
}

.billing-plan-grid .mud-table-head .mud-table-cell:nth-child(2) {
    width: 20%;
}

.billing-plan-grid .mud-table-head .mud-table-cell:nth-child(3) {
    width: 14%;
}

.billing-plan-grid .mud-table-head .mud-table-cell:nth-child(4) {
    width: 12%;
}

.billing-plan-grid .mud-table-head .mud-table-cell:nth-child(5) {
    width: 12%;
}

.billing-plan-grid .mud-table-head .mud-table-cell:nth-child(6) {
    width: 13%;
}

.billing-plan-grid .mud-table-head .mud-table-cell:nth-child(7) {
    width: 17%;
}

.billing-plan-grid .mud-table-head .mud-table-cell:nth-child(8) {
    width: 12%;
}

.billing-plan-grid .mud-table-head .mud-table-cell:nth-child(9) {
    width: 72px !important;
}

.billing-plan-parent-row {
    align-items: center;
    min-height: 64px;
    background: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.billing-plan-parent-cell {
    min-width: 0;
    padding: 8px 16px;
}

.billing-plan-parent-select {
    padding-left: 32px;
}

.billing-plan-parent-organisation,
.billing-plan-parent-status,
.billing-plan-parent-invoice-details,
.billing-plan-parent-actions {
    display: flex;
    align-items: center;
}

.billing-plan-parent-organisation {
    gap: 8px;
}

.billing-plan-parent-organisation-text {
    min-width: 0;
}

.billing-plan-parent-organisation-name,
.billing-plan-parent-organisation-email {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.billing-plan-parent-status,
.billing-plan-parent-invoice-details {
    flex-wrap: wrap;
    gap: 6px;
}

.billing-plan-parent-actions {
    justify-content: flex-end;
    padding-right: 4px;
    padding-left: 4px;
}

.billing-plan-inner-header {
    align-items: center;
    min-height: 40px;
    margin-top: 0;
    margin-bottom: -4px;
    border-left: 4px solid color-mix(in srgb, var(--mud-palette-primary) 45%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-primary) 30%, var(--mud-palette-lines-default));
    background: color-mix(in srgb, var(--mud-palette-surface) 88%, var(--mud-palette-primary) 12%);
    color: var(--mud-palette-text-primary);
    font-size: 0.75rem;
    font-style: italic;
    font-weight: 600;
    line-height: 1.25;
}

.billing-plan-inner-header > span {
    min-width: 0;
    padding: 8px 16px;
}

.billing-plan-inner-header > span:nth-child(2) {
    padding-left: 72px;
}

.mud-table-row.billing-invoice-deleted-row {
    background: color-mix(in srgb, var(--mud-palette-surface) 95%, var(--mud-palette-error) 5%);
}

.mud-table-row.billing-invoice-deleted-row:hover {
    background: color-mix(in srgb, var(--mud-palette-surface) 90%, var(--mud-palette-error) 10%);
}

.stc-workflow-status-popover {
    min-width: 220px !important;
}

.stc-workflow-status-list .mud-list-item {
    white-space: nowrap;
}

.platform-access-badges {
    max-width: 190px;
}

.compact-chip-list span.platform-system-admin {
    border-color: #fecaca;
    background: #fff1f2;
    color: #9f1239;
}

.compact-chip-list span.platform-owner {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.compact-chip-list span.platform-admin {
    border-color: #bae6fd;
    background: #f0f9ff;
    color: #075985;
}

.stc-clickable-form-error {
    cursor: pointer;
}

.stc-form-error-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stc-form-error-content small {
    font-size: 0.72rem;
    opacity: 0.82;
}

.stc-error-target-highlight {
    border-radius: 12px;
    animation: stc-error-target-pulse 2.1s ease-out;
}

@keyframes stc-error-target-pulse {
    0%, 38% {
        background-color: color-mix(in srgb, var(--mud-palette-error) 13%, transparent);
        box-shadow: 0 0 0 4px color-mix(in srgb, var(--mud-palette-error) 42%, transparent);
    }

    100% {
        background-color: transparent;
        box-shadow: 0 0 0 0 transparent;
    }
}

.stc-attention-target-highlight {
    scroll-margin-block: 96px;
    outline: none;
    animation: stc-attention-target-pulse 2.7s ease-out;
}

@keyframes stc-attention-target-pulse {
    0%, 34% {
        border-color: #d59a2c;
        box-shadow: 0 0 0 5px rgba(213, 154, 44, .28), 0 12px 30px rgba(91, 65, 17, .12);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(213, 154, 44, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .stc-error-target-highlight {
        animation: none;
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--mud-palette-error) 42%, transparent);
    }

    .stc-attention-target-highlight {
        animation: none;
        border-color: #d59a2c;
        box-shadow: 0 0 0 4px rgba(213, 154, 44, .3);
    }
}
