* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: #f4f6f8;
    color: #1a1a1a;
}

.container {
    max-width: 720px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.container--narrow {
    max-width: 420px;
}

.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-field span {
    font-size: 0.9rem;
}

.form-field input {
    padding: 0.5rem 0.65rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font: inherit;
}

.form-field input:focus {
    outline: 2px solid #333;
    outline-offset: 1px;
}

.form-error {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #c44;
    border-radius: 6px;
    background: #fff5f5;
    color: #8b1a1a;
}

button {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 1px solid #333;
    border-radius: 6px;
    background: #fff;
    font: inherit;
    align-self: flex-start;
}

button:hover {
    background: #f0f0f0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #ddd;
    background: #fff;
}

.topbar__brand {
    font-weight: 600;
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #444;
}

.topbar__role {
    color: #777;
}

.topbar__user a {
    color: #1a1a1a;
}

.dashboard {
    min-height: 60vh;
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

.status-card h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.status-card p {
    margin: 0.65rem 0;
    line-height: 1.45;
}

.status-card__actions {
    margin-top: 1.25rem;
}

a.btn {
    display: inline-block;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 1px solid #333;
    border-radius: 6px;
    background: #fff;
    color: #1a1a1a;
    text-decoration: none;
    font: inherit;
}

a.btn:hover {
    background: #f0f0f0;
}

.status-card__actions .btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.status-card__actions .btn + .btn {
    margin-top: 0.65rem;
}

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

.container--wide {
    max-width: none;
    width: 100%;
}

.groups-header {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: stretch;
    margin-bottom: 1rem;
}

.groups-header__intro {
    flex: 0 1 auto;
    min-width: 12rem;
}

.groups-header__intro h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.groups-header .table-meta {
    margin-bottom: 0;
}

.query-info {
    flex: 1 1 100%;
    margin: 0;
    padding: 0.5rem 0.65rem;
    font-size: 0.9rem;
    color: #333;
    background: #eef4f8;
    border: 1px solid #c5d4de;
    border-radius: 6px;
    max-width: 36rem;
}

.groups-header .query-info {
    margin-top: 0.25rem;
}

.query-info__summary {
    margin: 0 0 0.45rem;
}

.query-info__collapsible > summary {
    list-style: none;
    cursor: pointer;
}

.query-info__collapsible > summary::-webkit-details-marker {
    display: none;
}

.query-info__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.query-info__toggle-text {
    flex: 1 1 auto;
    min-width: 0;
}

.query-info__toggle-icon::after {
    content: '▸';
    color: #555;
    font-size: 0.95rem;
    line-height: 1;
}

.query-info__collapsible[open] .query-info__toggle-icon::after {
    content: '▾';
}

.query-info__lead {
    margin: 0 0 0.45rem;
}

.query-info__summary-title {
    margin-right: 0.25rem;
}

.query-info__metric {
    display: inline;
}

.query-info__metric + .query-info__metric::before {
    content: ' · ';
}

.query-info__table {
    width: 100%;
    border-collapse: collapse;
    font-size: inherit;
}

.query-info__table th,
.query-info__table td {
    padding: 0.12rem 0.35rem;
    vertical-align: baseline;
}

.query-info__table th {
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #c5d4de;
}

.query-info__table td.label {
    padding-right: 0.75rem;
    white-space: nowrap;
}

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

.filter-box {
    flex: 1 1 20rem;
    border: 1px solid #d0d5da;
    border-radius: 8px;
    background: #f8fafb;
    padding: 0.75rem 1rem;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    font-size: 0.85rem;
}

.filter-form__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: flex-end;
}

.filter-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 5rem;
}

.filter-field--grow {
    flex: 1 1 12rem;
    min-width: 10rem;
}

.filter-field--edges {
    border: none;
    margin: 0;
    padding: 0;
    min-width: 8rem;
}

.filter-field--edges legend,
.filter-field legend {
    font-size: 0.75rem;
    color: #555;
    padding: 0;
    margin-bottom: 0.15rem;
}

