html {
    background-color: var(--bg);
    --border: var(--fg-90);
}

.main>.card {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin-top: 0;
    margin-bottom: 0;
    border: none;
}

.entity-header {
    display: grid;
    grid-template-areas: "avatar name";
    grid-template-columns: auto 1fr;
    gap: 0.5em;
    align-items: center;
    justify-items: start;
}

.entity-header.large {
    font-size: 2em;
}

.entity-avatar {
    object-fit: cover;
    grid-area: avatar;
    border-radius: 50%;
    width: 2em;
    height: 2em;
    box-shadow: rgba(0, 0, 0, 0.025) 0 6px 24px 0px, rgba(0, 0, 0, 0.028) 0 0 0 1px;
}

.entity-name {
    grid-area: name;
    word-break: keep-all;
    font-size: 1em;
}

.factsheet {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5em;
}

.fact-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
}

.fact-key {
    font-weight: bold;
    text-transform: uppercase;
    color: var(--primary);
    opacity: 0.9;
    font-size: 0.85em;
}

.fact-value {
    margin-left: 0.5em;
    font-size: 0.9em;
}

.vote-card.small,
.membership-card.small {
    font-size: 0.8em;
    margin-top: 0;
    margin-bottom: 0;
}

.membership-card.normal {
    font-size: 1em;
}

.membership-card.large {
    font-size: 1.5em;
}

.membership-card .card-body {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5em;
    align-items: center;
}

.membership-card .membership-title::before {
    content: "•";
    margin-left: 0.5ch;
    margin-right: 0.5ch;
}

.membership-card .membership-title {
    font-weight: bold;
    text-transform: uppercase;
    color: var(--primary);
    opacity: 0.9;
}

.memberships-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.5em;
}

.membership-card .membership-since {
    font-size: 0.85em;
    opacity: 0.8;
}

.entity-card.small {
    margin: 0;
    padding: 0.5em;
}

.entity-card.small .entity-name {
    margin-top: 0;
    margin-bottom: 0;
}

.entity-card .children-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5em;
}

.entity-card .entity-description {
    margin: 2em 0;
    min-height: 4em;
    border-left: 1px solid var(--border);
    padding-left: 1em;
}

:has(> .loading-overlay) {
    position: relative;
    min-height: 6em;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background-color: transparent;
    backdrop-filter: blur(1px) brightness(0.75);
}

.loading-overlay-icon {
    margin-bottom: 0;
}

.loading-overlay-message {
    margin-top: 0;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 1em;
    border: none;
    border-left: 1px solid #24242488;
    padding: 0;
    margin: 0;
    padding-left: 0.25em;
}

.field-group>*:not(legend) {
    padding-left: 0.25em;
}

.field {
    display: grid;
    grid-template-areas: "label"
        "input"
        "helper"
        "errors";
    grid-template-columns: 1fr;
    padding: 0.25em;
    gap: 0.25em;
    align-items: center;
}

.field.account-picker-field,
.field.organ-picker-field {
    grid-template-areas: "label"
        "preview"
        "input"
        "helper"
        "errors";
}

.account-header-preview,
.organ-header-preview {
    grid-area: preview;
}

.field-label {
    grid-area: label;
    cursor: pointer;
}

.field-input {
    grid-area: input;
    padding: 0.5em;
    border: 1px solid #24242488;
    border-radius: 0.25em;
    box-shadow: none;
}

.field-helper {
    grid-area: helper;
    font-size: small;
    opacity: 0.75;
}

.field-errors {
    grid-area: errors;
    color: var(--negative);
    font-size: small;
    margin: 0;
    padding: 0;
    padding-left: 1.2em;
    list-style-type: disc;
    min-height: 1.2em;
}

.field-input[type="file"] {
    padding: 2em;
}

.btn.focus,
.btn.hover,
.btn:focus,
.btn:hover {
    transform: scale(1);
}

.btn.active,
.btn:active {
    transform: translateY(3px);
}

