:root {
    --surface: #ffffff;
    --surface-soft: #f3f6f8;
    --surface-muted: #eef3f5;
    --line: #d7dee8;
    --line-strong: #c2ccd8;
    --text: #101828;
    --muted: #667085;
    --brand: #005ea6;
    --brand-dark: #00437a;
    --brand-soft: #e6f0f9;
    --accent: #2563eb;
    --accent-soft: #eef4ff;
    --warning: #b45309;
    --warning-bg: #fff7ed;
    --danger: #b42318;
    --danger-soft: #fff1f3;
    --icon-ink: #475467;
    --icon-ink-strong: #344054;
    --icon-bg: #f2f4f7;
    --icon-border: #d0d5dd;
    --shadow: none;
}

html,
body {
    min-height: 100%;
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        linear-gradient(180deg, #f8fafb 0, var(--surface-soft) 260px),
        var(--surface-soft);
}

a {
    color: var(--brand);
    text-decoration: none;
}

.btn-portal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 7px 14px;
    border: 1px solid var(--brand);
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.86rem;
    line-height: 1.1;
    cursor: pointer;
    white-space: nowrap;
}

.btn-portal:hover:not(:disabled) {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.btn-portal:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-portal--muted,
.btn-portal--outline {
    background: #fff;
    color: var(--brand);
}

.btn-portal--muted {
    border-color: var(--line-strong);
}

.btn-portal--outline {
    border-color: var(--brand);
}

.btn-portal--muted:hover:not(:disabled),
.btn-portal--outline:hover:not(:disabled) {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: var(--brand-dark);
}

.btn-portal--danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-portal--sm {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 0.78rem;
}

.btn-portal-icon {
    flex: 0 0 auto;
    fill: currentColor;
    stroke: none;
}

h1:focus {
    outline: none;
}

.page {
    min-height: 100vh;
}

main {
    display: block;
    min-width: 0;
}

/* ── App-Header-Band (oben) ─────────────────────────── */
.portal-app-header {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "brand logo actions";
    align-items: center;
    gap: 16px;
    min-height: 60px;
    padding: 0 24px;
    background: var(--brand);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header-brand {
    grid-area: brand;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.app-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.18);
    border-radius: 8px;
    font-weight: 900;
    font-size: 1rem;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.app-header-identity {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.app-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-customer {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.75);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-header-logo {
    grid-area: logo;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    pointer-events: none;
}

.app-logo-img {
    max-height: 40px;
    max-width: 180px;
    object-fit: contain;
}

.app-logo-img.app-logo-transparent {
    background: #fff;
    border-radius: 4px;
    padding: 2px 6px;
}

.app-logo-img.app-logo-transparent.app-logo-filter-safe {
    filter: brightness(0) invert(1);
    background: transparent;
    border-radius: 0;
    padding: 0;
}

/* Opakes Logo: Originalfarben, kleiner weisser Hintergrund damit es lesbar bleibt */
.app-logo-img.app-logo-opaque {
    background: #fff;
    border-radius: 4px;
    padding: 2px 6px;
}

.app-header-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.app-header-actions .link-button,
.app-header-actions .home-button {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.12);
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.85rem;
}

.app-header-actions .home-button {
    background: rgba(255,255,255,0.22);
    font-weight: 700;
}

.app-view-mode-toggle {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.42);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255,255,255,0.14);
}

.app-view-mode-toggle.mode-advanced {
    border-color: rgba(255,255,255,0.78);
}

.app-view-mode-toggle.mode-expert {
    border-color: #fff;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.45);
}

.app-view-mode-toggle button {
    border: 0;
    border-right: 1px solid rgba(255,255,255,0.32);
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    padding: 6px 10px;
}

.app-view-mode-toggle button:last-child {
    border-right: 0;
}

.app-view-mode-toggle button.active {
    background: #fff;
    color: var(--brand);
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12);
}

.app-view-mode-toggle.mode-expert button.active {
    color: #111827;
    box-shadow: inset 0 -3px 0 #111827;
}

.app-guidance-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.app-guidance-toggle input {
    width: 14px;
    height: 14px;
    accent-color: #fff;
    cursor: pointer;
}

.app-header-actions .language-switch {
    color: rgba(255,255,255,0.85);
}

.app-header-actions .language-switch select {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
}

.app-header-actions .language-switch select option {
    background: #fff;
    color: #1a1a2e;
}

.app-header-actions .version-badge {
    color: rgba(255,255,255,0.6);
    font-size: 0.68rem;
}

/* ── Wirtschaftseinheit-Kontext-Band ─────────────────── */
.we-band {
    background: var(--surface);
    border-bottom: 2px solid var(--line);
    position: sticky;
    top: 60px;
    z-index: 90;
}

.we-band-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 24px;
    border-bottom: 1px solid var(--line);
    min-height: 52px;
}

.we-band-panel.collapsed {
    border-bottom: none;
}

.we-band-info {
    flex: 1;
    min-width: 0;
}

.we-period-context {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(980px, 58vw);
    transform: translate(-50%, -50%);
    z-index: 1;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 1rem;
}

.we-period-select {
    display: grid;
    gap: 0.25rem;
    flex: 0 0 min(460px, 42%);
    min-width: 320px;
}

.we-period-select span,
.we-context-address span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
}

.we-period-select .ke-select {
    width: 100%;
    min-height: 2.45rem;
    text-align: center;
}

.we-context-address {
    display: grid;
    gap: 0.25rem;
    min-width: 280px;
    max-width: min(440px, 42%);
}

.we-context-address strong {
    display: flex;
    align-items: center;
    min-height: 2.45rem;
    padding: 0.5rem 0.75rem;
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1180px) {
    .we-band-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .we-period-context {
        position: static;
        width: min(100%, 760px);
        align-self: center;
        transform: none;
        align-items: stretch;
        flex-wrap: wrap;
    }

    .we-period-select,
    .we-context-address {
        flex: 1 1 320px;
        max-width: none;
    }

    .we-collapse-btn {
        position: absolute;
        right: 24px;
        top: 10px;
    }
}

.we-info-row {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.we-info-main {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.we-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand);
}