.filter-field--edges.is-disabled {
    opacity: 0.55;
}

.filter-field--edges.is-disabled .filter-check {
    cursor: not-allowed;
}

.filter-field select,
.filter-field input[type="number"],
.filter-field input[type="search"],
.filter-field input[type="text"] {
    font: inherit;
    padding: 0.25rem 0.35rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    min-height: 1.85rem;
}

.filter-note-search {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: flex-end;
    flex: 1 1 16rem;
    min-width: 14rem;
    margin: 0;
    padding: 0.45rem 0.65rem 0.55rem;
    border: 1px solid #d0d5da;
    border-radius: 6px;
    background: #fff;
}

.filter-note-search legend {
    float: left;
    width: 100%;
    font-size: 0.75rem;
    color: #666;
    padding: 0;
    margin-bottom: 0.15rem;
}

.filter-note-search .filter-field--grow {
    flex: 1 1 10rem;
    min-width: 8rem;
}

.filter-note-search__exclude {
    margin-bottom: 0;
    justify-content: flex-end;
}

.filter-field select:disabled {
    background: #eee;
    color: #888;
}

.filter-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
}

.filter-checks--inline {
    align-items: center;
    min-height: 1.85rem;
}

.filter-checks--scroll {
    max-height: 5.5rem;
    overflow-y: auto;
    padding: 0.25rem 0.35rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.filter-check {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    cursor: pointer;
}

.filter-check--emph {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.filter-check.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.filter-check__label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.85rem;
}

.filter-multiselect {
    position: relative;
}

.filter-multiselect.is-disabled {
    opacity: 0.55;
}

.filter-multiselect__toggle {
    display: flex;
    align-items: center;
    width: 100%;
    font: inherit;
    padding: 0.25rem 0.35rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    min-height: 1.85rem;
    text-align: left;
    cursor: pointer;
}

.filter-multiselect__toggle:disabled {
    background: #eee;
    color: #888;
    cursor: not-allowed;
}

.filter-multiselect__toggle::after {
    content: '▾';
    margin-left: auto;
    padding-left: 0.35rem;
    color: #666;
}

.filter-multiselect__panel {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: calc(100% + 2px);
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    padding: 0.25rem;
}

.filter-multiselect__panel .filter-checks--scroll {
    max-height: 11rem;
}

button.btn.btn--secondary {
    background: #e8ecef;
    color: #333;
}

button.btn.btn--primary {
    background: rgba(76, 175, 80, 0.14);
    border-color: rgba(67, 160, 71, 0.45);
    color: #1b5e20;
    font-weight: 600;
}

button.btn.btn--primary:hover:not(:disabled) {
    background: #c8e6c9;
    border-color: #43a047;
}

button.btn.btn--secondary:hover:not(:disabled) {
    background: #d8dee4;
}

.table-meta {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: #555;
}

.table-wrap {
    position: relative;
    max-height: min(70vh, calc(100vh - 14rem));
    max-height: min(70dvh, calc(100dvh - 14rem));
    min-height: 10rem;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap.is-loading .data-table {
    opacity: 0.45;
    pointer-events: none;
}

.groups-loading {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    background: rgba(255, 255, 255, 0.45);
    font-size: 0.95rem;
    color: #333;
    pointer-events: auto;
}

.groups-loading[hidden] {
    display: none !important;
}

.groups-loading__spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #c5ccd3;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: groups-spin 0.75s linear infinite;
}

@keyframes groups-spin {
    to {
        transform: rotate(360deg);
    }
}

.query-info.is-loading {
    opacity: 0.55;
}

.groups-load-error {
    margin: 0.75rem 0 0;
}

.groups-load-error[hidden] {
    display: none !important;
}

.filter-form.is-loading .filter-form__actions .btn {
    cursor: wait;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th,
.data-table td {
    border: 1px solid #ddd;
    padding: 0.4rem 0.5rem;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    background: #f0f2f4;
    white-space: nowrap;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    background: #e4e8ec;
}

.data-table th.sortable .sort-indicator::after {
    content: ' ↕';
    opacity: 0.35;
    font-size: 0.75em;
}

.data-table th.is-sorted--asc .sort-indicator::after {
    content: ' ▲';
    opacity: 1;
}

.data-table th.is-sorted--desc .sort-indicator::after {
    content: ' ▼';
    opacity: 1;
}

.data-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.icon-cell {
    text-align: center;
    font-size: 1rem;
}

.icon-ok {
    color: #1a7f37;
}

.icon-no {
    color: #c42b2b;
}

.icon-muted {
    color: #8b949e;
}

.icon-image {
    color: #0969da;
    font-weight: 600;
}

.data-table th[data-sort="note"] {
    width: 400px;
    max-width: 400px;
}

.note-cell {
    width: 400px;
    max-width: 400px;
    vertical-align: top;
}

.note-cell__inner {
    max-width: 400px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ecl-cell {
    width: 280px;
    max-width: 280px;
    vertical-align: top;
}

.ecl-cell__inner {
    max-width: 280px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.grpedit-ecl-select {
    max-width: 100%;
}

.grpedit-ecl-desc {
    margin: 0.35rem 0 0;
}

.load-more-wrap {
    margin-top: 1rem;
}

.groups-card__mobile-only {
    display: none;
}

.export-actions {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.75rem;
}

.export-actions__hint {
    flex: 1 1 100%;
    margin: 0;
}

.btn--block {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

button.btn {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 1px solid #333;
    border-radius: 6px;
    background: #fff;
    color: #1a1a1a;
    font: inherit;
}

button.btn:hover:not(:disabled) {
    background: #f0f0f0;
}

button.btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.hint {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.45;
}

.flash {
    margin: 1rem 0;
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
}

.flash--ok {
    border: 1px solid #1a7f37;
    background: #f0fff4;
    color: #14532d;
}

.flash--error {
    border: 1px solid #c44;
    background: #fff5f5;
    color: #8b1a1a;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.25rem 0;
}

.form-field--checkbox .form-field__checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.form-field--checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-field__hint {
    font-size: 0.85rem;
    color: #555;
}

.import-result {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafbfc;
    font-size: 0.9rem;
}

.import-result ul {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

.error-list {
    margin-top: 0.5rem;
    max-height: 12rem;
    overflow: auto;
    font-size: 0.85rem;
}

.data-table tbody tr.row-link {
    cursor: pointer;
}

.data-table tbody tr.row-link:hover {
    background: #eef4f8;
}

.users-table__self {
    color: #555;
    font-size: 0.85rem;
}

.users-table__muted {
    color: #888;
}

.users-table__role-form,
.users-table__delete-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    align-items: center;
    margin: 0;
}

.users-table__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    align-items: center;
}

.useredit-meta {
    margin-bottom: 1.25rem;
}

.useredit-form {
    margin-top: 0.5rem;
}

.users-table select {
    min-width: 6.5rem;
    padding: 0.25rem 0.35rem;
    font-size: 0.9rem;
}

.btn--compact {
    padding: 0.25rem 0.55rem;
    font-size: 0.85rem;
}

.users-create__title {
    margin: 1.5rem 0 0.75rem;
    font-size: 1.05rem;
}

.users-create__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.users-create select {
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.users-back {
    margin-top: 1.25rem;
}

.btn--danger {
    border-color: #a33;
    color: #8b1a1a;
}

button.btn.btn--danger:hover:not(:disabled) {
    background: #fff0f0;
}

.grpedit__header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.grpedit__header h2 {
    margin: 0;
}

.grpedit-dl {
    display: grid;
    grid-template-columns: minmax(8rem, 12rem) 1fr;
    gap: 0.5rem 1rem;
    margin: 0 0 1.25rem;
}

.grpedit-dl__row {
    display: contents;
}

.grpedit-dl dt {
    margin: 0;
    font-size: 0.85rem;
    color: #555;
}

.grpedit-dl dd {
    margin: 0;
}

.grpedit-notes h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.notes-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafbfc;
    max-height: 16rem;
    overflow: auto;
}

.notes-list__item {
    display: grid;
    grid-template-columns: 9.5rem 1fr;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e8ecef;
    font-size: 0.9rem;
}

.notes-list__item:last-child {
    border-bottom: none;
}

.notes-list__time {
    color: #666;
    white-space: nowrap;
}

.form-field textarea {
    padding: 0.5rem 0.65rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font: inherit;
    width: 100%;
    resize: vertical;
}

.form-field textarea:focus {
    outline: 2px solid #333;
    outline-offset: 1px;
}

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

.grpedit-actions .btn {
    align-self: auto;
}

.grpedit-images {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e5e5;
}

.grpedit-drawing {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e5e5;
}

.grpedit-drawing h3 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.grpedit-drawing__intro {
    margin: 0 0 0.75rem;
}

.grpedit-drawing__status {
    margin: 0 0 0.75rem;
    color: #555;
    font-size: 0.95rem;
}

.grpedit-drawing__meta {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: #444;
}

.grpedit-drawing__stage {
    position: relative;
    overflow: auto;
    max-width: 100%;
    min-height: 8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f4f4f4;
    padding: 0.5rem;
}

.grpedit-drawing__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-height: 7rem;
    font-size: 0.95rem;
    color: #444;
}

.grpedit-drawing__loading[hidden] {
    display: none !important;
}

.grpedit-drawing__spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #c5ccd3;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: groups-spin 0.75s linear infinite;
    flex-shrink: 0;
}

.grpedit-drawing__canvas {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.grpedit-drawing__canvas--zoomable {
    cursor: zoom-in;
}

.grpedit-drawing__canvas--zoomable:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.grpedit-drawing__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.drawing-view__header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.drawing-view__header h2 {
    margin: 0;
}

.drawing-view__intro {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
}

.drawing-view__status {
    margin: 0 0 0.75rem;
    color: #555;
    font-size: 0.95rem;
}

.drawing-view__meta {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: #444;
}

.drawing-view__stage {
    position: relative;
    overflow: auto;
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f4f4f4;
    padding: 0.5rem;
}

.drawing-view__canvas {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.drawing-view__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.statistik__header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.statistik__header h2 {
    margin: 0;
}

.statistik-form__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.statistik-form__actions {
    padding-bottom: 0.15rem;
}

.statistik-form__check-stack {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.statistik-form__check-stack .filter-check {
    margin: 0;
}

.statistik-legend {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 0 0 1rem;
    padding: 0;
    font-size: 0.9rem;
}

.statistik-legend__swatch {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-right: 0.35rem;
    vertical-align: middle;
    border-radius: 3px;
    border: 2px solid transparent;
}

.statistik-legend__swatch--ok {
    background: rgba(46, 125, 50, 0.35);
    border-color: #2e7d32;
}

.statistik-legend__swatch--extern {
    background: rgba(21, 101, 192, 0.35);
    border-color: #1565c0;
}

.statistik-legend__swatch--faulty {
    background: rgba(198, 40, 40, 0.35);
    border-color: #c62828;
}

.statistik-legend__swatch--pending {
    background: rgba(97, 97, 97, 0.25);
    border-color: #757575;
}

.statistik-summary {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: #333;
}

.statistik-from-groups {
    margin: 0 0 1rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f7f9fb;
}

.statistik-from-groups[hidden] {
    display: none !important;
}

.statistik-from-groups__lead {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    color: #333;
}

.statistik--from-groups .statistik-form {
    display: none;
}

.statistik-nacharbeit {
    margin: 0 0 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    background: #fafafa;
}

.statistik-nacharbeit[hidden] {
    display: none !important;
}

.statistik-nacharbeit__body {
    margin-top: 0.75rem;
}

.statistik-nacharbeit__actions {
    margin-bottom: 0.65rem;
}

.statistik-nacharbeit__table-wrap {
    overflow-x: auto;
}

.statistik-nacharbeit__table {
    font-size: 0.88rem;
}

.statistik-nacharbeit__table .num {
    text-align: center;
    white-space: nowrap;
}

.statistik-nacharbeit__use {
    width: 3rem;
    text-align: center;
    vertical-align: bottom;
}

.statistik-nacharbeit__use-all-label {
    justify-content: center;
    margin: 0 0 0.2rem;
}

.statistik-nacharbeit__use-heading {
    display: block;
    font-size: 0.85em;
    line-height: 1.2;
}

.statistik-nacharbeit__use-label {
    justify-content: center;
    margin: 0;
}

.statistik-nacharbeit__anweisung {
    width: 100%;
    min-width: 8rem;
    box-sizing: border-box;
    font: inherit;
    padding: 0.25rem 0.4rem;
}

.statistik-nacharbeit__check-col,
.statistik-nacharbeit__date-col {
    text-align: center;
    white-space: nowrap;
}

.statistik-nacharbeit__check-box {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #333;
    vertical-align: middle;
}

.statistik-nacharbeit__date-placeholder {
    color: #888;
}

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

.statistik-status {
    margin: 0 0 0.75rem;
    color: #555;
    font-size: 0.95rem;
}

.statistik-stage {
    position: relative;
    min-height: 4rem;
}

.statistik-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-height: 4rem;
    font-size: 0.95rem;
    color: #444;
}

.statistik-loading[hidden] {
    display: none !important;
}

.statistik-loading__spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #c5ccd3;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: groups-spin 0.75s linear infinite;
    flex-shrink: 0;
}

.statistik-pages {
    display: block;
}

.statistik-page {
    display: block;
    position: relative;
}

.statistik-page[hidden] {
    display: none !important;
}

.statistik-page__label {
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
    color: #555;
}

.statistik-page__canvas {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.statistik-page__canvas--zoomable {
    cursor: zoom-in;
}

body.drawing-lightbox-open {
    overflow: hidden;
}

.drawing-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
        max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
}

.drawing-lightbox[hidden] {
    display: none !important;
}

.drawing-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(2px);
    cursor: pointer;
}

.drawing-lightbox__panel {
    position: relative;
    z-index: 1;
    max-width: min(98vw, 1280px);
    width: 100%;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.drawing-lightbox__content {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    padding: 0.75rem 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.drawing-lightbox__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid #bbb;
    border-radius: 6px;
    background: #fff;
    color: #1a1a1a;
    padding: 0.35rem 0.65rem;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.drawing-lightbox__close-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.drawing-lightbox__meta {
    margin: 0 0 0.65rem;
    padding-right: 5rem;
    font-size: 0.9rem;
    color: #444;
    flex-shrink: 0;
}

.drawing-lightbox__stage {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    padding: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

.drawing-lightbox__tooltip,
.drawing-mark-tooltip {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(20, 20, 20, 0.92);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.drawing-lightbox__canvas {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    flex-shrink: 0;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.drawing-lightbox__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.drawing-lightbox__hint {
    margin: 0.65rem 0 0;
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    flex-shrink: 0;
}

.drawing-view__stage--a3 {
    overflow-x: auto;
    max-width: 100%;
}

.drawing-view__stage--a3 .drawing-view__canvas {
    max-width: none !important;
    max-height: none !important;
    width: auto !important;
    flex-shrink: 0;
}

.statistik-toolbar {
    margin-bottom: 0.75rem;
}

.statistik-toolbar[hidden] {
    display: none !important;
}

.statistik-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.35rem 0 0;
}

.statistik-nav.is-single {
    display: none;
}

.grpedit-images h3 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.grp-image-session {
    margin-bottom: 1.25rem;
}

.grp-image-session__meta {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: #444;
}

.grp-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.grp-image-grid__item {
    margin: 0;
}

.grp-image-grid__frame {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    aspect-ratio: 4 / 3;
}

.grp-image-grid__item a,
.grp-image-grid__open {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
}

.grp-image-grid__delete-form {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    margin: 0;
    z-index: 2;
}

.grp-image-grid__delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #c62828;
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.grp-image-grid__delete:hover {
    background: #b71c1c;
}

.grp-image-grid__delete:focus {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

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

.grp-image-grid__badge {
    position: absolute;
    right: 0.35rem;
    bottom: 0.35rem;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border-radius: 4px;
}

.grp-image-grid__taken {
    margin: 0.3rem 0 0;
    font-size: 0.75rem;
    line-height: 1.3;
    color: #666;
    text-align: center;
}

body.grp-lightbox-open {
    overflow: hidden;
}

.grp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.grp-lightbox[hidden] {
    display: none;
}

.grp-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(2px);
    cursor: pointer;
}

.grp-lightbox__panel {
    position: relative;
    z-index: 1;
    max-width: min(96vw, 1100px);
    width: 100%;
    pointer-events: none;
}

.grp-lightbox__content {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    padding: 0.75rem 0.75rem 1rem;
}

.grp-lightbox__figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
}

.grp-lightbox__stage {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    padding: 0.5rem;
    min-height: 120px;
    max-height: calc(92vh - 9rem);
}

.grp-lightbox__img {
    max-width: 100%;
    max-height: calc(92vh - 10rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

.grp-lightbox__caption {
    margin: 0;
    width: 100%;
    text-align: center;
}

.grp-lightbox__filename {
    color: #333;
    font-size: 0.9rem;
    word-break: break-word;
}

.grp-lightbox__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e0e0e0;
}

.grp-lightbox__toolbar-btn {
    border: 1px solid #bbb;
    border-radius: 6px;
    background: #fff;
    color: #1a1a1a;
    padding: 0.45rem 0.85rem;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.grp-lightbox__toolbar-btn:hover {
    background: #f3f3f3;
}

.grp-lightbox__toolbar-btn--close {
    border-color: #c62828;
    color: #8b1a1a;
}

.grp-lightbox__toolbar-btn--close:hover {
    background: #fff5f5;
}

.grp-lightbox__counter {
    min-width: 4.5rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #444;
}

.grp-lightbox__hint {
    margin: 0.65rem 0 0;
    text-align: center;
    font-size: 0.78rem;
    color: #666;
}

.grp-lightbox__close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1002;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    padding: 0.4rem 0.85rem 0.4rem 0.65rem;
    pointer-events: auto;
}

.grp-lightbox__close:hover {
    background: rgba(0, 0, 0, 0.72);
}

.grp-lightbox__close-icon {
    font-size: 1.25rem;
    line-height: 1;
    font-weight: 700;
}

.grp-lightbox__nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    font-size: 2.25rem;
    line-height: 1;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 0.15rem;
    pointer-events: auto;
}

.grp-lightbox__nav:hover {
    background: rgba(0, 0, 0, 0.72);
}

.grp-lightbox__nav--prev {
    left: 1rem;
}

.grp-lightbox__nav--next {
    right: 1rem;
}

@media (min-width: 641px) {
    .groups-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
        grid-template-rows: auto 1fr;
        gap: 1rem 1.5rem;
        align-items: stretch;
    }

    .groups-header__intro {
        grid-column: 1;
        grid-row: 1;
        flex: none;
        min-width: 0;
        align-self: start;
    }

    .filter-box {
        grid-column: 2;
        grid-row: 1 / -1;
        flex: none;
        align-self: end;
    }

    .groups-header .query-info {
        grid-column: 1;
        grid-row: 2;
        flex: none;
        max-width: none;
        width: 100%;
        margin-top: 0;
        align-self: end;
    }

    .query-info__collapsible > summary {
        cursor: default;
        pointer-events: none;
    }

    .query-info__toggle-icon {
        display: none;
    }

    .query-info__collapsible > summary,
    .query-info__body > .query-info__lead {
        display: inline;
    }

    .query-info__body > .query-info__lead {
        margin: 0 0 0.45rem;
    }

    .query-info__body > .query-info__lead::before {
        content: ' · ';
    }

    .query-info__table {
        display: table;
        width: 100%;
        margin-top: 0.45rem;
    }
}

@media (max-width: 640px) {
    .query-info {
        max-width: none;
    }

    .query-info__lead {
        display: block;
    }

    .query-info__lead .query-info__metric {
        display: block;
    }

    .query-info__table thead {
        display: none;
    }

    .query-info__table tbody tr {
        display: block;
        padding: 0.35rem 0;
        border-bottom: 1px solid #c5d4de;
    }

    .query-info__table tbody tr:last-child {
        border-bottom: none;
    }

    .query-info__table td.label {
        display: block;
        white-space: normal;
        font-weight: 600;
        padding: 0 0 0.2rem;
    }

    .query-info__table td.num {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.75rem;
        white-space: normal;
        text-align: right;
        padding: 0.12rem 0;
    }

    .query-info__table td.num::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-weight: 600;
        color: #555;
        text-align: left;
    }

    .table-wrap {
        max-height: none;
        min-height: 0;
        overflow: visible;
    }

    #groups-table.data-table {
        border-collapse: separate;
        border-spacing: 0 0.75rem;
    }

    #groups-table.data-table thead {
        display: none;
    }

    #groups-table.data-table tbody tr.row-link {
        display: block;
        border: 1px solid #d0d5da;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    #groups-table.data-table tbody tr.row-link:nth-child(even) {
        background: #fafbfc;
    }

    #groups-table.data-table tbody tr.row-link:hover {
        background: #f0f4f8;
    }

    #groups-table.data-table tbody .groups-card__desktop-only {
        display: none !important;
    }

    #groups-table.data-table tbody .groups-card__mobile-only {
        display: block;
    }

    #groups-table.data-table tbody td.groups-card__mobile-only {
        border: none;
        border-bottom: 1px solid #e8eaed;
        padding: 0.45rem 0.75rem;
    }

    #groups-table.data-table tbody td.groups-card__mobile-only::before {
        content: none;
    }

    #groups-table.data-table tbody td.groups-card__head {
        background: #f0f4f8;
        font-size: 0.92rem;
        line-height: 1.4;
        color: #333;
    }

    #groups-table.data-table tbody td.groups-card__head .groups-card__groupnr {
        font-size: 1rem;
        font-weight: 700;
        color: #1a1a1a;
    }

    #groups-table.data-table tbody td.groups-card__spec {
        font-size: 0.88rem;
        font-weight: 600;
        color: #1a1a1a;
        text-align: center;
    }

    #groups-table.data-table tbody td.groups-card__status {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0;
        padding: 0;
        border-bottom: 1px solid #e8eaed;
    }

    #groups-table.data-table .groups-card__status-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.35rem;
        padding: 0.55rem 0.35rem;
        text-align: center;
    }

    #groups-table.data-table .groups-card__status-item + .groups-card__status-item {
        border-left: 1px solid #e8eaed;
    }

    #groups-table.data-table .groups-card__status-label {
        font-size: 0.72rem;
        font-weight: 600;
        color: #555;
        line-height: 1.25;
    }

    #groups-table.data-table .groups-card__status-icon {
        font-size: 1.05rem;
        line-height: 1;
    }

    #groups-table.data-table tbody td.groups-card__field {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.75rem;
        text-align: right;
    }

    #groups-table.data-table tbody td.groups-card__field::before {
        content: attr(data-label);
        flex: 0 0 42%;
        max-width: 11rem;
        font-weight: 600;
        font-size: 0.78rem;
        color: #555;
        text-align: left;
        line-height: 1.35;
    }

    #groups-table.data-table tbody td.groups-card__note {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        text-align: left;
        border-bottom: none;
    }

    #groups-table.data-table tbody td.groups-card__note::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.78rem;
        color: #555;
        line-height: 1.35;
    }

    #groups-table.data-table tbody td.groups-card__note .note-cell__inner {
        width: 100%;
        max-width: none;
    }

    .grp-lightbox__nav {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.85rem;
    }

    .grp-lightbox__close-label {
        display: none;
    }

    .grp-lightbox__toolbar {
        flex-direction: column;
    }

    .grp-lightbox__toolbar-btn {
        width: 100%;
    }
}
