:root {
    color-scheme: light;
    --bg: #f5f7f8;
    --panel: #ffffff;
    --line: #d8e0e3;
    --text: #1e2a2e;
    --muted: #657277;
    --accent: #0f766e;
    --accent-dark: #0b5f59;
    --warn: #9a3412;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--accent-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    align-self: start;
    background: #ffffff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-height: 100vh;
    padding: 22px 18px;
    position: sticky;
    top: 0;
}

.sidebar-head,
.portal-head {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.brand {
    display: block;
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
    line-height: 0;
    text-align: center;
    width: 100%;
}

.menu-toggle {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    display: none;
    flex: 0 0 auto;
    gap: 4px;
    height: 42px;
    justify-content: center;
    min-height: 42px;
    padding: 0;
    width: 42px;
}

.menu-toggle span:not(.sr-only) {
    background: currentColor;
    border-radius: 999px;
    display: block;
    height: 2px;
    width: 20px;
}

.menu-toggle[aria-expanded="true"] span:not(.sr-only):nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:not(.sr-only):nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:not(.sr-only):nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.sr-only {
    clip: rect(0, 0, 0, 0);
    border: 0;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.brand img {
    display: block;
    height: auto;
    margin: 0 auto;
    max-width: 208px;
    width: 100%;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav a,
.nav summary {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.nav a {
    border-radius: 6px;
    display: block;
    padding: 8px 10px;
}

.nav a:hover {
    background: #eef3f3;
    color: var(--text);
    text-decoration: none;
}

.nav-home {
    color: var(--text);
}

.nav-group {
    border-top: 1px solid var(--line);
    padding-top: 8px;
}

.nav-group summary {
    cursor: pointer;
    list-style: none;
    padding: 8px 10px;
    position: relative;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group summary::after {
    content: "+";
    position: absolute;
    right: 10px;
}

.nav-group[open] summary::after {
    content: "-";
}

.nav-links {
    display: grid;
    gap: 2px;
    padding: 2px 0 8px 10px;
}

.nav-links a {
    font-size: 13px;
    font-weight: 500;
    padding-left: 14px;
}

.page {
    margin: 0;
    max-width: 1400px;
    padding: 28px;
    width: 100%;
}

.global-search {
    margin: 0 auto 22px;
    max-width: 720px;
    position: relative;
    width: min(100%, 720px);
    z-index: 20;
}

.global-search input {
    background: #ffffff;
    border-color: #c7d2d6;
    box-shadow: 0 8px 24px rgba(30, 42, 46, 0.08);
    min-height: 44px;
    padding: 10px 14px;
    width: 100%;
}

.global-search input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(15, 118, 110, 0.14);
}

.global-search-results {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(30, 42, 46, 0.16);
    left: 0;
    max-height: min(70vh, 560px);
    overflow: auto;
    padding: 6px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
}

.global-search-result,
.global-search-more,
.search-result-row {
    color: var(--text);
    display: grid;
    gap: 2px;
    min-width: 0;
    text-decoration: none;
}

.global-search-result {
    border-radius: 6px;
    padding: 10px 12px;
}

.global-search-result:hover,
.global-search-result:focus,
.search-result-row:hover,
.search-result-row:focus {
    background: #eef3f3;
    text-decoration: none;
}

.global-search-result span,
.search-result-type {
    color: var(--accent-dark);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.global-search-result strong,
.search-result-row strong {
    overflow-wrap: anywhere;
}

.global-search-result small,
.global-search-result em,
.search-result-row small,
.search-result-row span:not(.search-result-type) {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    overflow-wrap: anywhere;
}

.global-search-more,
.global-search-empty {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin-top: 4px;
    padding: 10px 12px;
}

.global-search-more:hover {
    color: var(--accent-dark);
    text-decoration: none;
}

.search-results-page {
    display: grid;
    gap: 10px;
}

.search-result-row {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
}

.page-head,
.section-head {
    align-items: flex-end;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    font-size: 32px;
    margin-bottom: 6px;
}

h2 {
    font-size: 20px;
    margin-bottom: 0;
}

.page-head p {
    color: var(--muted);
    margin-bottom: 0;
}

.metric-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 28px;
}

.metric {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.metric span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
}

.metric strong {
    font-size: 30px;
}

.metric-date {
    font-size: 22px;
}

.columns {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 30px;
}

.property-panels {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
    padding: 20px;
}

.panel .table-wrap {
    border: 0;
    border-radius: 0;
    margin: 0 -20px -20px;
}

.panel-wide {
    min-width: 0;
}

.hero-image {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    height: clamp(220px, 30vw, 360px);
    margin-bottom: 22px;
    overflow: hidden;
    position: relative;
}

.hero-image img {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.hero-image div {
    background: rgba(30, 42, 46, 0.78);
    bottom: 16px;
    color: #ffffff;
    display: grid;
    gap: 2px;
    left: 16px;
    max-width: calc(100% - 32px);
    padding: 10px 12px;
    position: absolute;
}

.hero-image span {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.image-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.image-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.image-card > a {
    background: #eef3f3;
    display: block;
    aspect-ratio: 4 / 3;
}

.image-card img {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.image-card-body {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.image-card-body > div:first-child {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.image-card-body p {
    color: var(--muted);
    font-size: 13px;
    margin: 0;
}

.image-card-body small {
    color: var(--muted);
    font-weight: 700;
}

.folder-section {
    margin-top: 16px;
}

.folder-section:first-of-type {
    margin-top: 0;
}

.folder-section summary {
    align-items: center;
    background: #f7faf9;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    list-style: none;
    margin-bottom: 10px;
    padding: 10px 12px;
    position: relative;
}

.folder-section summary::-webkit-details-marker {
    display: none;
}

.folder-section summary::before {
    content: "+";
    color: var(--accent-dark);
    font-weight: 700;
    margin-right: 2px;
}

.folder-section[open] summary::before {
    content: "-";
}

.folder-section summary span {
    font-size: 15px;
    font-weight: 700;
}

.folder-section summary small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.panel .folder-section .table-wrap {
    border: 1px solid var(--line);
    border-radius: 6px;
    margin: 0;
}

.folder-children {
    border-left: 2px solid var(--line);
    margin: 12px 0 0 12px;
    padding-left: 14px;
}

.document-section-head {
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.document-section-head h2 {
    font-size: 18px;
}

.document-section-head a {
    font-size: 13px;
    line-height: 1.2;
}

.document-folder {
    margin-top: 4px;
}

.document-folder summary {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    gap: 6px;
    margin-bottom: 3px;
    min-height: 26px;
    padding: 2px 4px;
}

.document-folder summary::before {
    font-size: 13px;
    margin-right: 0;
    width: 12px;
}

.document-folder summary span {
    font-size: 13px;
}

.document-folder summary small {
    font-size: 10.5px;
}

.document-folder-children {
    border-left-width: 1px;
    margin: 3px 0 0 9px;
    padding-left: 8px;
}

.panel .document-table-wrap {
    border: 0;
    border-radius: 0;
    margin: 0 0 4px 17px;
}

.document-table {
    min-width: 0;
    table-layout: fixed;
}

.document-table thead {
    display: none;
}

.document-table th,
.document-table td {
    padding: 4px 6px;
}

.document-table th {
    font-size: 11px;
}

.document-table td {
    font-size: 13px;
    vertical-align: middle;
}

.document-table.has-units th:nth-child(1),
.document-table.has-units td:nth-child(1) {
    width: 45%;
}

.document-table.has-units th:nth-child(2),
.document-table.has-units td:nth-child(2) {
    width: 20%;
}

.document-table.has-units th:nth-child(3),
.document-table.has-units td:nth-child(3) {
    width: 18%;
}

.document-table.has-units th:nth-child(4),
.document-table.has-units td:nth-child(4) {
    width: 17%;
}

.document-table.no-units th:nth-child(1),
.document-table.no-units td:nth-child(1) {
    width: 56%;
}

.document-table.no-units th:nth-child(2),
.document-table.no-units td:nth-child(2) {
    width: 22%;
}

.document-table.no-units th:nth-child(3),
.document-table.no-units td:nth-child(3) {
    width: 22%;
}

.document-table .actions {
    white-space: normal;
}

.document-table .actions a {
    display: block;
    line-height: 1.4;
}

.table-wrap {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow-x: auto;
}

.section-block {
    margin-top: 24px;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 14px 16px;
}

.timeline-item.internal {
    border-left-color: var(--warn);
}

.timeline-item-sub {
    margin-left: 28px;
    border-left-color: var(--accent-dark);
}

.contact-entry {
    border-top: 1px solid var(--line);
    margin-top: 14px;
    padding-top: 14px;
}

.timeline-meta {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.timeline-meta span,
.timeline-item small,
.recipient-preview {
    color: var(--muted);
    font-size: 13px;
}

.timeline-item p {
    margin-bottom: 0;
}

.recipient-preview {
    background: #f7faf9;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 12px 14px;
}

.recipient-preview ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

table {
    border-collapse: collapse;
    min-width: 820px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #eef3f3;
    color: #425057;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.money {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.status {
    background: #e5f3f1;
    border: 1px solid #b8deda;
    border-radius: 999px;
    color: var(--accent-dark);
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    white-space: nowrap;
}

.status-paid {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.status-open {
    background: #ffedd5;
    border-color: #fdba74;
    color: #9a3412;
}

.category-badge {
    background: var(--category-color, #657277);
    border: 1px solid var(--category-color, #657277);
    border-radius: 999px;
    color: #ffffff;
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    white-space: nowrap;
}

.search {
    display: flex;
    gap: 8px;
    min-width: 0;
}

.search select {
    flex: 0 1 190px;
}

input,
button {
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    min-height: 38px;
    max-width: 100%;
    padding: 8px 10px;
}

button {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
}

button:disabled {
    background: #d8e0e3;
    border-color: #d8e0e3;
    color: #657277;
    cursor: not-allowed;
}

.button {
    align-items: center;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: #ffffff;
    display: inline-flex;
    font-weight: 700;
    min-height: 38px;
    padding: 8px 12px;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover {
    color: #ffffff;
    text-decoration: none;
}

.secondary {
    background: #ffffff;
    border-color: var(--line);
    color: var(--text);
}

.secondary:hover {
    color: var(--text);
}

.danger,
.danger-button {
    color: var(--warn);
}

.danger-button {
    background: #fff7ed;
    border-color: #fed7aa;
}

.danger-button:hover {
    color: var(--warn);
}

.actions,
.action-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.action-row form {
    margin: 0;
}

.action-cluster {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.action-cluster-new {
    row-gap: 8px;
}

.action-menu-toggle {
    display: none;
}

.actions {
    white-space: nowrap;
}

td.actions {
    display: table-cell;
}

td.actions > * + * {
    margin-left: 10px;
}

.messages {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.message {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    color: #065f46;
    padding: 10px 12px;
}

.form-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
}

.form-panel.narrow {
    max-width: 680px;
}

.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.top-form-panel {
    max-width: 980px;
}

.top-form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

.field {
    align-content: start;
    display: grid;
    gap: 6px;
}

.full-width-field {
    grid-column: 1 / -1;
}

.form-section-heading {
    border-top: 1px solid var(--line);
    grid-column: 1 / -1;
    margin-top: 4px;
    padding-top: 14px;
}

.form-section-heading h2 {
    font-size: 16px;
}

.form-partei .field-anschrift,
.form-partei .field-kontoinhaber {
    grid-column: 1 / -1;
}

.form-partei .field-kontoinhaber,
.form-partei .field-iban,
.form-partei .field-bic {
    background: #f7faf9;
    border: 1px solid var(--line);
    padding: 12px;
}

.form-partei .field-kontoinhaber {
    border-radius: 8px 8px 0 0;
    border-bottom: 0;
}

.form-partei .field-iban {
    border-radius: 0 0 0 8px;
    border-right: 0;
}

.form-partei .field-bic {
    border-radius: 0 0 8px 0;
}

.field label {
    color: #425057;
    font-size: 13px;
    font-weight: 700;
}

.field textarea {
    min-height: 110px;
    resize: vertical;
}

.field-beschreibung textarea {
    min-height: 170px;
}

.ticket-update-text-field textarea {
    min-height: 180px;
}

.form-control {
    align-self: start;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    min-height: 38px;
    padding: 8px 10px;
    width: 100%;
}

select.form-control {
    height: 42px;
}

.multi-choice-field {
    align-content: start;
}

.multi-choice-field small {
    color: var(--muted);
    order: 2;
}

.checkbox-field {
    align-content: start;
    display: flex;
    gap: 10px;
    padding-top: 24px;
}

.checkbox-field label {
    order: 2;
}

.checkbox-input {
    height: 18px;
    margin-top: 1px;
    width: 18px;
}

.multi-choice-field > div,
.checkbox-list:not(input) {
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 2px;
    max-height: 320px;
    min-height: 180px;
    overflow: auto;
    padding: 6px;
}

.multi-choice-field > div > div,
.checkbox-list:not(input) > div {
    display: block;
}

.multi-choice-field > div label,
.checkbox-list:not(input) label {
    align-items: center;
    border-radius: 5px;
    display: flex;
    gap: 10px;
    font-weight: 400;
    line-height: 1.35;
    min-height: 38px;
    padding: 8px;
}

.multi-choice-field > div label:hover,
.checkbox-list:not(input) label:hover {
    background: #eef3f3;
}

.multi-choice-field input[type="checkbox"],
input.checkbox-list[type="checkbox"] {
    flex: 0 0 auto;
    height: 16px;
    margin: 0;
    min-height: 0;
    padding: 0;
    width: 16px;
}

.form-errors,
.field-error {
    color: var(--warn);
}

.form-errors {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 10px 12px;
}

.field-error {
    font-size: 13px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.batch-checklist {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.compact-actions {
    margin-top: 0;
}

.vote-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.vote-field {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0;
    padding: 12px;
}

.vote-field legend {
    color: var(--text);
    font-weight: 700;
    padding: 0 4px;
}

.vote-field ul {
    display: grid;
    gap: 6px;
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}

.vote-field label {
    align-items: center;
    display: flex;
    gap: 8px;
}

.vote-field input {
    min-height: 0;
    width: auto;
}

.filterbar {
    align-items: flex-end;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.filterbar label {
    color: #425057;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}

.filterbar select {
    min-width: 260px;
}

.danger-submit {
    background: var(--warn);
    border-color: var(--warn);
}

.secondary-submit {
    background: #ffffff;
    border-color: var(--line);
    color: var(--text);
}

.detail-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) 320px;
}

.detail-grid > div,
.detail-grid dl {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0;
    padding: 20px;
}

dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

dd {
    margin: 4px 0 16px;
}

.compact-dl {
    display: grid;
    gap: 10px 14px;
    grid-template-columns: 150px minmax(0, 1fr);
}

.compact-dl dt,
.compact-dl dd {
    margin: 0;
}

.panel-subheading {
    font-size: 14px;
    margin: 18px 0 10px;
}

.data-box {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #223136;
    min-height: 240px;
    overflow: auto;
    padding: 14px;
    white-space: pre-wrap;
}

.pagination {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
}

.portal-shell {
    min-height: 100vh;
}

.portal-topbar {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 22px;
    justify-content: space-between;
    padding: 14px 28px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.portal-head {
    flex: 0 0 auto;
}

.portal-brand img {
    display: block;
    max-width: 178px;
    width: 100%;
}

.portal-nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.portal-nav a {
    border-radius: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    padding: 8px 10px;
}

.portal-nav a:hover {
    background: #eef3f3;
    color: var(--text);
    text-decoration: none;
}

.portal-page {
    margin: 0 auto;
    max-width: 1180px;
    padding: 28px;
}

.login-page {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-panel {
    max-width: 440px;
    width: 100%;
}

.login-logo {
    margin-bottom: 20px;
    text-align: center;
}

.login-logo img {
    max-width: 260px;
    width: min(100%, 260px);
}

.compact-images {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

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

    .sidebar {
        gap: 12px;
        border-bottom: 1px solid var(--line);
        border-right: 0;
        min-height: auto;
        padding: 12px 18px;
        position: sticky;
        z-index: 10;
    }

    .sidebar-head {
        width: 100%;
    }

    .brand {
        text-align: left;
        width: auto;
    }

    .brand img {
        margin: 0;
        max-width: 150px;
    }

    .menu-toggle {
        display: inline-flex;
        flex-direction: column;
    }

    .nav,
    .portal-nav {
        display: none;
        width: 100%;
    }

    .nav.is-open,
    .portal-nav.is-open {
        display: grid;
    }

    .nav.is-open {
        border-top: 1px solid var(--line);
        grid-template-columns: 1fr;
        padding-top: 10px;
    }

    .page-head,
    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .metric-grid,
    .columns,
    .detail-grid,
    .property-panels,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-partei .field-iban {
        border-radius: 0;
        border-right: 1px solid var(--line);
        border-bottom: 0;
    }

    .form-partei .field-bic {
        border-radius: 0 0 8px 8px;
    }

    .page {
        padding: 18px;
        max-width: 100%;
    }

    .global-search {
        margin-bottom: 16px;
    }

    .portal-topbar {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 14px 18px;
        position: sticky;
    }

    .portal-head {
        width: 100%;
    }

    .portal-nav.is-open {
        border-top: 1px solid var(--line);
        gap: 4px;
        justify-content: flex-start;
        padding-top: 10px;
    }

    .portal-page {
        padding: 18px;
        max-width: 100%;
    }

    h1 {
        font-size: 26px;
    }
}

@media (max-width: 720px) {
    .page,
    .portal-page {
        padding: 14px;
    }

    .page-head,
    .section-head {
        gap: 10px;
        margin-bottom: 14px;
    }

    h1 {
        font-size: 24px;
        overflow-wrap: anywhere;
    }

    h2 {
        font-size: 18px;
    }

    .action-row,
    .actions,
    .form-actions,
    .search,
    .filterbar {
        align-items: stretch;
        width: 100%;
    }

    .search {
        flex-wrap: wrap;
    }

    .global-search-results {
        max-height: 72vh;
    }

    .search input {
        flex: 1 1 180px;
        min-width: 0;
    }

    .search button,
    .search .button,
    .action-row .button,
    .actions .button,
    .form-actions .button,
    .form-actions button {
        justify-content: center;
    }

    .button {
        white-space: normal;
    }

    .page-head .detail-actions.has-action-menu {
        align-items: flex-start;
        display: grid;
        gap: 8px;
        position: relative;
    }

    .page-head .detail-actions.has-action-menu .action-menu-toggle {
        align-items: center;
        display: inline-flex;
        justify-content: center;
        width: 100%;
    }

    .page-head .detail-actions.has-action-menu .action-menu-toggle::after {
        content: "v";
        font-size: 12px;
        margin-left: 8px;
    }

    .page-head .detail-actions.has-action-menu.is-open .action-menu-toggle::after {
        content: "^";
    }

    .page-head .detail-actions.has-action-menu .action-cluster {
        background: #ffffff;
        border: 1px solid var(--line);
        border-radius: 8px;
        box-shadow: 0 14px 30px rgba(30, 42, 46, 0.14);
        display: none;
        gap: 8px;
        padding: 8px;
        width: 100%;
    }

    .page-head .detail-actions.has-action-menu.is-open .action-cluster {
        display: grid;
    }

    .page-head .detail-actions.has-action-menu .action-cluster + .action-cluster {
        border-top: 0;
        margin-top: -8px;
    }

    .page-head .detail-actions.has-action-menu .action-cluster .button,
    .page-head .detail-actions.has-action-menu .action-cluster button,
    .page-head .detail-actions.has-action-menu .action-cluster form {
        width: 100%;
    }

    .page-head .action-cluster {
        justify-content: flex-start;
        width: 100%;
    }

    .page-head .action-cluster-new {
        align-items: stretch;
    }

    .panel,
    .form-panel,
    .detail-grid > div,
    .detail-grid dl {
        padding: 16px;
    }

    .panel .table-wrap {
        margin: 0 -16px -16px;
    }

    .metric-grid,
    .image-grid,
    .compact-images {
        grid-template-columns: 1fr;
    }

    .compact-dl {
        grid-template-columns: 1fr;
    }

    .compact-dl dt {
        margin-top: 8px;
    }

    .filterbar > div,
    .filterbar select,
    .filterbar button,
    .filterbar .button {
        width: 100%;
    }

    .table-wrap {
        background: transparent;
        border: 0;
        border-radius: 0;
        overflow-x: visible;
    }

    table {
        border-collapse: separate;
        border-spacing: 0;
        display: block;
        min-width: 0;
        width: 100%;
    }

    thead {
        display: none;
    }

    tbody {
        display: grid;
        gap: 12px;
        width: 100%;
    }

    tr {
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 8px;
        display: grid;
        overflow: hidden;
        width: 100%;
    }

    td,
    th {
        border-bottom: 1px solid var(--line);
        min-width: 0;
        padding: 10px 12px;
    }

    td {
        display: grid;
        gap: 4px;
        grid-template-columns: minmax(96px, 36%) minmax(0, 1fr);
        overflow-wrap: anywhere;
    }

    td::before {
        color: var(--muted);
        content: attr(data-label);
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
    }

    td:only-child,
    td[colspan] {
        display: block;
    }

    td:only-child::before,
    td[colspan]::before {
        content: none;
    }

    tbody tr:last-child td {
        border-bottom: 1px solid var(--line);
    }

    td:last-child {
        border-bottom: 0;
    }

    .money {
        text-align: left;
        white-space: normal;
    }

    td.actions,
    .document-table .actions {
        align-items: stretch;
        display: flex;
        flex-wrap: wrap;
        white-space: normal;
    }

    td.actions::before {
        flex: 0 0 100%;
    }

    .document-table {
        table-layout: auto;
    }

    .document-table.has-units th:nth-child(n),
    .document-table.has-units td:nth-child(n),
    .document-table.no-units th:nth-child(n),
    .document-table.no-units td:nth-child(n) {
        width: auto;
    }

    .panel .document-table-wrap {
        margin: 0;
    }

    .folder-children,
    .document-folder-children {
        margin-left: 0;
        padding-left: 10px;
    }

    .timeline-item-sub {
        margin-left: 12px;
    }

    .pagination {
        flex-direction: column;
        justify-content: center;
    }
}

@media (max-width: 420px) {
    .sidebar,
    .portal-topbar {
        padding-left: 12px;
        padding-right: 12px;
    }

    .brand img,
    .portal-brand img {
        max-width: 150px;
    }

    .page,
    .portal-page {
        padding: 12px;
    }

    td {
        grid-template-columns: 1fr;
    }

    .timeline-item-sub {
        margin-left: 0;
    }

    .hero-image {
        height: 210px;
    }
}