.we-no-selection {
    color: var(--muted);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.we-name {
    font-size: 0.95rem;
    color: var(--text);
}

.we-info-metrics {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.we-metric-stack {
    display: grid;
    gap: 2px;
}

.we-metric {
    font-size: 0.82rem;
    color: var(--muted);
    white-space: nowrap;
}

.we-metric strong {
    color: var(--text);
    font-weight: 700;
}

.we-billing-status {
    padding: 2px 8px;
    border-radius: 4px;
    background: #ecfdf3;
    color: #05603a;
    font-weight: 700;
}

.we-collapse-btn {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 4px 10px;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
}

.we-collapse-btn:hover {
    background: var(--line);
}

/* ── Kacheln im Wirtschaftseinheit-Band (kompakt) ───── */
.nav-tile-grid--compact {
    padding: 12px 20px 14px;
    gap: 10px;
}

.nav-tile-grid--start-level {
    grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
}

.nav-tile-grid--we-detail {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.nav-tile-grid--compact .nav-tile {
    padding: 12px 14px;
    min-height: 80px;
}

.nav-tile-grid--compact .nav-tile.active {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.nav-tile-grid--compact .nav-tile-icon {
    width: 56px;
    height: 56px;
}

.nav-tile-grid--compact .nav-tile-icon svg {
    width: 26px;
    height: 26px;
}
.nav-tile-grid--compact.nav-tile-grid--minimized {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    padding: 8px 20px;
    gap: 8px;
    margin-top: 0;
}

.nav-tile-grid--compact.nav-tile-grid--minimized .nav-tile {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    min-height: 44px;
    padding: 5px 10px;
    gap: 8px;
    border-radius: 8px;
}

.nav-tile-grid--compact.nav-tile-grid--minimized .nav-tile:hover {
    transform: none;
}

.nav-tile-grid--compact.nav-tile-grid--minimized .nav-tile-icon {
    width: 34px;
    height: 34px;
    grid-row: 1;
}

.nav-tile-grid--compact.nav-tile-grid--minimized .nav-tile-icon svg {
    width: 18px;
    height: 18px;
}

.nav-tile-grid--compact.nav-tile-grid--minimized .nav-tile strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.84rem;
    line-height: 1.2;
}

.nav-tile-grid--compact.nav-tile-grid--minimized .nav-tile > span:not(.nav-tile-icon) {
    display: none;
}

/* ── Altes top-row (Kompatibilität) ─────────────────── */
.top-row {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
}

.top-row strong,
.top-row span {
    display: block;
}

.top-row span {
    color: var(--muted);
    font-size: 0.85rem;
}

.content {
    padding-top: 24px;
    padding-bottom: 40px;
}

.portal-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    padding: 30px 32px;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: none;
}

.portal-header.compact {
    padding: 24px 28px;
}

.portal-header.slim {
    padding: 10px 20px;
    margin-bottom: 16px;
    border-radius: 6px;
    align-items: center;
}

.portal-header.slim h1,
.portal-header.slim .portal-header-title {
    margin: 0 0 2px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0;
}

.portal-header.slim p {
    font-size: 0.82rem;
}

.portal-header.slim .eyebrow {
    font-size: 0.7rem;
    margin-bottom: 2px !important;
}

.portal-header-toolbar {
    align-items: center;
    margin-bottom: 14px;
}

.portal-header-toolbar > div:first-child {
    min-width: 260px;
}

.portal-header h1,
.login-panel h1 {
    margin: 0 0 8px;
    font-size: 2rem;
    letter-spacing: 0;
}

.portal-header p,
.login-panel p {
    margin: 0;
    max-width: 720px;
    color: var(--muted);
}

.customer-info {
    margin-top: 12px !important;
    font-size: 0.92rem;
    color: var(--text) !important;
    line-height: 1.5;
}

.customer-info strong {
    display: block;
    font-weight: 600;
    color: var(--text);
}

.eyebrow {
    margin-bottom: 8px !important;
    color: var(--brand) !important;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.primary-action,
.secondary-action,
.link-button,
.table-action {
    border: 0;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.table-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.archive-actions {
    display: flex;
    gap: 8px;
    white-space: nowrap;
    justify-content: flex-end;
}

.archive-document-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--brand);
    border-radius: 6px;
    background: #fff;
    color: var(--brand);
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

.archive-document-btn:hover:not(:disabled) {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.archive-document-btn-download {
    background: var(--brand);
    color: #fff;
}

.archive-document-btn-download:hover:not(:disabled) {
    background: var(--brand-dark);
    color: #fff;
}

.archive-document-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.archive-document-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

/* Vorschau-Modal */
.preview-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.preview-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    width: min(92vw, 1000px);
    max-height: 90vh;
    overflow: hidden;
}

.upload-meta-dialog {
    width: min(92vw, 480px);
    max-height: unset;
}

.upload-meta-body {
    padding: 28px 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.upload-meta-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 28px;
    border-top: 1px solid var(--line);
}

.upload-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.upload-meta-body .upload-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary, #555);
    display: block;
}

.upload-meta-body .upload-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--line, #ccc);
    border-radius: 6px;
    font-size: 0.95rem;
    background: #fff;
    box-sizing: border-box;
}

.preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    gap: 16px;
}

.preview-close {
    border: 0;
    background: var(--surface);
    border-radius: 8px;
    padding: 6px 14px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}

.preview-close:hover {
    background: var(--line);
}

.preview-modal-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 16px;
}

.preview-frame {
    width: 100%;
    height: 70vh;
    border: 0;
}

.preview-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.preview-loading,
.preview-unsupported {
    color: var(--text-soft);
    font-size: 0.95rem;
}

.kd-camera-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.62);
}

.kd-camera-modal {
    width: min(92vw, 720px);
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
}

.kd-camera-video {
    width: 100%;
    max-height: min(68vh, 620px);
    object-fit: contain;
    background: #111827;
    border-radius: 6px;
}

.kd-camera-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}



.primary-action {
    padding: 11px 18px;
    color: #fff;
    background: var(--brand);
}

.primary-action:hover {
    background: var(--brand-dark);
}

.secondary-action {
    padding: 10px 16px;
    color: var(--accent);
    background: var(--accent-soft);
    white-space: nowrap;
}

.secondary-action:hover,
.table-action:hover {
    background: #e0eaff;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.language-switch span {
    display: inline;
}

.language-switch select {
    min-height: 32px;
    padding: 5px 28px 5px 8px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.data-source-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 6px;
    font-weight: 700;
    white-space: nowrap;
}

.data-source-pill.api {
    color: #05603a;
    background: #ecfdf3;
    border: 1px solid #abefc6;
}

.data-source-pill.fallback {
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid #fecdd6;
}

.link-button {
    padding: 8px 0;
    color: var(--brand);
    background: transparent;
}

.home-button {
    padding: 6px 14px;
    background: var(--brand);
    color: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card,
.panel,
.table-panel,
.upload-panel,
.archive-search-bar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.archive-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.archive-search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    flex: 1 1 520px;
}

.archive-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    color: var(--text);
    background: transparent;
    min-width: 0;
}

.archive-search-input::placeholder {
    color: var(--muted);
}

.archive-search-hint {
    font-size: 0.82rem;
    color: var(--muted);
    white-space: nowrap;
}

.archive-upload-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--brand);
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.archive-upload-button:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.archive-upload-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

.archive-upload-button input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.metric-card {
    padding: 22px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.metric-card-action {
    display: block;
    width: 100%;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.metric-card:hover {
    border-color: var(--line-strong);
    background: #fbfcfd;
}

.metric-card span,
.list-row span,
.upload-panel span,
.portal-table td span {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
}

.metric-card strong {
    display: block;
    margin-top: 10px;
    font-size: 2.05rem;
    letter-spacing: 0;
}

.metric-card.warning {
    background: var(--warning-bg);
    border-color: #fed7aa;
}

.metric-card.warning strong {
    color: var(--warning);
}

.tenant-ticket-metric {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.tenant-ticket-metric strong {
    color: #067647;
}

.tenant-ticket-metric.has-tickets {
    border-color: #17b26a;
}

.tenant-ticket-metric em {
    display: block;
    margin-top: 4px;
    color: #067647;
    font-size: 0.78rem;
    font-style: normal;
    font-weight: 700;
}

.contract-metric {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.contract-metric strong {
    color: #1d4ed8;
}

.contract-metric em {
    display: block;
    margin-top: 4px;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-style: normal;
    font-weight: 700;
}

.contract-metric.is-selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.contracts-panel {
    margin-bottom: 24px;
}

.contracts-filter-toolbar {
    align-items: stretch;
}

.contract-search-bar {
    min-height: 42px;
}

.contract-search-bar--short {
    flex: 0 1 280px;
}

.contracts-page-panel {
    margin-top: 0;
}

.contract-we-list {
    display: grid;
    gap: 14px;
}

.contract-we-block {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.contract-we-block header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
}

.contract-we-block header strong,
.contract-table td strong {
    display: block;
}

.contract-we-block header span,
.contract-table td span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.contract-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.contract-table {
    margin: 0;
    min-width: 920px;
}

.contract-table th,
.contract-table td {
    white-space: nowrap;
}

.contract-table td:first-child {
    min-width: 220px;
    white-space: normal;
}

.contract-document-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.contract-document-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--brand);
    cursor: pointer;
}

.contract-document-button:hover:not(:disabled) {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.contract-document-button svg {
    width: 18px;
    height: 18px;
}

.contract-doc-empty {
    color: var(--muted);
    font-size: 0.82rem;
}

.portal-grid.two-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.panel {
    padding: 22px;
}

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.panel-title h2 {
    margin: 0;
    font-size: 1.1rem;
}

.inline-error {
    margin: 10px 0 14px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #fef2f2;
    color: #b42318;
    font-weight: 700;
}

.empty-state {
    margin: 14px 0 0;
    color: var(--muted);
}

.active-services-panel {
    margin-bottom: 24px;
}

.active-service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.active-service-card {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    gap: 12px 16px;
    align-items: center;
    min-height: 156px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.active-service-card:hover,
.active-service-card:focus-visible {
    border-color: var(--brand);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
    outline: none;
}

.active-service-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 16px;
    border: 1px solid var(--icon-border);
    background: var(--icon-bg);
    color: var(--icon-ink);
}

.active-service-icon svg {
    width: 42px;
    height: 42px;
    fill: currentColor;
    stroke: none;
}

.active-service-summary {
    display: grid;
    gap: 4px;
}

.active-service-summary strong {
    font-size: 1rem;
}

.active-service-summary span,
.active-service-summary small,
.active-service-readonly {
    color: var(--muted);
}

.active-service-action {
    grid-column: 2;
    align-self: end;
    color: var(--brand);
    font-weight: 700;
}

.active-service-switches {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px 14px;
}

.active-service-switches--compact {
    grid-template-columns: minmax(190px, 1fr);
}

.active-service-modal {
    width: min(92vw, 640px);
}

.active-service-modal-body {
    display: grid;
    gap: 18px;
    padding: 20px;
}

.active-service-dialog-summary {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.active-service-dialog-copy {
    display: grid;
    gap: 4px;
}

.active-service-dialog-summary span,
.active-service-dialog-summary small {
    color: var(--muted);
}

.tenant-ticket-panel {
    margin-bottom: 18px;
    border-color: var(--line);
    background: var(--surface);
}

.tenant-ticket-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 220px)) auto;
    align-items: end;
    gap: 12px;
    margin: 12px 0 16px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.tenant-ticket-filters label {
    display: grid;
    gap: 5px;
}

.tenant-ticket-filters label span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tenant-ticket-filter-reset {
    min-height: 39px;
    white-space: nowrap;
}

.ticket-accordion-group {
    border-top: 1px solid var(--line);
}

.ticket-accordion-group:first-of-type {
    border-top: 0;
}

.ticket-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 4px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.ticket-accordion-header:hover {
    color: var(--brand);
}

.ticket-accordion-header > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ticket-accordion-header strong {
    overflow-wrap: anywhere;
}

.ticket-accordion-header em {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.82rem;
    font-style: normal;
}

.ticket-accordion-icon {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--brand);
    font-weight: 900;
    line-height: 1;
}

.ticket-accordion-body {
    padding-bottom: 12px;
}

.tenant-ticket-row {
    align-items: flex-start;
    gap: 14px;
}

.tenant-ticket-card {
    display: grid;
    grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) 110px;
    align-items: center;
    column-gap: 18px;
    row-gap: 12px;
    width: 100%;
    margin: 0 0 10px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.tenant-ticket-card:has(.priority-kritisch) {
    border-left-color: #d92d20;
}

.tenant-ticket-card:has(.priority-hoch) {
    border-left-color: #f79009;
}

.tenant-ticket-card:has(.priority-niedrig) {
    border-left-color: #12b76a;
}

.tenant-ticket-card:last-child {
    margin-bottom: 0;
}

.tenant-ticket-card:hover {
    border-color: var(--brand);
    background: #fbfcfd;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 10%, transparent);
}

.tenant-ticket-side {
    display: grid;
    align-content: start;
    gap: 8px;
    color: var(--muted);
    font-size: 0.82rem;
}

.tenant-ticket-side strong {
    color: var(--text);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.tenant-ticket-data {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr) minmax(320px, 1.35fr);
    gap: 18px;
    min-width: 0;
}

.tenant-ticket-block {
    display: grid;
    align-content: start;
    gap: 4px;
    min-width: 0;
}

.tenant-ticket-label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tenant-ticket-block strong,
.tenant-ticket-block span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.tenant-ticket-block > span:not(.tenant-ticket-label) {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

.tenant-ticket-content strong {
    font-size: 0.98rem;
}

.ticket-icon-stack {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
    padding-top: 2px;
}

.ticket-priority-icon,
.ticket-category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--icon-bg);
    border: 1px solid var(--icon-border);
    color: var(--icon-ink);
}