.object-actions-section,
.entity-actions-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    flex-direction: row;
    justify-content: flex-end;
}

.field input[type="checkbox"] {
    position: relative;
    width: fit-content;
    width: 1.5em;
    height: 1.5em;
}

.field input[type="checkbox"]::before {
    content: "";
    position: absolute;
    display: block;
    top: 0;
    left: 0;
    width: 1.5em;
    height: 1.5em;
    border: 0.1em solid var(--border);
    background-color: var(--bg);
    cursor: pointer;
}

.field input[type="checkbox"]:checked::before {
    --checked: var(--primary);
    background-color: var(--checked);
    border-color: var(--checked);
}

.field.field-secondary input[type="checkbox"]:checked::before {
    --checked: var(--secondary);
}

.field.field-accent input[type="checkbox"]:checked::before {
    --checked: var(--accent);
}

.field.field-info input[type="checkbox"]:checked::before {
    --checked: var(--info);
}

.field.field-positive input[type="checkbox"]:checked::before {
    --checked: var(--positive);
}

.field.field-warning input[type="checkbox"]:checked::before {
    --checked: var(--warning);
}

.field.field-negative input[type="checkbox"]:checked::before {
    --checked: var(--negative);
}

.field.field-bg input[type="checkbox"]:checked::before {
    --checked: var(--bg);
}

.field.field-fg input[type="checkbox"]:checked::before {
    --checked: var(--fg);
}

.field input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    display: block;
    top: 0.15em;
    left: 0.15em;
    width: 1.25em;
    height: 0.75em;
    border-left: 0.25em solid var(--fg);
    border-bottom: 0.25em solid var(--fg);
    transform: rotate(-45deg);
}

.field input[type="checkbox"]:disabled::before,
.field input[type="checkbox"].disabled::before,
.field input[type="checkbox"].readonly::before,
.field input[type="checkbox"]:disabled:checked::before,
.field input[type="checkbox"].disabled:checked::after,
.field input[type="checkbox"].readonly:checked::after,
.field input[type="checkbox"]:disabled:checked::before,
.field input[type="checkbox"].disabled:checked::after,
.field input[type="checkbox"].readonly:checked::after {
    opacity: 0.5;
    cursor: not-allowed;
}

.table-rows-selector {
    background-color: inherit;
    color: inherit;
    border: none;
    border-bottom: 1px solid var(--primary);
}

.table-rows-selector option {
    background-color: var(--bg);
    color: var(--text);
}

.modal {
    word-break: break-word;
}

.votes-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.5em;
}

.vote-card.small .vote-card-body {
    display: grid;
    grid-template-areas: "avatar content";
    grid-template-columns: auto 1fr;
    gap: 0.5em;
    align-items: center;
}

.vote-card.large .vote-card-description,
.vote-card.normal .vote-card-description {
    padding: 1em;
    max-width: 80ch;
}

.vote-card-content {
    grid-area: content;
    display: grid;
    grid-template-areas: "question"
        "stats";
    grid-template-columns: 1fr;
}

.vote-card-avatar {
    grid-area: avatar;
}

.vote-card-question {
    grid-area: question;
}

.vote-card-stats {
    grid-area: stats;
    font-size: 0.75em;
}

.vote-result-stat {
    display: grid;
    grid-template-areas: "label value percentage";
    grid-template-columns: auto 1fr auto;
    gap: 0.5em;
    width: 100%;
    align-items: center;
}

.vote-result-stat .stat-label {
    grid-area: label;
    font-weight: bold;
    text-transform: uppercase;
    min-width: var(--stat-label-min-width, auto);
}

.vote-result-stat .stat-bar {
    grid-area: value;
    background-color: var(--bg-90);
    height: 1em;
    border-radius: 1em;
    position: relative;
}

.vote-result-stat .stat-bar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 1em;
    border-radius: 1em;
    width: min(max(1em, var(--fill-percentage, 0)), 100%);
    background-color: var(--stat-bar-color);
}

