:root {
    --primary-red: #cd1316;
    --primary-red-hover: #870d0e;
    --text-charcoal: #3c3c3b;
    --muted-text: #585857;
    --border-gray: #cacaca;
    --surface-gray: #eeeeee;
    --white: #ffffff;
    --secondary-blue: #12a3e5;
    --civic-blue: #005ca9;
    --focus: #ffd24a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f7f7f7;
    color: var(--text-charcoal);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

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

.js-only {
    display: none;
}

.js-enabled .js-only {
    display: inline-flex;
}

a {
    color: var(--primary-red);
}

a:focus,
button:focus,
input:focus,
select:focus {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.topbar {
    align-items: center;
    background: var(--white);
    border-bottom: 4px solid var(--primary-red);
    display: flex;
    gap: 1rem;
    min-height: 72px;
    padding: 0.75rem clamp(1rem, 3vw, 2.5rem);
}

.brand {
    align-items: center;
    color: var(--text-charcoal);
    display: inline-flex;
    font-size: 1.1rem;
    font-weight: 700;
    gap: 0.7rem;
    margin-right: auto;
    text-decoration: none;
}

.main-nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.main-nav a {
    align-items: center;
    color: var(--text-charcoal);
    display: inline-flex;
    font-weight: 700;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem;
    text-decoration: none;
}

.main-nav a:hover {
    background: var(--surface-gray);
}

.logout-form {
    margin: 0;
}

.city-logo {
    flex: 0 0 auto;
    display: block;
    height: clamp(2.4rem, 5vw, 3.3rem);
    max-width: 4.2rem;
    object-fit: contain;
}

.page-shell {
    margin: 0 auto;
    max-width: 1180px;
    padding: clamp(1rem, 3vw, 2.5rem);
}

.auth-panel {
    background: var(--white);
    border-top: 6px solid var(--primary-red);
    box-shadow: 0 12px 28px rgb(0 0 0 / 8%);
    margin: 4vh auto 0;
    max-width: 460px;
    padding: clamp(1.25rem, 4vw, 2rem);
}

.page-header {
    border-left: 8px solid var(--primary-red);
    margin-bottom: 1.5rem;
    padding-left: 1rem;
}

.page-header-actions {
    align-items: end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.page-header h1,
.auth-panel h1 {
    margin: 0.1rem 0 0.35rem;
}

.eyebrow {
    color: var(--civic-blue);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0;
    text-transform: uppercase;
}

.muted,
.form-note {
    color: var(--muted-text);
}

.form-note {
    font-size: 0.9rem;
    margin: -0.45rem 0 0.2rem;
}

.form-stack {
    display: grid;
    gap: 0.7rem;
    margin-top: 1.25rem;
}

.inline-form {
    align-items: end;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    margin: 1rem 0 1.25rem;
}

label {
    font-weight: 700;
}

input,
select {
    background: var(--white);
    border: 1px solid var(--border-gray);
    color: var(--text-charcoal);
    font: inherit;
    min-height: 2.75rem;
    padding: 0.55rem 0.7rem;
    width: 100%;
}

input:disabled {
    background: var(--surface-gray);
    color: var(--muted-text);
}

.button {
    align-items: center;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    gap: 0.45rem;
    justify-content: center;
    min-height: 2.65rem;
    padding: 0.55rem 0.85rem;
    text-decoration: none;
}

.icon {
    display: inline-block;
    fill: none;
    flex: 0 0 auto;
    height: 1.05rem;
    stroke: currentcolor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 1.05rem;
}

.button-icon {
    aspect-ratio: 1;
    min-width: 2.65rem;
    padding: 0;
}

.button-icon.button-small {
    min-height: 2.15rem;
    min-width: 2.15rem;
}

.button-icon .icon {
    height: 1rem;
    width: 1rem;
}

.button:disabled {
    background: var(--border-gray);
    color: var(--muted-text);
    cursor: not-allowed;
}

.button-disabled,
.button[aria-disabled="true"] {
    background: var(--border-gray);
    color: var(--muted-text);
    cursor: not-allowed;
    pointer-events: none;
}

.button-primary {
    background: var(--primary-red);
    color: var(--white);
}

.button-primary:hover {
    background: var(--primary-red-hover);
}

.button-secondary {
    background: var(--civic-blue);
    color: var(--white);
}

.button-ghost {
    background: transparent;
    border: 1px solid var(--border-gray);
    color: var(--text-charcoal);
}

.button-small {
    min-height: 2.1rem;
    padding: 0.35rem 0.7rem;
}

.button-small.button-icon {
    padding: 0;
}

.button-small:not(.button-secondary):not(.button-ghost):not(.button-danger) {
    background: var(--primary-red);
    color: var(--white);
}

.button-danger {
    background: var(--primary-red-hover);
    color: var(--white);
}

.text-link {
    align-items: center;
    display: inline-flex;
    gap: 0.4rem;
    font-weight: 700;
    margin-top: 1rem;
}

.alert {
    border-left: 6px solid;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
}

.alert ul {
    margin-bottom: 0;
}

.alert-success {
    background: #e9f7ef;
    border-color: #16834f;
}

.alert-error {
    background: #fff1f1;
    border-color: var(--primary-red);
}

.copy-link-panel {
    display: grid;
    gap: 0.75rem;
}

.copy-link-panel p {
    margin: 0.15rem 0 0;
}

.copy-link-row {
    align-items: center;
    display: grid;
    gap: 0.65rem;
    grid-template-columns: minmax(0, 1fr) auto;
}

.copy-status {
    font-weight: 700;
}

.panel {
    background: var(--white);
    border: 1px solid var(--border-gray);
    padding: clamp(1rem, 2vw, 1.5rem);
}

.panel-spaced {
    margin-top: 1rem;
}

.panel h2 {
    margin-top: 0;
}

.panel-subsection {
    border-top: 1px solid var(--border-gray);
    margin-top: 1rem;
    padding-top: 1rem;
}

.panel-subsection h4 {
    margin: 0 0 0.35rem;
}

.content-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}

.vehicle-masterdata-layout {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

.vehicle-create-panel {
    max-width: 34rem;
}

.field-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.form-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.autosave-status {
    color: var(--muted-text);
    font-size: 0.9rem;
    font-weight: 700;
}

.autosave-status-saving {
    color: var(--civic-blue);
}

.autosave-status-saved {
    color: #146c43;
}

.autosave-status-error {
    color: var(--primary-red-hover);
}

.table-save-status {
    min-width: 6.5rem;
}

.checkbox-panel {
    border: 1px solid var(--border-gray);
    margin: 0;
    padding: 0.85rem;
}

.checkbox-panel legend {
    font-weight: 700;
    padding: 0 0.35rem;
}

.checkbox-grid {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    margin-top: 0.6rem;
}

.checkbox-item {
    align-items: center;
    border: 1px solid var(--border-gray);
    display: flex;
    gap: 0.55rem;
    min-height: 2.7rem;
    padding: 0.45rem 0.6rem;
}

.checkbox-item input {
    min-height: 1.1rem;
    width: auto;
}

.filter-form {
    align-items: end;
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
}

.filter-actions,
.table-actions,
.pagination {
    align-items: center;
    display: flex;
    gap: 0.55rem;
}

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

.table-actions {
    align-items: stretch;
    flex-wrap: wrap;
}

.table-actions .button,
.table-actions form {
    max-width: 100%;
    width: max-content;
}

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

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag-list span {
    background: var(--surface-gray);
    border-left: 3px solid var(--civic-blue);
    display: inline-block;
    font-size: 0.85rem;
    padding: 0.15rem 0.45rem;
}

.inline-delete-form {
    margin: 0;
}

.result-summary {
    align-items: baseline;
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.monthly-actions {
    justify-content: flex-end;
}

.monthly-report-heading {
    flex-wrap: wrap;
}

.monthly-table th:nth-child(1) {
    width: 17%;
}

.monthly-table th:nth-child(2) {
    width: 24%;
}

.monthly-table th:nth-child(3) {
    width: 24%;
}

.monthly-table th:nth-child(4),
.monthly-table th:nth-child(5),
.monthly-table td:nth-child(4),
.monthly-table td:nth-child(5) {
    text-align: right;
}

.monthly-table th:nth-child(4) {
    width: 16%;
}

.monthly-table th:nth-child(5) {
    width: 19%;
}

.monthly-total {
    align-items: center;
    border-top: 2px solid var(--primary-red);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.9rem;
}

.monthly-total strong {
    font-size: 1.25rem;
}

.empty-state {
    border-left: 6px solid var(--civic-blue);
}

.kpi-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    margin: 1rem 0;
}

.kpi-card {
    background: var(--white);
    border: 1px solid var(--border-gray);
    border-top: 5px solid var(--primary-red);
    color: var(--text-charcoal);
    display: grid;
    gap: 0.35rem;
    min-height: 9.5rem;
    padding: 1rem;
    text-decoration: none;
}

.kpi-card:hover {
    border-top-color: var(--primary-red-hover);
    box-shadow: 0 8px 18px rgb(0 0 0 / 8%);
}

.kpi-card span,
.kpi-card em {
    color: var(--muted-text);
}

.kpi-card span {
    font-weight: 700;
}

.kpi-card strong {
    color: var(--text-charcoal);
    font-size: clamp(1.55rem, 3vw, 2.15rem);
    line-height: 1.1;
}

.kpi-card em {
    font-size: 0.9rem;
    font-style: normal;
}

.dashboard-section {
    margin-top: 1.5rem;
}

.dashboard-section-header {
    align-items: flex-start;
    border-left: 6px solid var(--civic-blue);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-left: 0.85rem;
}

.dashboard-section-header > div {
    min-width: 0;
}

.dashboard-section-header h2 {
    font-size: clamp(1.35rem, 2.4vw, 1.8rem);
    margin: 0.1rem 0 0.2rem;
}

.dashboard-section-header p {
    margin-bottom: 0;
}

.dashboard-section-toggle {
    flex: 0 0 auto;
    margin-top: 0.1rem;
}

.dashboard-section-toggle .icon {
    transition: transform 0.15s ease;
}

.dashboard-section.is-collapsed .dashboard-section-header {
    margin-bottom: 0;
}

.dashboard-section.is-collapsed .dashboard-section-toggle .icon {
    transform: rotate(180deg);
}

.dashboard-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    margin-top: 1rem;
}

.dashboard-grid-primary {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}

.dashboard-chart h2 {
    font-size: 1.1rem;
}

.echart-container {
    height: clamp(18rem, 42vw, 24rem);
    min-height: 18rem;
    width: 100%;
}

.echart-container-clickable {
    cursor: pointer;
}

.chart-fallback {
    border-top: 1px solid var(--border-gray);
    margin-top: 0.85rem;
    padding-top: 0.65rem;
}

.chart-fallback summary {
    color: var(--muted-text);
    cursor: pointer;
    font-weight: 700;
}

.chart-fallback[open] summary {
    margin-bottom: 0.75rem;
}

.chart-list {
    display: grid;
    gap: 0.75rem;
}

.chart-row {
    align-items: center;
    display: grid;
    gap: 0.65rem;
    grid-template-columns: minmax(7.5rem, 0.8fr) minmax(8rem, 1.4fr) minmax(5.5rem, auto);
}

.chart-label {
    color: var(--text-charcoal);
    font-weight: 700;
    text-decoration: none;
}

a.chart-label:hover {
    color: var(--primary-red);
    text-decoration: underline;
}

.chart-track {
    background: var(--surface-gray);
    border: 1px solid var(--border-gray);
    height: 0.9rem;
    overflow: hidden;
}

.chart-track span {
    background: var(--primary-red);
    display: block;
    height: 100%;
}

.chart-value {
    color: var(--muted-text);
    font-weight: 700;
    text-align: right;
}

.pagination {
    justify-content: flex-end;
    margin-top: 1rem;
}

.participant-picker {
    border-top: 1px solid var(--border-gray);
    display: grid;
    gap: 1.3rem;
    margin-top: 1.4rem;
    padding-top: 1.2rem;
}

.picker-section {
    display: grid;
    gap: 0.75rem;
}

.picker-section h3 {
    font-size: 1.1rem;
    margin: 0.1rem 0 0;
}

.choice-grid,
.member-button-grid {
    display: grid;
    gap: 0.75rem;
}

.choice-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.vehicle-choice-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.position-choice-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
}

.choice-card {
    display: block;
    position: relative;
}

.choice-card input {
    height: 1px;
    opacity: 0;
    position: absolute;
    width: 1px;
}

.choice-card-body,
.choice-button,
.member-button {
    background: var(--white);
    border: 2px solid var(--border-gray);
    color: var(--text-charcoal);
    min-height: 4.6rem;
    padding: 0.85rem;
}

.choice-card-body,
.choice-button {
    cursor: pointer;
    display: grid;
    gap: 0.25rem;
    height: 100%;
}

.choice-card-body strong,
.choice-button strong,
.member-button strong {
    font-size: 1.05rem;
    line-height: 1.2;
}

.choice-card-body small,
.choice-button small,
.member-button span,
.member-button em {
    color: var(--muted-text);
    font-size: 0.9rem;
}

.choice-button {
    font: inherit;
    text-align: left;
}

.choice-button:hover {
    border-color: var(--primary-red);
}

.choice-button:focus {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.choice-card input:checked + .choice-card-body {
    background: #fff1f1;
    border-color: var(--primary-red);
    box-shadow: inset 0 0 0 1px var(--primary-red);
}

.participant-button-group {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.participant-toggle {
    background: var(--surface-gray);
    border: 2px solid var(--border-gray);
    border-radius: 6px;
    color: var(--text-charcoal);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    min-height: 2.3rem;
    min-width: 2.6rem;
    padding: 0.45rem 0.62rem;
}

.participant-toggle:hover {
    border-color: var(--primary-red);
    background: var(--white);
}

.participant-toggle:focus {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.participant-toggle-active {
    background: var(--primary-red);
    border-color: var(--primary-red);
    box-shadow: inset 0 0 0 2px var(--white), 0 0 0 1px var(--primary-red);
    color: var(--white);
}

.participant-toggle-active:hover {
    background: var(--primary-red);
    border-color: var(--primary-red);
    color: var(--white);
}

.position-toggle-group .participant-toggle-active {
    background: var(--primary-red);
    border-color: var(--primary-red);
}

.participant-toggle[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.5;
}

.vehicle-toggle-group .participant-toggle {
    min-width: 3.85rem;
}

.position-toggle-group .participant-toggle {
    min-width: 2.6rem;
}

.dialog-toggle-group {
    margin: 0.75rem 0;
}

.choice-card input:focus + .choice-card-body {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.member-button-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
}

.member-button {
    cursor: pointer;
    display: grid;
    gap: 0.35rem;
    text-align: left;
    width: 100%;
}

.member-button-heading {
    align-items: center;
    display: flex;
    gap: 0.45rem;
    min-width: 0;
}

.member-button-heading strong {
    overflow-wrap: anywhere;
}

.member-button:not(:disabled):hover {
    border-color: var(--primary-red);
}

.member-button:focus {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.member-button:disabled {
    background: var(--surface-gray);
    color: var(--muted-text);
    cursor: not-allowed;
}

.member-button-added {
    border-style: dashed;
}

.member-more {
    border-top: 1px solid var(--border-gray);
    margin-top: 0.85rem;
    padding-top: 0.85rem;
}

.member-more summary {
    color: var(--primary-red);
    cursor: pointer;
    font-weight: 700;
    margin-bottom: 0.85rem;
}

.selection-dialog {
    border: 0;
    max-width: min(92vw, 760px);
    padding: 0;
    width: 100%;
}

.divera-import-dialog {
    max-width: min(96vw, 980px);
}

.selection-dialog::backdrop {
    background: rgb(0 0 0 / 45%);
}

.dialog-panel {
    background: var(--white);
    border-top: 6px solid var(--primary-red);
    box-shadow: 0 18px 40px rgb(0 0 0 / 22%);
    display: grid;
    gap: 1rem;
    padding: clamp(1rem, 3vw, 1.5rem);
}

.dialog-header {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.dialog-header h3 {
    margin: 0.1rem 0 0.25rem;
}

.divera-source-section h4 {
    margin: 0 0 0.5rem;
}

.divera-source-list {
    display: grid;
    gap: 0.45rem;
}

.divera-source-item {
    align-items: flex-start;
    border: 1px solid var(--border-gray);
    cursor: pointer;
    display: grid;
    gap: 0.65rem;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 0.65rem 0.75rem;
}

.divera-source-item:has(input:checked) {
    border-color: var(--primary-red);
    box-shadow: inset 4px 0 0 var(--primary-red);
}

.divera-source-item input {
    margin-top: 0.2rem;
}

.divera-source-content {
    display: grid;
    gap: 0.2rem;
}

.divera-source-content span {
    color: var(--muted-text);
}

.divera-preview-section h4 {
    margin: 0.1rem 0 0.75rem;
}

.divera-preview-table th:nth-child(1),
.divera-preview-table td:nth-child(1) {
    width: 34%;
}

.divera-preview-table th:nth-child(2),
.divera-preview-table td:nth-child(2) {
    width: 24%;
}

.divera-preview-table th:nth-child(3),
.divera-preview-table td:nth-child(3) {
    width: 42%;
}

.divera-preview-table select {
    min-width: 0;
    width: 100%;
}

.summary-list {
    display: grid;
    gap: 0.8rem;
    margin: 1rem 0;
}

.summary-list div {
    border-bottom: 1px solid var(--border-gray);
    display: flex;
    justify-content: space-between;
    padding-bottom: 0.55rem;
}

.summary-list dt {
    color: var(--muted-text);
    font-weight: 700;
}

.summary-list dd {
    font-weight: 700;
    margin: 0;
}

.table-wrap {
    max-width: 100%;
    overflow-x: visible;
}

.table-spaced {
    margin-top: 1rem;
}

table {
    border-collapse: collapse;
    min-width: 0;
    table-layout: fixed;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--border-gray);
    overflow-wrap: anywhere;
    padding: 0.62rem;
    text-align: left;
    vertical-align: middle;
    word-break: normal;
}

th {
    background: var(--surface-gray);
}

td input {
    max-width: 100%;
    min-width: 0;
}

td select {
    max-width: 100%;
    min-width: 0;
}

.vehicles-table th:nth-child(1),
.vehicles-table td:nth-child(1) {
    width: 20%;
}

.vehicles-table th:nth-child(2),
.vehicles-table td:nth-child(2) {
    width: 34%;
}

.vehicles-table th:nth-child(3),
.vehicles-table td:nth-child(3) {
    width: 10%;
}

.vehicles-table th:nth-child(4),
.vehicles-table td:nth-child(4) {
    width: 12%;
}

.vehicles-table th:nth-child(5),
.vehicles-table td:nth-child(5) {
    width: 14%;
}

.vehicles-table th:nth-child(6),
.vehicles-table td:nth-child(6) {
    width: 10%;
}

.vehicle-row-form {
    margin: 0;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) {
    width: 14%;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
    width: 12%;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
    width: 10%;
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
    width: 18%;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
    width: 14%;
}

.users-table th:nth-child(6),
.users-table td:nth-child(6) {
    width: 11%;
}

.users-table th:nth-child(7),
.users-table td:nth-child(7) {
    width: 8%;
}

.users-table th:nth-child(8),
.users-table td:nth-child(8) {
    width: 13%;
}

.fahrgeldlisten-table th:nth-child(1),
.fahrgeldlisten-table td:nth-child(1) {
    width: 14%;
}

.fahrgeldlisten-table th:nth-child(2),
.fahrgeldlisten-table td:nth-child(2) {
    width: 11%;
}

.fahrgeldlisten-table th:nth-child(3),
.fahrgeldlisten-table td:nth-child(3) {
    width: 16%;
}

.fahrgeldlisten-table th:nth-child(4),
.fahrgeldlisten-table td:nth-child(4) {
    width: 24%;
}

.fahrgeldlisten-table th:nth-child(5),
.fahrgeldlisten-table td:nth-child(5) {
    width: 9%;
}

.fahrgeldlisten-table th:nth-child(6),
.fahrgeldlisten-table td:nth-child(6) {
    width: 14%;
}

.fahrgeldlisten-table th:nth-child(7),
.fahrgeldlisten-table td:nth-child(7) {
    width: 12%;
}

.participants-table th:nth-child(1),
.participants-table td:nth-child(1) {
    width: 22%;
}

.participants-table th:nth-child(2),
.participants-table td:nth-child(2) {
    width: 24%;
}

.participants-table th:nth-child(3),
.participants-table td:nth-child(3) {
    width: 38%;
}

.participants-table th:nth-child(4),
.participants-table td:nth-child(4) {
    width: 16%;
}

.dashboard-results-table th:nth-child(1),
.dashboard-results-table td:nth-child(1) {
    width: 12%;
}

.dashboard-results-table th:nth-child(2),
.dashboard-results-table td:nth-child(2) {
    width: 8%;
}

.dashboard-results-table th:nth-child(3),
.dashboard-results-table td:nth-child(3) {
    width: 7%;
}

.dashboard-results-table th:nth-child(4),
.dashboard-results-table td:nth-child(4) {
    width: 13%;
}

.dashboard-results-table th:nth-child(5),
.dashboard-results-table td:nth-child(5) {
    width: 13%;
}

.dashboard-results-table th:nth-child(6),
.dashboard-results-table td:nth-child(6) {
    width: 17%;
}

.dashboard-results-table th:nth-child(7),
.dashboard-results-table td:nth-child(7) {
    width: 8%;
}

.dashboard-results-table th:nth-child(8),
.dashboard-results-table td:nth-child(8) {
    width: 12%;
}

.dashboard-results-table th:nth-child(9),
.dashboard-results-table td:nth-child(9) {
    width: 10%;
}

.loeschgruppen-table th:nth-child(1),
.loeschgruppen-table td:nth-child(1) {
    width: 12%;
}

.loeschgruppen-table th:nth-child(2),
.loeschgruppen-table td:nth-child(2) {
    width: 24%;
}

.loeschgruppen-table th:nth-child(3),
.loeschgruppen-table td:nth-child(3) {
    width: 14%;
}

.loeschgruppen-table th:nth-child(4),
.loeschgruppen-table td:nth-child(4) {
    width: 18%;
}

.loeschgruppen-table th:nth-child(5),
.loeschgruppen-table td:nth-child(5) {
    width: 12%;
}

.loeschgruppen-table th:nth-child(6),
.loeschgruppen-table td:nth-child(6) {
    width: 20%;
}

.status-pill {
    background: var(--surface-gray);
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
}

.status-pill-active {
    background: #e9f7ef;
    color: #146c43;
}

.status-pill-inactive {
    background: #fff1f1;
    color: var(--primary-red-hover);
}

.print-body {
    background: var(--white);
}

.print-page {
    background: var(--white);
    color: var(--text-charcoal);
    font-size: 0.86rem;
    line-height: 1.28;
    margin: 0 auto;
    max-width: 210mm;
    min-height: 297mm;
    padding: 10mm;
}

.print-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.print-header {
    border-bottom: 2px solid var(--primary-red);
    margin-bottom: 0.45rem;
    padding-bottom: 0.25rem;
}

.print-header h1 {
    font-size: 1.35rem;
    line-height: 1.1;
    margin: 0.05rem 0 0;
}

.print-subtitle {
    color: var(--muted-text);
    font-weight: 700;
    margin: 0.1rem 0 0;
}

.print-header .eyebrow {
    font-size: 0.68rem;
}

.print-group-details {
    display: grid;
    font-size: 0.68rem;
    gap: 0.1rem;
    line-height: 1.2;
    margin-bottom: 0.45rem;
    width: 100%;
}

.print-meta {
    display: grid;
    gap: 0.18rem 0.75rem;
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 0.65rem;
}

.print-table {
    min-width: 0;
}

.print-table th:nth-child(1),
.print-table td:nth-child(1) {
    width: 34%;
}

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

.print-table th:nth-child(3),
.print-table td:nth-child(3) {
    width: 14%;
}

.print-table th:nth-child(4),
.print-table td:nth-child(4) {
    width: 30%;
}

.print-table th,
.print-table td {
    border: 1px solid var(--border-gray);
    font-size: 0.78rem;
    line-height: 1.15;
    padding: 0.22rem 0.35rem;
}

.participant-signature-cell {
    min-width: 6.2rem;
}

.participant-signature-cell span {
    border-bottom: 1px solid var(--text-charcoal);
    display: block;
    height: 0.9rem;
}

.hand-row td {
    height: 1.35rem;
}

.hand-row .participant-signature-cell span {
    height: 1rem;
}

.print-summary {
    border-top: 2px solid var(--text-charcoal);
    display: grid;
    font-size: 0.82rem;
    gap: 0.35rem 0.75rem;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 0.65rem;
    padding-top: 0.45rem;
}

.signature-grid {
    display: grid;
    font-size: 0.82rem;
    gap: 1.4rem;
    grid-template-columns: repeat(2, 1fr);
    margin-top: 1rem;
}

.signature-box {
    padding-top: 37mm;
    position: relative;
}

.signature-line-wrap {
    height: 1.65rem;
    margin-bottom: 0.25rem;
    position: relative;
}

.signature-line {
    border-bottom: 1px solid var(--text-charcoal);
    display: block;
    height: 1.65rem;
    margin-bottom: 0.25rem;
}

.signature-line-wrap .signature-line {
    height: 100%;
    margin-bottom: 0;
    position: relative;
    z-index: 1;
}

.signature-stamp {
    bottom: -2mm;
    left: 50%;
    max-width: 100%;
    pointer-events: none;
    position: absolute;
    transform: translateX(-50%);
    width: 48.75mm;
}

.signature-stamp img {
    display: block;
    height: auto;
    width: 100%;
}

.signature-stamp-date {
    color: var(--text-charcoal);
    font-size: 8.25pt;
    font-weight: 700;
    left: 3mm;
    letter-spacing: 0;
    line-height: 1;
    position: absolute;
    top: 30.75mm;
}

@media (max-width: 760px) {
    .topbar {
        align-items: stretch;
        flex-direction: column;
        gap: 0.65rem;
    }

    .brand {
        margin-right: 0;
    }

    .main-nav {
        width: 100%;
    }

    .main-nav a,
    .logout-form .button {
        justify-content: center;
        text-align: center;
    }

    .main-nav a {
        padding: 0.45rem 0.55rem;
    }

    .logout-form {
        align-self: flex-end;
    }

    .logout-form .button {
        width: auto;
    }

    .button {
        font-size: 0.95rem;
        gap: 0.35rem;
        min-height: 2.35rem;
        padding: 0.42rem 0.62rem;
    }

    .button-icon {
        min-height: 2.35rem;
        min-width: 2.35rem;
        padding: 0;
    }

    .button-small {
        min-height: 2rem;
        padding: 0.3rem 0.55rem;
    }

    .button-small.button-icon {
        min-height: 2rem;
        min-width: 2rem;
        padding: 0;
    }

    .button .icon {
        height: 0.95rem;
        width: 0.95rem;
    }

    .page-header-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .copy-link-row,
    .chart-row {
        align-items: stretch;
        flex-direction: column;
        grid-template-columns: 1fr;
    }

    .filter-actions,
    .pagination,
    .table-actions,
    .form-actions {
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.45rem;
        justify-content: flex-start;
    }

    .filter-actions .button,
    .pagination .button,
    .table-actions .button,
    .table-actions form,
    .form-actions .button {
        width: auto;
    }

    .table-actions {
        align-items: center;
    }

    .table-actions form {
        display: inline-flex;
    }

    .users-table td > .button,
    .fahrgeldlisten-table td > .button,
    .participants-table td > .button,
    .loeschgruppen-table td > .button,
    .vehicles-table td > .button,
    .dashboard-results-table td > .button {
        justify-self: start;
        width: auto;
    }

    .copy-link-row .button {
        justify-self: start;
    }

    .dashboard-section-header {
        gap: 0.65rem;
    }

    .kpi-card {
        min-height: 7.5rem;
        padding: 0.85rem;
    }

    .choice-grid,
    .member-button-grid {
        gap: 0.55rem;
    }

    .choice-card-body,
    .choice-button,
    .member-button {
        min-height: 3.75rem;
        padding: 0.65rem;
    }

    .choice-card-body strong,
    .choice-button strong,
    .member-button strong {
        font-size: 0.98rem;
    }

    .choice-card-body small,
    .choice-button small,
    .member-button span,
    .member-button em {
        font-size: 0.84rem;
    }

    .participant-button-group {
        gap: 0.32rem;
    }

    .participant-toggle {
        font-size: 0.84rem;
        min-height: 2.05rem;
        min-width: 2.35rem;
        padding: 0.38rem 0.48rem;
    }

    .chart-value {
        text-align: left;
    }

    .echart-container {
        height: 18rem;
    }

    .print-meta,
    .signature-grid {
        grid-template-columns: 1fr;
    }

    .users-table,
    .users-table thead,
    .users-table tbody,
    .users-table tr,
    .users-table td,
    .fahrgeldlisten-table,
    .fahrgeldlisten-table thead,
    .fahrgeldlisten-table tbody,
    .fahrgeldlisten-table tr,
    .fahrgeldlisten-table td,
    .participants-table,
    .participants-table thead,
    .participants-table tbody,
    .participants-table tr,
    .participants-table td,
    .loeschgruppen-table,
    .loeschgruppen-table thead,
    .loeschgruppen-table tbody,
    .loeschgruppen-table tr,
    .loeschgruppen-table td,
    .vehicles-table,
    .vehicles-table thead,
    .vehicles-table tbody,
    .vehicles-table tr,
    .vehicles-table td,
    .dashboard-results-table,
    .dashboard-results-table thead,
    .dashboard-results-table tbody,
    .dashboard-results-table tr,
    .dashboard-results-table td {
        display: block;
        width: 100%;
    }

    .users-table thead,
    .fahrgeldlisten-table thead,
    .participants-table thead,
    .loeschgruppen-table thead,
    .vehicles-table thead,
    .dashboard-results-table thead {
        display: none;
    }

    .users-table tr,
    .fahrgeldlisten-table tr,
    .participants-table tr,
    .loeschgruppen-table tr,
    .vehicles-table tr,
    .dashboard-results-table tr {
        border: 1px solid var(--border-gray);
        margin-bottom: 0.8rem;
    }

    .users-table td,
    .fahrgeldlisten-table td,
    .participants-table td,
    .loeschgruppen-table td,
    .vehicles-table td,
    .dashboard-results-table td {
        display: grid;
        gap: 0.75rem;
        grid-template-columns: minmax(7.5rem, 38%) minmax(0, 1fr);
        width: 100% !important;
    }

    .users-table td::before,
    .fahrgeldlisten-table td::before,
    .participants-table td::before,
    .loeschgruppen-table td::before,
    .vehicles-table td::before,
    .dashboard-results-table td::before {
        color: var(--muted-text);
        content: "";
        font-weight: 700;
    }

    .users-table td:nth-child(1)::before {
        content: "Name";
    }

    .users-table td:nth-child(2)::before {
        content: "Benutzername";
    }

    .users-table td:nth-child(3)::before {
        content: "Stammrollennummer";
    }

    .users-table td:nth-child(4)::before {
        content: "E-Mail-Adresse";
    }

    .users-table td:nth-child(5)::before {
        content: "Löschgruppen";
    }

    .users-table td:nth-child(6)::before {
        content: "Rolle";
    }

    .users-table td:nth-child(7)::before {
        content: "Status";
    }

    .users-table td:nth-child(8)::before {
        content: "Aktionen";
    }

    .fahrgeldlisten-table td:nth-child(1)::before,
    .dashboard-results-table td:nth-child(1)::before {
        content: "Einsatznummer";
    }

    .fahrgeldlisten-table td:nth-child(2)::before,
    .dashboard-results-table td:nth-child(2)::before {
        content: "Datum";
    }

    .dashboard-results-table td:nth-child(3)::before {
        content: "Uhrzeit";
    }

    .fahrgeldlisten-table td:nth-child(3)::before {
        content: "Einsatzort";
    }

    .fahrgeldlisten-table td:nth-child(4)::before {
        content: "Stichwort / Thema";
    }

    .fahrgeldlisten-table td:nth-child(5)::before {
        content: "Teilnehmer";
    }

    .fahrgeldlisten-table td:nth-child(6)::before {
        content: "Löschgruppe";
    }

    .fahrgeldlisten-table td:nth-child(7)::before,
    .dashboard-results-table td:nth-child(9)::before {
        content: "Aktion";
    }

    .participants-table td:nth-child(1)::before {
        content: "Name";
    }

    .participants-table td:nth-child(2)::before {
        content: "Fahrzeug";
    }

    .participants-table td:nth-child(3)::before {
        content: "Funktion";
    }

    .participants-table td:nth-child(4)::before {
        content: "Aktion";
    }

    .loeschgruppen-table td:nth-child(1)::before {
        content: "Sortierung";
    }

    .loeschgruppen-table td:nth-child(2)::before {
        content: "Anzeigename";
    }

    .loeschgruppen-table td:nth-child(3)::before {
        content: "Kurzname";
    }

    .loeschgruppen-table td:nth-child(4)::before {
        content: "Technischer Schlüssel";
    }

    .loeschgruppen-table td:nth-child(5)::before {
        content: "Verknüpfungen";
    }

    .loeschgruppen-table td:nth-child(6)::before {
        content: "Aktionen";
    }

    .vehicles-table td:nth-child(1)::before {
        content: "Löschgruppe";
    }

    .vehicles-table td:nth-child(2)::before {
        content: "Name";
    }

    .vehicles-table td:nth-child(3)::before {
        content: "Kurz";
    }

    .vehicles-table td:nth-child(4)::before {
        content: "Sortierung";
    }

    .vehicles-table td:nth-child(5)::before {
        content: "Status";
    }

    .vehicles-table td:nth-child(6)::before {
        content: "Aktion";
    }

    .dashboard-results-table td:nth-child(4)::before {
        content: "Löschgruppe";
    }

    .dashboard-results-table td:nth-child(5)::before {
        content: "Einsatzort";
    }

    .dashboard-results-table td:nth-child(6)::before {
        content: "Stichwort / Thema";
    }

    .dashboard-results-table td:nth-child(7)::before {
        content: "Teilnehmer";
    }

    .dashboard-results-table td:nth-child(8)::before {
        content: "Fahrgeldsumme";
    }

    .users-table td[colspan],
    .fahrgeldlisten-table td[colspan],
    .participants-table td[colspan],
    .loeschgruppen-table td[colspan],
    .vehicles-table td[colspan],
    .dashboard-results-table td[colspan] {
        display: block;
    }

    .users-table td[colspan]::before,
    .fahrgeldlisten-table td[colspan]::before,
    .participants-table td[colspan]::before,
    .loeschgruppen-table td[colspan]::before,
    .vehicles-table td[colspan]::before,
    .dashboard-results-table td[colspan]::before {
        content: none;
    }
}

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

    body {
        background: var(--white);
    }

    .no-print {
        display: none;
    }

    .print-page {
        font-size: 0.8rem;
        max-width: none;
        min-height: 0;
        padding: 0;
    }

    .print-header {
        margin-bottom: 0.35rem;
        padding-bottom: 0.18rem;
    }

    .print-header h1 {
        font-size: 1.15rem;
    }

    .print-group-details {
        font-size: 0.62rem;
        margin-bottom: 0.35rem;
    }

    .print-meta {
        grid-template-columns: repeat(3, 1fr);
        margin-bottom: 0.5rem;
    }

    .print-table th,
    .print-table td {
        font-size: 0.72rem;
        padding: 0.16rem 0.28rem;
    }

    .participant-signature-cell span {
        height: 0.72rem;
    }

    .hand-row td {
        height: 1.1rem;
    }

    .hand-row .participant-signature-cell span {
        height: 0.82rem;
    }

    .print-summary {
        font-size: 0.76rem;
        grid-template-columns: repeat(3, 1fr);
        margin-top: 0.45rem;
        padding-top: 0.35rem;
    }

    .signature-grid {
        grid-template-columns: repeat(2, 1fr);
        margin-top: 1rem;
    }

    .signature-line,
    .signature-line-wrap {
        height: 1.25rem;
    }
}