.ticket-priority-icon svg,
.ticket-category-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ticket-priority-icon.priority-kritisch,
.ticket-priority-badge.priority-kritisch {
    color: var(--icon-ink-strong);
    border-color: var(--icon-border);
    background: var(--icon-bg);
}

.ticket-priority-icon.priority-hoch,
.ticket-priority-badge.priority-hoch {
    color: var(--icon-ink-strong);
    border-color: var(--icon-border);
    background: var(--icon-bg);
}

.ticket-priority-icon.priority-normal,
.ticket-priority-badge.priority-normal {
    color: var(--icon-ink);
    border-color: var(--icon-border);
    background: var(--icon-bg);
}

.ticket-priority-icon.priority-niedrig,
.ticket-priority-badge.priority-niedrig {
    color: var(--icon-ink);
    border-color: var(--icon-border);
    background: var(--icon-bg);
}

.ticket-category-icon {
    color: #374151;
}

.ticket-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    grid-column: 1 / -1;
    margin: 4px 0 2px;
    align-content: start;
}

.ticket-priority-badge,
.ticket-category-badge,
.ticket-audience-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
}

.ticket-audience-badge {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.tenant-ticket-card > .status-pill {
    justify-self: end;
    align-self: center;
    text-align: center;
    justify-content: center;
    min-width: 86px;
}

.tenant-dashboard-panel {
    margin-bottom: 24px;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.tenant-dashboard-list {
    display: grid;
    gap: 8px;
}

.tenant-dashboard-ticket {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.tenant-dashboard-ticket:hover {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 14%, transparent);
}

.tenant-priority-dot {
    width: 12px;
    height: 12px;
    margin-top: 4px;
    border-radius: 999px;
    background: var(--line-strong);
}

.tenant-priority-dot.priority-kritisch {
    background: var(--icon-ink-strong);
}

.tenant-priority-dot.priority-hoch {
    background: var(--icon-ink);
}

.tenant-priority-dot.priority-normal {
    background: var(--muted);
}

.tenant-priority-dot.priority-niedrig {
    background: var(--line-strong);
}

.tenant-dashboard-ticket-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.tenant-dashboard-ticket-main strong,
.tenant-dashboard-ticket-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tenant-dashboard-ticket-main span {
    color: var(--muted);
    font-size: 0.84rem;
}

.tenant-dashboard-ticket-meta {
    display: grid;
    gap: 6px;
    justify-items: end;
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

.ticket-detail-modal {
    width: min(94vw, 980px);
}

.ticket-message-modal {
    width: min(94vw, 760px);
}

.ticket-message-modal .ticket-detail-grid {
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px);
}

.ticket-detail-body {
    display: grid;
    gap: 16px;
    padding: 18px 22px;
    overflow: auto;
}

.ticket-detail-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) minmax(150px, 220px);
    gap: 12px;
}

.ticket-detail-grid label,
.ticket-detail-description {
    display: grid;
    gap: 5px;
}

.ticket-detail-grid label span,
.ticket-detail-description span,
.ticket-detail-facts span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.ticket-detail-description textarea {
    resize: vertical;
}

.message-recipient-box {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    background: var(--surface-soft);
}

.message-recipient-box > span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.message-recipient-choice,
.message-recipient-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.message-recipient-list {
    display: grid;
    gap: 8px;
    max-height: 220px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.ticket-detail-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ticket-detail-facts div {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.ticket-detail-tokens {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff;
}

.ticket-detail-tokens dl {
    display: grid;
    grid-template-columns: minmax(120px, 220px) minmax(0, 1fr);
    gap: 5px 12px;
    margin: 12px 0 0;
    font-size: 0.82rem;
}

.ticket-detail-tokens dt {
    color: var(--muted);
    font-weight: 800;
}

.ticket-detail-tokens dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.ticket-detail-protocol {
    display: grid;
    gap: 8px;
}

.ticket-detail-protocol h3 {
    margin: 0;
    font-size: 1rem;
}

.ticket-protocol-row {
    display: grid;
    grid-template-columns: 145px 160px 110px minmax(0, 1fr);
    gap: 8px;
    align-items: baseline;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    font-size: 0.84rem;
}

.ticket-protocol-row p {
    margin: 0;
}

.ticket-detail-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--line);
}

.map-panel {
    margin-bottom: 24px;
}

.map-panel--screen-fill {
    margin-bottom: 0;
}

.map-panel--screen-fill .portal-map {
    height: max(420px, calc(100dvh - 430px));
    max-height: none;
}

.portal-map-shell {
    position: relative;
}

.portal-map {
    width: 100%;
    height: clamp(360px, 42vh, 560px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eef2f4;
}

.map-fit-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    min-height: 34px;
    padding: 0 12px;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.12);
    font-size: 0.84rem;
    font-weight: 700;
}

.map-fit-button:hover {
    background: #f8fafc;
}

.map-empty {
    display: grid;
    min-height: 180px;
    place-items: center;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px dashed var(--line);
    border-radius: 8px;
    text-align: center;
}

.portal-map-house-marker {
    width: 38px;
    height: 38px;
    padding: 0;
    background: transparent;
    border: 0;
    filter: drop-shadow(0 3px 7px rgba(16, 24, 40, 0.26));
    cursor: pointer;
}

.portal-map-house-marker .house-marker {
    display: block;
    width: 38px;
    height: 38px;
    overflow: visible;
}

.portal-map-house-marker .house-marker-shadow {
    fill: none;
    stroke: rgba(15, 23, 42, 0.22);
    stroke-linecap: round;
    stroke-width: 4;
}

.portal-map-house-marker .house-marker-roof,
.portal-map-house-marker .house-marker-body {
    fill: #2563eb;
    stroke: #ffffff;
    stroke-linejoin: round;
    stroke-width: 2.4;
}