.vote-result-stat.highlighted-stat .stat-bar::before {
    box-shadow: 0 0 0.5em var(--stat-bar-color);
    animation: vote-stat-box-shadow-pulse 3s infinite ease-in-out;
}

.vote-result-stat .stat-percentage {
    grid-area: percentage;
    min-width: 8ch;
    text-align: right;
}

.vote-result-stat .stat-percentage::before {
    content: "•";
    margin-left: 0.5ch;
    margin-right: 0.5ch;
}

.vote-result-literal {
    font-weight: bold;
    text-transform: uppercase;
}

.vote-header.large {
    font-size: 2em;
}

.vote-result-pools {
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    flex-wrap: wrap;
    gap: 1em;
}

.vote-result-pool .pool-ballots {
    margin-top: 1em;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5em;
}

.highlighted-pool {
    --highlight-color: var(--primary);
    padding: 0.5em;
    border: 1px solid var(--primary);
    border-radius: 1em;
    animation: highlight-box-shadow-pulse 3s infinite ease-in-out;
}

.highlighted-card {
    --highlight-color: var(--primary);
    box-shadow: 0 0 0.5em var(--highlight-color);
    animation: highlight-box-shadow-pulse 3s infinite ease-in-out;
}

.table-controls-region {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    align-items: center;
    gap: 0.5em;
}

.table-footer {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5em;
}

.table-control-field {
    background-color: inherit;
    color: inherit;
    border: none;
    border-bottom: 1px solid var(--table-theme);
}

.table-control-field option {
    background-color: var(--bg);
    color: var(--text);
}

.vote-voting-section {
    margin-top: 2em;
    margin-bottom: 2em;
}

.btn-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: baseline;
    justify-content: center;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 0.25em;
    border-bottom-left-radius: 0.25em;
}

.btn-group .btn:last-child {
    border-top-right-radius: 0.25em;
    border-bottom-right-radius: 0.25em;
}

.navbar {
    color: var(--primary-fg);
    background-color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding: 0;
    display: grid;
    grid-template-areas: "brand links actions";
    grid-template-columns: auto 1fr auto;
    font-size: 0.9em;
    align-items: stretch;
}



.navbar .nav-hamburger {
    display: none;
}

.navbar .nav-brand {
    grid-area: brand;
}

.navbar .nav-actions {
    grid-area: actions;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1em;
}

.nav-action-button {
    height: 100%;
    border-radius: 0;
    margin: 0;
}

.nav-logout-button:not(:hover):not(:focus):not(.hover):not(.focus) {
    background-color: inherit;
    color: inherit;
}

.nav-logout-button:active,
.nav-logout-button.active {
    transform: none;
}

.navbar .nav-list {
    grid-area: links;
    justify-self: center;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    width: 100%;
}

.nav-item-group>.nav-subitems {
    display: none;
    position: relative;
}

.nav-subitems {
    margin: 0;
    padding: 0;
}

.nav-group-caret {
    grid-area: caret;
    transition: transform 0.2s ease-in-out;
}

.nav-item-group:hover>.nav-link-group>.nav-group-caret,
.nav-item-group:focus-within>.nav-link-group>.nav-group-caret,
.nav-item-group.open>.nav-link-group>.nav-group-caret {
    transform: rotate(90deg);
    text-decoration: none;
}

.nav-item-group:hover>.nav-subitems,
.nav-item-group:focus-within>.nav-subitems,
.nav-item-group.open>.nav-subitems {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 100%;
    left: 0;
    box-shadow: rgba(0, 0, 0, 0.025) 0 6px 24px 0px, rgba(0, 0, 0, 0.028) 0 0 0 1px;
    border: 1px solid var(--border);
    z-index: 1000;
    background-color: var(--bg);
    color: var(--text);
    min-width: 100%;
}

.nav-item-group .nav-item-group:hover>.nav-subitems,
.nav-item-group .nav-item-group:focus-within>.nav-subitems,
.nav-item-group .nav-item-group.open>.nav-subitems {
    left: 100%;
    top: 0;
}