.portal-map-house-marker.selected .house-marker-roof,
.portal-map-house-marker.selected .house-marker-body {
    fill: #dc2626;
}

.portal-map-house-marker .house-marker-door,
.portal-map-house-marker .house-marker-window {
    fill: #dbeafe;
    stroke: #ffffff;
    stroke-linejoin: round;
    stroke-width: 0.9;
}

.portal-map-house-marker:hover,
.portal-map-house-marker:focus-visible {
    filter: drop-shadow(0 5px 10px rgba(16, 24, 40, 0.34));
    transform: translateY(-1px);
}

.portal-map-house-marker.selected {
    filter: drop-shadow(0 5px 11px rgba(185, 28, 28, 0.34));
}

.portal-map-house-marker:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 3px;
}

.portal-map .maplibregl-popup-content {
    display: grid;
    gap: 4px;
    max-width: 260px;
    padding: 12px 14px;
    color: var(--text);
    border-radius: 8px;
}

.portal-map .maplibregl-popup-content span,
.portal-map .maplibregl-popup-content small {
    display: block;
    color: var(--muted);
}

.map-popup-action {
    display: inline-flex;
    justify-content: center;
    margin-top: 6px;
    padding: 7px 9px;
    color: #ffffff;
    background: var(--brand);
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 700;
}

.map-popup-action:hover {
    color: #ffffff;
    background: var(--brand-dark);
}

.stack-list {
    display: grid;
    gap: 10px;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    border-bottom: 0;
}

.status-pill {
    display: inline-flex !important;
    align-items: center;
    width: fit-content;
    padding: 5px 9px;
    color: #155e75 !important;
    background: #ecfeff;
    border: 1px solid #a5f3fc;
    border-radius: 999px;
    font-size: 0.78rem !important;
    font-weight: 700;
    white-space: nowrap;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

/* ── Startseite: Kachelraster ─────────────────────────────── */
.nav-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 8px;
}

.nav-tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 24px 20px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.12s;
    cursor: pointer;
    overflow: hidden;
    word-break: break-word;
    min-width: 0;
}

.nav-tile:hover {
    border-color: var(--brand);
    box-shadow: 0 4px 18px color-mix(in srgb, var(--brand) 14%, transparent);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--text);
}

.nav-tile.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-tile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--icon-bg);
    border: 2px solid var(--icon-border);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.08);
    color: var(--icon-ink);
    flex-shrink: 0;
}

.nav-tile-icon svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
    stroke: none;
}

.nav-tile strong {
    font-size: 0.97rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
}

.nav-tile span {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
}

.nav-tile strong.nav-tile-title--stacked,
.nav-tile span.nav-tile-count-label {
    white-space: pre-line;
    word-break: normal;
    overflow-wrap: normal;
}

.nav-tile-count {
    display: block;
    margin-top: auto;
    padding-top: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand);
    white-space: normal;
    word-break: break-word;
}

.nav-tile-unit-hint {
    font-size: 0.76rem;
    color: var(--muted);
    font-style: italic;
    margin-top: auto;
}

/* Kachel-Hintergrundfarben */
.tile-color-1 { background: #f9f9f9; border-color: #e0e0e0; }
.tile-color-1:hover { border-color: #aaa; }
.tile-color-2 { background: #f5f5f5; border-color: #ddd; }
.tile-color-2:hover { border-color: #999; }
.tile-color-3 { background: #f7f7f7; border-color: #e2e2e2; }
.tile-color-3:hover { border-color: #aaa; }
.tile-color-4 { background: #f4f4f4; border-color: #ddd; }
.tile-color-4:hover { border-color: #999; }
.tile-color-5 { background: #f6f6f6; border-color: #e0e0e0; }
.tile-color-5:hover { border-color: #aaa; }
.tile-color-6 { background: #f8f8f8; border-color: #e2e2e2; }
.tile-color-6:hover { border-color: #aaa; }
.tile-color-7 { background: #f5fbff; border-color: #cfe8fa; }
.tile-color-7:hover { border-color: #0f6faf; }
.tile-color-8 { background: #f6f8f5; border-color: #d6e4d2; }
.tile-color-8:hover { border-color: #6a8f62; }
.tile-color-warning { background: #fffbeb; border-color: #fde68a; }
.tile-color-warning:hover { border-color: #f59e0b; }

.tile-loading {
    padding: 24px 0;
    color: var(--muted);
}
/* ─────────────────────────────────────────────────────────── */

.calendar-grid {
    display: grid;
    gap: 12px;
}

/* ── Liegenschaft Schnellerfassung ───────────────────────── */
.pq-shell {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.pq-choice-panel {
    display: grid;
    gap: 12px;
    max-width: 760px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.pq-choice-panel h2,
.pq-choice-panel p {
    margin: 0;
}

.pq-choice-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pq-steps,
.pq-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.pq-steps {
    display: grid;
    gap: 6px;
    padding: 10px;
}

.pq-step {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    padding: 10px;
    text-align: left;
    color: var(--text);
}

.pq-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #eef2f7;
    color: var(--muted);
    font-weight: 700;
}

.pq-step.active {
    border-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 8%, #fff);
}

.pq-step.done span,
.pq-step.active span {
    background: var(--brand);
    color: #fff;
}

.pq-panel {
    padding: 20px;
}

.pq-section h2 {
    margin: 0 0 16px;
    font-size: 1.15rem;
}

.pq-ai-import {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 8px;
    background: #f8fbff;
}

.pq-ai-import p {
    margin: 4px 0;
    color: #475569;
}

.pq-ai-import small {
    color: #64748b;
}

.pq-ai-import-button {
    position: relative;
    overflow: hidden;
    flex: 0 0 auto;
}

.pq-ai-import-button input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

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

.pq-form-grid label,
.pq-unit-row label,
.pq-unit-fields label {
    display: grid;
    gap: 6px;
}

.pq-form-grid label span,
.pq-unit-row label span,
.pq-unit-fields label span {
    font-size: 0.82rem;
    color: var(--muted);
}

.pq-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pq-label em,
.pq-th-optional {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--brand);
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 800;
    line-height: 1;
}

.pq-th-optional {
    margin-left: 4px;
    background: #f2f4f7;
    color: var(--muted);
    text-transform: none;
}

.pq-question-list {
    display: grid;
    gap: 10px;
}

.pq-check {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.pq-unit-list {
    display: grid;
    gap: 10px;
}

.pq-unit-row {
    display: grid;
    grid-template-columns: 110px minmax(160px, 1fr) 120px 140px;
    gap: 12px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.pq-unit-card {
    display: grid;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.pq-unit-card--closed {
    gap: 0;
}

.pq-unit-card--common {
    background: #f8fbff;
    border-color: #bfdbfe;
}

.pq-unit-card-head,
.pq-room-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pq-unit-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.pq-unit-toggle > span:last-child {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.pq-unit-toggle strong,
.pq-unit-toggle small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pq-unit-toggle small {
    color: var(--muted);
    font-size: 0.82rem;
}

.pq-current-unit {
    display: grid;
    gap: 4px;
    margin-bottom: 14px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.pq-current-unit span {
    color: var(--muted);
    font-size: 0.82rem;
}

.pq-unit-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 12px;
}

.pq-room-table-wrap {
    overflow-x: auto;
}

.pq-room-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.pq-room-table th,
.pq-room-table td {
    padding: 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.pq-room-table th {
    color: var(--muted);
    font-weight: 700;
    background: #f8fafc;
}

.pq-room-table .text-input {
    min-height: 34px;
    padding: 6px 8px;
}

.pq-icon-button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--muted);
    font-size: 1.2rem;
    line-height: 1;
}

.pq-icon-button:hover {
    border-color: #ef4444;
    color: #b91c1c;
}

.pq-review {
    display: grid;
    gap: 10px;
    margin: 0;
}

.pq-review div {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.pq-review dt {
    color: var(--muted);
}

.pq-review dd {
    margin: 0;
}

.pq-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.portal-alert {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 14px;
}

.portal-alert.success {
    background: #ecfdf3;
    color: #166534;
}

.portal-alert.error {
    background: #fef2f2;
    color: #991b1b;
}

.portal-alert.warning {
    background: #fffbeb;
    color: #92400e;
}

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

    .pq-form-grid,
    .pq-unit-row,
    .pq-unit-fields,
    .pq-review div {
        grid-template-columns: 1fr;
    }
}

.calendar-item {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 16px;
    align-items: center;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.calendar-date {
    display: grid;
    min-height: 62px;
    place-items: center;
    color: var(--calendar-color, #0f766e);
    background: color-mix(in srgb, var(--calendar-color, #0f766e) 10%, #ffffff);
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--calendar-color, #0f766e) 26%, #ffffff);
}

.calendar-date strong {
    font-size: 1.6rem;
}

.calendar-date span,
.calendar-item span {
    color: var(--muted);
}

.calendar-content {
    display: grid;
    gap: 5px;
}

.calendar-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.calendar-meta span {
    width: fit-content;
    padding: 4px 8px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.78rem;
}

.calendar-month-header {
    padding: 6px 4px 2px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    margin-top: 8px;
}

.calendar-month-header:first-child {
    margin-top: 0;
}

.calendar-item--today {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.calendar-item--today .calendar-date {
    color: var(--brand-dark);
    background: color-mix(in srgb, var(--brand) 16%, #ffffff);
    border-color: color-mix(in srgb, var(--brand) 40%, #ffffff);
}

.calendar-item--past {
    opacity: 0.55;
}

.calendar-today-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--brand-dark);
    background: var(--brand-soft);
    border: 1px solid color-mix(in srgb, var(--brand) 30%, #ffffff);
    border-radius: 999px;
    vertical-align: middle;
}

.calendar-empty {
    padding: 18px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

/* ── Nutzerwechsel ─────────────────────────────────────────── */

.nw-section {
    display: grid;
    gap: 20px;
}

.nw-rolle-group {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.nw-rolle-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    font-size: 0.88rem;
}

.nw-rolle-badge {
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--brand-soft);
    color: var(--brand-dark);
    border: 1px solid color-mix(in srgb, var(--brand) 25%, #fff);
}

.nw-lage {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 400;
}

.nw-chain {
    display: grid;
    gap: 0;
}

.nw-row {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 0;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background 0.1s;
}

.nw-row:last-child {
    border-bottom: none;
}

.nw-row:hover {
    background: var(--surface-soft);
}

.nw-row--active {
    background: var(--brand-soft);
    border-left: 3px solid var(--brand);
}

.nw-row--past {
    opacity: 0.55;
}

.nw-row--leerstand .nw-row-name {
    color: var(--muted);
    font-style: italic;
}

.nw-row-idx {
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    color: var(--muted);
    background: var(--surface-soft);
    border-right: 1px solid var(--line);
    min-height: 52px;
    font-weight: 700;
}

.nw-row-body {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
}

.nw-row-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.nw-row-dates {
    font-size: 0.78rem;
    color: var(--muted);
}

.nw-row-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nw-badge {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--muted);
}

.nw-badge--warn {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 30%, #fff);
}

.nw-badge--new {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.nw-badge--deleted {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 25%, #fff);
    text-decoration: line-through;
}

.nw-badge--historic {
    background: #f1f5f9;
    color: #64748b;
    border-color: #cbd5e1;
    font-style: italic;
}

.nw-row--historic {
    opacity: 0.72;
    background: #f8fafc;
}

.nw-row--historic .nw-row-name {
    color: var(--muted);
}

.nw-expand-toggle {
    display: block;
    width: 100%;
    padding: 6px 16px;
    font-size: 0.8rem;
    color: var(--accent);
    background: transparent;
    border: none;
    border-top: 1px dashed var(--line);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.nw-expand-toggle:hover {
    background: var(--surface-soft);
}

.nw-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface-soft);
}

.nw-editor {
    padding: 16px;
    border-top: 2px solid var(--brand);
    background: var(--surface);
}

.nw-editor-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--brand-dark);
}

.nw-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.nw-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 3px;
}

.nw-field input,
.nw-field select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    box-sizing: border-box;
}

.nw-field input:focus,
.nw-field select:focus {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
    border-color: var(--brand);
}

.nw-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.9rem;
}

.nw-contact-services {
    min-width: 210px;
}

.nw-service-dropdown {
    position: relative;
    width: 100%;
}

.nw-service-dropdown summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 39px;
    padding: 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    list-style: none;
    box-sizing: border-box;
}

.nw-service-dropdown summary::-webkit-details-marker {
    display: none;
}

.nw-service-dropdown summary::after {
    content: "v";
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.72rem;
}

.nw-service-dropdown[open] summary {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 18%, transparent);
}

.nw-service-dropdown summary span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.nw-service-dropdown summary strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nw-service-list {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}

.nw-service-option {
    display: flex !important;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 28px;
    padding: 5px 6px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    box-sizing: border-box;
}

.nw-service-option input {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    min-height: 14px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-sizing: border-box;
}

.nw-service-option span {
    min-width: 0;
    align-self: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nw-service-option:has(input:checked) {
    color: var(--brand);
    background: color-mix(in srgb, var(--brand) 8%, transparent);
}

.nw-service-option:has(input:disabled) {
    color: var(--muted);
}

.nw-errors {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--danger-soft);
    border: 1px solid color-mix(in srgb, var(--danger) 25%, #fff);
    border-radius: 6px;
    color: var(--danger);
    font-size: 0.85rem;
}

.nw-errors ul {
    margin: 4px 0 0 16px;
    padding: 0;
}

.nw-success {
    margin-top: 12px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    color: #166534;
    font-size: 0.85rem;
}

.nw-save-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
    margin-top: 14px;
}

.login-shell {
    min-height: calc(100vh - 56px);
    display: grid;
    place-items: center;
}

.login-panel {
    width: min(520px, calc(100vw - 32px));
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: none;
}

.login-panel form {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.login-panel label {
    font-weight: 700;
}

.text-input {
    min-height: 44px;
    padding: 10px 12px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.text-input:focus,
.language-switch select:focus {
    border-color: var(--brand);
    outline: 3px solid var(--brand-soft);
}

.table-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.table-search {
    width: 100%;
    max-width: 380px;
}

.table-panel {
    overflow-x: auto;
}

.portal-table {
    width: 100%;
    min-width: 880px;
    border-collapse: collapse;
}

.portal-table th,
.portal-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.portal-table th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    background: #f8fafc;
}

.portal-table tr:last-child td {
    border-bottom: 0;
}

.portal-table tbody tr:hover {
    background: #fbfcfd;
}

.billing-period-cell {
    font-weight: 700;
    white-space: nowrap;
}

.muted-cell {
    color: var(--muted);
}

.archive-period-header td {
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: none;
}

.archive-period-header.clickable {
    cursor: pointer;
    user-select: none;
}

.archive-period-header.clickable:hover td {
    filter: brightness(0.95);
}

.archive-period-header.has-period td {
    background: var(--accent-soft, #eff6ff);
    color: var(--accent, #2563eb);
    border-top: 2px solid var(--accent, #2563eb);
}

.archive-period-header.no-period td {
    background: #f1f5f9;
    color: var(--muted, #64748b);
    border-top: 1px solid var(--line, #e2e8f0);
}

.period-toggle-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 0.65rem;
    vertical-align: middle;
    transition: transform 0.15s;
}

.period-doc-count {
    margin-left: 8px;
    font-weight: 400;
    opacity: 0.7;
    font-size: 0.75rem;
}

.table-action {
    display: inline-block;
    padding: 8px 10px;
    color: var(--accent);
    background: var(--accent-soft);
}

.upload-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    margin-bottom: 18px;
}

.upload-message {
    color: var(--accent) !important;
    font-weight: 700;
}

.upload-message.error-message {
    color: #b42318 !important;
}

.validation-message {
    color: #b42318;
    font-weight: 700;
}

#blazor-error-ui {
    color-scheme: light only;
    background: #fff7ed;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.loading-progress circle:last-child {
    stroke: var(--brand);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Loading");
}

@media (max-width: 1700px) {
    .portal-app-header {
        grid-template-columns: minmax(260px, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "brand actions"
            "logo logo";
        row-gap: 6px;
        padding: 8px 24px;
    }

    .app-header-logo {
        width: 100%;
        pointer-events: auto;
    }

    .app-header-actions {
        gap: 8px;
    }

    .we-band {
        top: 94px;
    }
}

@media (max-width: 980px) {
    .portal-app-header {
        grid-template-columns: 1fr;
        grid-template-areas:
            "brand"
            "logo"
            "actions";
        padding: 10px 16px;
    }

    .app-header-brand,
    .app-header-actions {
        justify-self: stretch;
    }

    .app-header-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .we-band {
        top: 138px;
    }

    .portal-header,
    .upload-panel,
    .list-row {
        align-items: stretch;
        flex-direction: column;
    }

    .tenant-ticket-card,
    .tenant-ticket-data,
    .tenant-ticket-filters,
    .ticket-detail-grid,
    .ticket-detail-facts {
        grid-template-columns: 1fr;
    }

    .ticket-protocol-row {
        grid-template-columns: 1fr;
    }

    .metric-grid,
    .quick-grid,
    .portal-grid.two-columns,
    .nav-tile-grid,
    .nav-tile-grid--start-level {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .nav-tile-grid,
    .nav-tile-grid--start-level {
        grid-template-columns: 1fr;
    }
}

/* -- Archiv: Paginierung ------------------------------ */
.pagination-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 20px;
    flex-wrap: wrap;
}

.pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pagination-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--brand) 10%, #fff);
    border-color: var(--brand);
    color: var(--brand);
}

.pagination-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
    cursor: default;
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-info {
    margin-left: 8px;
    font-size: 0.82rem;
    color: var(--text-muted, #888);
}

/* -- Archiv: Dateigr��e-Spalte ------------------------- */
.archive-size {
    white-space: nowrap;
    font-size: 0.82rem;
    color: var(--text-muted, #888);
    text-align: right;
}

/* ?? Kostenerfassung ???????????????????????????????????????????????? */
.ke-period-panel {
    padding: 0.6rem 1rem;
}

.ke-period-heading {
    margin: 0 0 0.5rem 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.ke-periode-select {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-width: 400px;
}

.ke-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ke-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text);
}

.ke-period-context {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    flex-wrap: wrap;
}

.ke-view-switch {
    display: inline-flex;
    align-self: end;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
}

.ke-view-switch-btn {
    border: 0;
    border-right: 1px solid var(--line-strong);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.48rem 0.8rem;
}

.ke-view-switch-btn:last-child {
    border-right: 0;
}

.ke-view-switch-btn.active {
    background: var(--brand);
    color: #fff;
}

.ke-task-status-groups {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.65rem;
}

.ke-task-status-group {
    display: inline-flex;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.ke-task-status-group-prerequisites {
    background: linear-gradient(90deg, #f8fbff 0%, #fff 100%);
    border-color: #bfdbfe;
}

.ke-task-status-group-calculation {
    background: linear-gradient(90deg, #f7fef9 0%, #fff 100%);
    border-color: #bbf7d0;
}

.ke-task-status-group-result {
    background: linear-gradient(90deg, #fffdf5 0%, #fff 100%);
    border-color: #fde68a;
}

.ke-task-status-group-title {
    display: inline-flex;
    align-items: center;
    max-width: 6.8rem;
    padding: 0 0.25rem;
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.15;
    text-transform: uppercase;
}

.ke-task-status-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    align-items: center;
    flex: 1 1 auto;
}

.ke-task-status-operator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    color: var(--brand);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
}

.ke-task-status-operator-flow {
    min-width: 5.4rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

.ke-task-status-operator-result {
    margin-left: 0.45rem;
    min-width: 1.75rem;
    font-size: 1.35rem;
}

.ke-task-status-operator-group {
    align-self: center;
    min-width: 1.35rem;
    margin: 0 -0.05rem;
    opacity: 0.8;
}

.ke-task-status-tile {
    min-height: 48px;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-strong);
    border-radius: 7px;
    background: var(--surface);
    min-width: 7.1rem;
}

.ke-task-status-tile.done {
    border-left-color: #16a34a;
}

.ke-task-status-tile.active {
    border-left-color: var(--brand);
}

.ke-task-status-tile.paused {
    border-left-color: #d97706;
}

.ke-task-status-tile.missing {
    opacity: 0.7;
}

.ke-task-status-title {
    display: block;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ke-task-status-tile strong {
    display: block;
    margin-top: 0.12rem;
    font-size: 0.8rem;
}

.ke-task-status-tile small {
    display: block;
    margin-top: 0.08rem;
    color: var(--muted);
    font-size: 0.68rem;
}

@media (max-width: 560px) {
    .ke-task-status-groups {
        flex-direction: column;
    }

    .ke-task-status-row {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .ke-task-status-operator-group {
        transform: rotate(90deg);
    }
}
.ke-step-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.ke-step-tile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 72px;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(16, 24, 40, 0.03);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.15s;
}

.ke-step-tile > span:last-child {
    flex: 1 1 auto;
    min-width: 0;
}

.ke-step-tile:hover,
.ke-step-tile.active {
    border-color: var(--brand);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.ke-step-tile.active {
    background: color-mix(in srgb, var(--brand) 7%, var(--surface));
    outline: 2px solid rgba(0, 94, 166, 0.08);
}

.ke-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
}

.ke-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--icon-bg);
    color: var(--icon-ink);
}

.ke-step-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ke-step-tile strong {
    display: block;
    font-size: 0.92rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.ke-step-tile small {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.ke-step-tile small.ke-selected-period-text {
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 700;
}

@media (max-width: 980px) {
    .ke-step-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    }
}

@media (max-width: 560px) {
    .ke-step-tile {
        align-items: flex-start;
    }
}

.portal-guidance-panel {
    margin: 0 0 1rem;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    background: #fffbeb;
}

.portal-guidance-panel.collapsed {
    background: #fffbeb;
}

.portal-guidance-shell {
    display: flex;
    align-items: stretch;
    gap: 0.85rem;
    padding: 0.8rem 0.95rem 0.9rem;
}

.portal-guidance-icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 3.25rem;
    width: 3.25rem;
    height: 3.25rem;
    border: 0;
    border-radius: 10px;
    background: var(--icon-bg);
    color: var(--icon-ink);
    cursor: pointer;
}

.portal-guidance-topic-icon svg {
    display: block;
    width: 2rem;
    height: 2rem;
    fill: currentColor;
    stroke: none;
}

.portal-guidance-state {
    position: absolute;
    right: -0.2rem;
    bottom: -0.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    background: #16a34a;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1;
}

.portal-guidance-main {
    flex: 1;
    min-width: 0;
}

.portal-guidance-toggle {
    display: flex;
    align-items: flex-start;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    padding: 0;
    text-align: left;
}

.portal-guidance-icon {
    display: none;
}

.portal-guidance-heading {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.portal-guidance-heading strong {
    font-size: 0.92rem;
}

.portal-guidance-heading small {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.portal-guidance-body {
    padding: 0.55rem 0 0;
}

.portal-guidance-body p {
    margin: 0;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.5;
}

.portal-guidance-body p + p {
    margin-top: 0.45rem;
}

.portal-guidance-link-row {
    margin-top: 0.55rem !important;
}

.portal-guidance-link {
    display: inline-flex;
    align-items: center;
    border: 1px solid #16a34a;
    border-radius: 6px;
    padding: 0.28rem 0.55rem;
    background: #fff;
    color: #047857;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
}

.portal-guidance-link:hover {
    background: #dcfce7;
}

.we-guidance {
    padding: 0 24px 12px;
}

.we-guidance .portal-guidance-panel {
    margin: 0;
}

.ke-step-panel {
    margin-top: 0.75rem;
}

.ke-step-panel h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.ke-settings-grid,
.ke-settings-fuel-grid,
.ke-settings-costblocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.ke-settings-fuel,
.ke-settings-versorgung {
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.ke-settings-costblocks {
    margin-top: 0;
}

.ke-settings-fuel h3,
.ke-settings-versorgung h3,
.ke-settings-costblocks h3 {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ke-settings-wide {
    grid-column: span 2;
}

.ke-switch-field {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.35rem;
    color: var(--text);
    font-weight: 600;
}

.ke-switch-field input {
    width: 2.4rem;
    height: 1.25rem;
    accent-color: var(--brand);
}

@media (max-width: 760px) {
    .ke-settings-wide {
        grid-column: span 1;
    }
}

.ke-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0 1.5rem;
    border-bottom: 2px solid var(--line);
    margin-top: 1.25rem;
}

.ke-tab {
    padding: 0.55rem 1.1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.15s;
}

.ke-tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
    font-weight: 600;
}

.ke-tab:hover:not(.active) {
    color: var(--text);
}

.ke-tab-badge {
    background: var(--brand);
    color: #fff;
    border-radius: 999px;
    font-size: 0.68rem;
    padding: 0.1em 0.55em;
    font-weight: 700;
}

.ke-tab-content {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.ke-empty {
    color: var(--muted);
    font-style: italic;
    padding: 0.75rem 0;
}

.ke-position {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--surface-soft);
    transition: opacity 0.2s;
}

.ke-position-deleted {
    opacity: 0.45;
    border-style: dashed;
}

.ke-position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.ke-position-label {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ke-badge-neu {
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 999px;
    font-size: 0.68rem;
    padding: 0.1em 0.6em;
    font-weight: 700;
}

.ke-btn-delete {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: color 0.15s;
}

.ke-btn-delete:hover {
    color: #e53e3e;
}

.ke-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.ke-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 140px;
}

.ke-field label,
.ke-field > span {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ke-field-wide {
    flex: 1 1 220px;
}

.ke-input {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    width: 100%;
}

.ke-input:focus {
    outline: 2px solid var(--brand);
    border-color: var(--brand);
}

.ke-btn-add {
    margin-top: 0.6rem;
    padding: 0.5rem 1rem;
    border: 1.5px dashed var(--brand);
    background: none;
    color: var(--brand);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s;
}

.ke-btn-add:hover {
    background: #e8f0fe;
}
.ke-btn-add:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ke-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 0 0.5rem;
}

.ke-btn-save {
    padding: 0.6rem 1.6rem;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.ke-btn-save:hover:not(:disabled) {
    background: var(--brand-dark);
}

.ke-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ke-btn-secondary {
    padding: 0.6rem 1.1rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.ke-btn-check {
    background: var(--surface);
    color: var(--brand);
    border: 1px solid var(--brand);
}

.ke-btn-check:hover:not(:disabled) {
    background: #e8f0fe;
}

.portal-checkmark {
    color: #16a34a;
    font-weight: 800;
    margin-right: 0.35rem;
}

.ke-alert {
    border-radius: 7px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.ke-alert-ok {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.ke-alert-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.ke-finish-document {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid #bfdbfe;
    border-left: 4px solid var(--brand);
    border-radius: 7px;
    background: #eff6ff;
}

.ke-finish-document--actions-only {
    justify-content: flex-start;
}

.ke-finish-document-main {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.ke-finish-document-main strong {
    font-size: 0.95rem;
    color: var(--text, #111827);
}

.ke-finish-document-main span {
    overflow: hidden;
    color: var(--muted, #6b7280);
    font-size: 0.88rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ke-finish-document-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.5rem;
}

.ke-document-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.35rem;
    border-radius: 7px;
    padding: 0 1rem;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ke-document-btn svg {
    width: 1.05rem;
    height: 1.05rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ke-document-context {
    font-weight: 800;
}

.ke-document-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ke-document-btn-create {
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
}

.ke-document-btn-create:hover:not(:disabled) {
    border-color: var(--brand-dark);
    background: var(--brand-dark);
}

.ke-document-btn-preview {
    border: 1px solid var(--brand);
    background: #fff;
    color: var(--brand);
}

.ke-document-btn-preview:hover:not(:disabled) {
    background: #dbeafe;
}

.ke-document-btn-download {
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
}

.ke-document-btn-download:hover:not(:disabled) {
    border-color: var(--brand-dark);
    background: var(--brand-dark);
}

.ke-billing-progress {
    margin: 1rem 0 1.25rem;
    padding: 1rem;
    border: 1px solid #dbeafe;
    border-radius: 7px;
    background: #f8fafc;
}

.ke-billing-progress-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.65rem;
    color: var(--text, #111827);
}

.ke-billing-progress-head strong {
    font-size: 0.95rem;
}

.ke-billing-progress-head span {
    min-width: 3.5rem;
    text-align: right;
    font-weight: 700;
    color: var(--brand);
}

.ke-billing-progress-track {
    height: 0.55rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

.ke-billing-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), #22c55e);
    transition: width 0.45s ease;
}

.ke-billing-progress p {
    margin: 0.65rem 0 0;
    color: var(--muted, #6b7280);
    font-size: 0.88rem;
}

/* ── Plausi-Meldungs-Grid ──────────────────────────────────────────────── */
.ke-plausi-section {
    margin-top: 1.5rem;
}

.ke-plausi-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text, #111827);
}

.ke-plausi-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ke-plausi-grid th {
    text-align: left;
    padding: 0.45rem 0.75rem;
    background: #f3f4f6;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    color: var(--muted, #6b7280);
    white-space: nowrap;
}

.ke-plausi-grid td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

.ke-plausi-grid tr:last-child td {
    border-bottom: none;
}

.ke-plausi-grid tr.ke-plausi-row-error {
    background: #fef2f2;
}

.ke-plausi-grid tr.ke-plausi-row-warning {
    background: #fffbeb;
}

.ke-plausi-grid tr.ke-plausi-row-ok {
    background: #f0fdf4;
}

.ke-plausi-grid tr.ke-plausi-row-info {
    background: transparent;
}

.ke-plausi-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.ke-plausi-badge-error {
    background: #fca5a5;
    color: #7f1d1d;
}

.ke-plausi-badge-warning {
    background: #fde68a;
    color: #78350f;
}

.ke-plausi-badge-ok {
    background: #bbf7d0;
    color: #14532d;
}

.ke-plausi-badge-info {
    background: #e5e7eb;
    color: #374151;
}

.ke-plausi-col-nr {
    width: 5rem;
    white-space: nowrap;
    color: var(--muted, #6b7280);
    font-size: 0.8rem;
}

.ke-plausi-col-funktion {
    width: 9rem;
    white-space: nowrap;
}

.ke-plausi-col-bedeutung {
    width: 10rem;
}

.ke-plausi-col-meldung {
    min-width: 18rem;
}

.ke-plausi-col-aktion {
    width: 18rem;
}

.ke-plausi-confirm {
    display: grid;
    grid-template-columns: minmax(9rem, 1fr) auto;
    gap: 0.4rem;
    align-items: center;
}

.ke-plausi-confirm-input {
    min-width: 0;
    height: 2rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0 0.55rem;
    font-size: 0.82rem;
    background: #fff;
}

.ke-plausi-confirm-input:focus {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    border-color: #2563eb;
}

.ke-plausi-confirm-btn {
    height: 2rem;
    border: 1px solid #0f766e;
    border-radius: 4px;
    padding: 0 0.65rem;
    background: #0f766e;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.ke-plausi-confirm-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ke-plausi-confirmed {
    color: #166534;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ?? Brennstoff-Bezugspositionen (2. Ebene) ?????????????????????????? */
.ke-rebv-section {
    margin-top: 1.25rem;
    border-top: 1px solid var(--border, #e5e7eb);
    padding-top: 1rem;
}

.ke-rebv-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.ke-rebv-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ke-rebv-add-group {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.ke-rebv-add-btn {
    background: none;
    border: 1px solid var(--primary, #2563eb);
    color: var(--primary, #2563eb);
    border-radius: 4px;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.ke-rebv-add-btn:hover {
    background: #eff6ff;
}

.ke-document-section {
    margin-top: 1rem;
    border-top: 1px solid var(--border, #e5e7eb);
    padding-top: 1rem;
}

.ke-document-upload-row {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.ke-file-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.ke-file-action input[type="file"] {
    display: none;
}

.ke-document-list {
    display: grid;
    gap: 0.5rem;
}

.ke-document-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    padding: 0.55rem 0.65rem;
    background: var(--surface, #fff);
}

.ke-document-main {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.ke-document-main strong,
.ke-document-main span {
    overflow-wrap: anywhere;
}

.ke-document-main span,
.ke-document-message {
    color: var(--muted, #6b7280);
    font-size: 0.82rem;
}

.ke-document-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ke-rebv-table-wrap {
    overflow-x: auto;
}

.ke-rebv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.ke-rebv-table th {
    text-align: left;
    padding: 0.3rem 0.5rem;
    background: var(--bg-subtle, #f9fafb);
    border-bottom: 1px solid var(--border, #e5e7eb);
    white-space: nowrap;
    color: var(--muted, #6b7280);
    font-weight: 600;
}

.ke-rebv-table td {
    padding: 0.2rem 0.4rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
    vertical-align: middle;
}

.ke-rebv-table tr.ke-rebv-deleted {
    opacity: 0.45;
    text-decoration: line-through;
}

.ke-rebv-table th.ke-user-value-column,
.ke-rebv-table td.ke-user-value-column,
.ke-rebv-table th.ke-user-abs-cell,
.ke-rebv-table td.ke-user-abs-cell {
    background: rgba(0, 94, 166, 0.05);
    background: color-mix(in srgb, var(--brand) 5%, transparent);
}

.ke-rebv-table th.ke-user-abs-column-alt,
.ke-rebv-table td.ke-user-abs-column-alt {
    background: rgba(0, 94, 166, 0.1);
    background: color-mix(in srgb, var(--brand) 10%, transparent);
}

.ke-abs-header {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: max-content;
}

.ke-abs-edit-btn {
    width: 1.45rem;
    height: 1.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--surface);
    color: var(--brand);
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
}

.ke-abs-edit-btn:hover {
    background: color-mix(in srgb, var(--brand) 8%, var(--surface));
}

.ke-rebv-table td.ke-user-abs-cell:focus-within,
.ke-rebv-table td.ke-user-advance-cell:focus-within {
    background: #fff5f5;
    box-shadow: inset 0 0 0 2px #d92d20;
}

.ke-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.28);
}

.ke-small-dialog {
    width: min(420px, 100%);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22);
}

.ke-small-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

.ke-small-dialog-head h3 {
    margin: 0;
    font-size: 1rem;
}

.ke-small-dialog-body {
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
}

.ke-small-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    padding: 0 1rem 1rem;
}

.ke-user-advance-input:focus {
    border-color: #d92d20;
    outline: 2px solid #d92d20;
}

.mr-period-panel {
    margin-bottom: 14px;
}

.mr-period-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.mr-filter-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.mr-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
}

.mr-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    color: var(--text, #111827);
    font-size: 0.9rem;
    font-weight: 600;
}

.mr-filter input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent, #005eaa);
}

.mr-reading-list {
    display: grid;
    gap: 14px;
}

.mr-unit-panel {
    padding: 0;
    overflow: hidden;
}

.mr-unit-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--line, #e5e7eb);
    background: var(--surface, #fff);
    color: var(--text, #111827);
    text-align: left;
    cursor: pointer;
}

.mr-unit-panel--closed .mr-unit-header {
    border-bottom: 0;
}

.mr-unit-header:hover {
    background: #f8fafc;
}

.mr-unit-header span {
    color: var(--muted, #6b7280);
    font-size: 0.82rem;
}

.mr-unit-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.mr-unit-title strong {
    color: var(--text, #111827);
    font-size: 0.9rem;
}

.mr-accordion-icon {
    width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line, #e5e7eb);
    border-radius: 5px;
    background: var(--icon-bg);
    color: var(--icon-ink);
    font-size: 1rem;
    line-height: 1;
}

.mr-table-wrap {
    overflow-x: auto;
}

.mr-table {
    width: 100%;
    min-width: 1320px;
    border-collapse: collapse;
    font-size: 0.86rem;
    table-layout: fixed;
}

.mr-table--normal {
    min-width: 1260px;
}

.mr-col-position { width: 13rem; }
.mr-col-device { width: 17rem; }
.mr-table--normal .mr-col-device { width: 17rem; }
.mr-col-type { width: 14rem; }
.mr-col-source { width: 13rem; }
.mr-col-kind { width: 22rem; }
.mr-col-masterdata { width: 18rem; }
.mr-col-prior { width: 18rem; }
.mr-table--normal .mr-col-prior { width: 16rem; }
.mr-col-current { width: 23rem; }
.mr-table--normal .mr-col-current { width: 20rem; }
.mr-col-confirm { width: 6rem; }
.mr-col-actions { width: 4.5rem; }

.mr-table th,
.mr-table td {
    padding: 5px 8px;
    border-bottom: 1px solid var(--line, #e5e7eb);
    border-right: 1px solid var(--line, #e5e7eb);
    vertical-align: top;
}

.mr-table th {
    text-align: left;
    background: #f8fafc;
    color: var(--text, #111827);
    white-space: nowrap;
}

.mr-position-cell,
.mr-device-cell {
    background: #eef8ff;
}

.mr-position-cell strong,
.mr-device-cell strong,
.mr-position-cell span,
.mr-device-cell span {
    display: block;
}

.mr-device-lines {
    display: grid;
    gap: 3px;
}

.mr-device-line {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.mr-device-cell .mr-device-line > span,
.mr-device-cell .mr-device-title-copy {
    display: inline-grid;
}

.mr-device-cell .mr-device-line > strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mr-device-icon-shell {
    display: inline-grid !important;
    width: 22px;
    height: 22px;
    min-width: 22px;
    max-width: 22px;
    min-height: 22px;
    max-height: 22px;
    place-items: center;
    overflow: hidden;
}

.mr-device-icon-shell.room {
    color: #171635;
}

.mr-room-icon {
    display: block;
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
    fill: currentColor;
}

.mr-tree-icon {
    display: block;
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
    object-fit: contain;
    filter: contrast(1.16) saturate(.65);
}

.mr-device-title-copy {
    min-width: 0;
    gap: 1px;
}

.mr-device-title-copy strong,
.mr-device-title-copy span {
    overflow-wrap: normal;
    word-break: normal;
}

.mr-device-tags {
    display: flex !important;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
}

.mr-device-tags em {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid #8fc5f4;
    border-radius: 4px;
    background: #f8fbff;
    color: #0f3654;
    font-style: normal;
    font-weight: 700;
}

.mr-device-tags em.mr-device-flag {
    border-color: #d0d5dd;
    background: #f2f4f7;
    color: #344054;
}

.mr-device-tags em.mr-device-flag.warning {
    border-color: #fdb022;
    background: #fffaeb;
    color: #93370d;
}

.mr-device-tags em.mr-device-flag.blocked {
    border-color: #f04438;
    background: #fff5f5;
    color: #912018;
}

.mr-input {
    min-height: 28px;
    width: 100%;
    min-width: 130px;
    padding: 3px 6px;
    border: 1px solid var(--line, #d0d7de);
    border-radius: 4px;
    background: #fff;
}

.mr-date {
    min-width: 142px;
}

.mr-value {
    min-width: 130px;
}

.mr-factor {
    min-width: 100px;
}

.mr-masterdata-cell {
    background: #fff;
}

.mr-entry-cell {
    background: #fff;
}

.mr-entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 6px;
    align-items: start;
}

.mr-entry-grid label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    min-width: 0;
}

.mr-entry-grid label span {
    color: var(--muted, #6b7280);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.mr-masterdata-stack {
    display: grid;
    gap: 8px;
}

.mr-masterdata-stack label {
    display: grid;
    gap: 4px;
}

.mr-masterdata-stack label span {
    color: var(--muted, #6b7280);
    font-size: 0.76rem;
    font-weight: 700;
}

.mr-prior-cell,
.mr-current-cell {
    color: var(--muted, #6b7280);
    white-space: nowrap;
}

.mr-reading-pair {
    display: grid;
    grid-template-columns: minmax(142px, 1fr) minmax(130px, 1fr);
    gap: 6px;
}

.mr-value-with-plausi {
    display: grid;
    gap: 3px;
    min-width: 130px;
}

.mr-confirm-cell {
    text-align: center;
}

.mr-confirm-cell label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.76rem;
    font-weight: 700;
}

.mr-confirm-cell input {
    width: 16px;
    height: 16px;
    accent-color: #16a34a;
}

.mr-plausi-text {
    display: block;
    margin-top: 3px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.mr-row-warning td {
    background: #fffaeb;
}

.mr-row-error td {
    background: #fff1f3;
}

.mr-row-confirmed td {
    background: #f0fdf4;
}

.mr-action-cell {
    position: sticky;
    right: 0;
    z-index: 1;
    background: #fff;
    white-space: nowrap;
    width: 72px;
}

.mr-icon-button {
    border: 0;
    background: transparent;
    color: var(--accent, #005eaa);
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1;
    padding: 6px;
    cursor: pointer;
}

.mr-icon-button.danger {
    color: #d92d20;
}

.ke-user-unit-cell {
    position: relative;
    transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.ke-user-unit-cell-active {
    background: #fff5f5;
    box-shadow: inset 0 0 0 2px #d92d20;
}

.ke-rebv-input {
    padding: 0.2rem 0.4rem;
    font-size: 0.82rem;
    min-width: 80px;
}

.ke-rebv-narrow {
    min-width: 50px;
    max-width: 70px;
}

.ke-rebv-wide {
    min-width: 160px;
}

.ke-abs-periods {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 210px;
}

.ke-abs-period-row {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.ke-abs-period-row .ke-input {
    width: auto;
    min-width: 0;
    height: 28px;
    padding: 0.15rem 0.35rem;
}

.ke-abs-date-row,
.ke-abs-action-row {
    display: grid;
    gap: 0.25rem;
    align-items: center;
}

.ke-abs-date-row {
    grid-template-columns: minmax(92px, 1fr) minmax(92px, 1fr);
}

.ke-abs-action-row {
    grid-template-columns: minmax(64px, 1fr) 28px 28px;
}

.ke-abs-period-row .ke-date-input {
    min-width: 92px;
}

.ke-abs-value-input {
    min-width: 64px;
}

.ke-abs-icon-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ke-abs-add-btn {
    width: 32px;
    height: 28px;
    margin-top: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.ke-abs-delete-btn {
    color: #b42318;
    background: #fef3f2;
}

.ke-abs-delete-btn:hover {
    color: #7a271a;
    background: #fee4e2;
}