.nav-item {
    position: relative;
    list-style-type: none;
    margin: 0;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.nav-link {
    display: grid;
    grid-template-areas: "icon label";
    grid-template-columns: auto 1fr;
    gap: 1ch;
    align-items: center;
    padding: 0.5em 1em;
    text-decoration: none !important;
}

.nav-item-group>.nav-link {
    grid-template-areas: "icon label caret";
}

.nav-brand {
    display: grid;
    grid-template-areas: "icon label";
    grid-template-columns: auto 1fr;
    gap: 0.5em;
    align-items: center;
    padding: 0.5em 1em;
    text-decoration: none !important;
    font-weight: bold;
    font-size: 1.2em;
}

.nav-icon,
.nav-brand-icon {
    grid-area: icon;
    object-fit: cover;
    border-radius: 50%;
}

.nav-icon {
    height: 1em;
    width: 1em;
}

.nav-brand-icon {
    height: 2em;
    width: 2em;
}

.nav-item:hover,
.nav-item:focus,
.nav-item.active {
    background-color: var(--primary-10);
    color: var(--primary-90);
}

@media (max-width: 700px) {
    .btn-group {
        font-size: 0.9em;
    }

    .avatar {
        line-height: 2em;
    }

    .navbar {
        grid-template-areas: "hamburger brand";
        grid-template-columns: auto 1fr;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .navbar .nav-hamburger {
        grid-area: hamburger;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 2em;
        padding-left: 1ch;
        cursor: pointer;
    }

    .navbar .nav-hamburger.open i::before {
        content: "\f00d";
    }

    .navbar:has(.nav-hamburger:not(.open))::before {
        opacity: 0;
        pointer-events: none;
    }

    .navbar::before {
        transition: opacity 0.5s ease-in-out;
        content: "";
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        height: 100vh;
        backdrop-filter: blur(5px) brightness(0.5);
    }

    .navbar .nav-hamburger:not(.open)~.nav-actions,
    .navbar .nav-hamburger:not(.open)~.nav-list {
        transform: translateX(-1000%);
    }

    .navbar .nav-list {
        transition: transform 0.5s ease-in-out;
        position: absolute;
        top: 100%;
        left: 0;
        flex-direction: column;
        min-width: 50vw;
        width: max-content;
        max-width: 100vw;
        background-color: var(--bg);
        color: var(--text);
        box-shadow: rgba(0, 0, 0, 0.025) 0 6px 24px 0px, rgba(0, 0, 0, 0.028) 0 0 0 1px;
        border: 1px solid var(--border);
        height: 75vh;
        max-height: 75vh;
    }

    .nav-item-group {
        display: flex;
        flex-direction: column;
    }

    .nav-list>.nav-item-group:hover>.nav-subitems,
    .nav-list>.nav-item-group:focus-within>.nav-subitems,
    .nav-list>.nav-item-group.open>.nav-subitems {
        padding-left: 1em;
        position: unset;
    }

    .nav-link {
        width: 100%;
        padding: 1em 1.5em;
    }

    .navbar .nav-actions {
        transition: transform 0.5s ease-in-out;
        position: absolute;
        top: 75vh;
        left: 0;
        flex-direction: column;
        min-width: 50vw;
        width: max-content;
        max-width: 100vw;
        background-color: var(--bg);
        color: var(--text);
        box-shadow: rgba(0, 0, 0, 0.025) 0 6px 24px 0px, rgba(0, 0, 0, 0.028) 0 0 0 1px;
        border: 1px solid var(--border);
        height: 25vh;
        max-height: 25vh;
        justify-content: flex-end;
        align-items: center;
    }

    .nav-action-button {
        width: 100%;
        height: auto;
        padding: 2em 0;
    }
}

.table-wrapper {
    max-width: var(--target-width);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.5em;
}

.cards-grid>.card {
    margin: 0;
}