/*
 * Projektkommentar: Stylesheet fuer die projektspezifische Oberflaeche.
 * Abschnittskommentare erklaeren Layoutbereiche statt einzelne CSS-Zeilen.
 */

:root {
    --bg-body: #18222d;
    --bg-card: #202c39;
    --bg-muted: #243140;
    --bg-header: linear-gradient(135deg, #244769 0%, #2f5f8e 100%);
    --bg-header-soft: #263850;

    --text-main: #e7eef6;
    --text-soft: #afbccb;
    --text-light: #ffffff;

    --border-color: #3a4b5f;
    --border-strong: #53677d;

    --primary: #60a5fa;
    --primary-dark: #93c5fd;
    --primary-soft: #2d4666;

    --success-bg: #123524;
    --success-text: #86efac;

    --danger-bg: #3b1618;
    --danger-text: #fca5a5;

    --warning-bg: #3b2a12;
    --warning-text: #fcd34d;

    --info-bg: #132f4c;
    --info-text: #93c5fd;

    --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.28);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 18px;

    --transition-fast: 0.18s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-weight: 400;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    margin: 0;
    padding: 0;
}

strong,
b {
    font-weight: 600;
    text-shadow: none;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
}

a:hover,
a:focus {
    color: var(--primary);
    text-decoration: none;
}

/* Layoutgeruest: definiert die stabile Seitenstruktur fuer Navigation und Inhalt. */
.page-shell {
    width: 100%;
    padding: 18px 22px 28px;
}

.page-topbar {
    background: var(--bg-header);
    color: var(--text-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 16px 22px;
    margin-bottom: 18px;
}

.page-topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    position: relative;
    min-height: 86px;
    padding-right: 280px;
}

.page-topbar-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 260px;
    flex: 1 1 320px;
}

.page-brand {
    min-width: 220px;
}

.page-brand-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.page-brand-subtitle {
    font-size: 13px;
    opacity: 0.9;
}

.page-brand-subrow {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px;
    margin-top: 4px;
}

.page-user-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    color: rgba(255, 255, 255, 0.86);
    font-size: 12px;
    line-height: 1.35;
}

.page-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}

.page-meta-item {
    display: inline;
}

.page-meta-item strong {
    color: rgba(255, 255, 255, 0.96);
    font-weight: 600;
}

.page-logo-stack {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    position: absolute;
    top: 50%;
    right: 0;
    width: auto;
    max-width: 260px;
    min-width: 260px;
    margin: 0;
    transform: translateY(-50%);
}

.page-portal-logo-frame {
    width: 260px;
    min-width: 220px;
    height: 86px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-portal-logo,
.page-company-logo {
    display: block;
    max-width: 100%;
    object-fit: contain;
}

.page-portal-logo {
    width: 260px;
    max-width: none;
    max-height: none;
    transform: scale(1.28);
    transform-origin: center center;
}

.page-company-logo {
    display: none;
    max-height: 42px;
    padding: 4px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.page-action-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 9px 14px;
    border-radius: 10px;
    font-weight: 600;
    transition: var(--transition-fast);
}

.page-action-link:hover,
.page-action-link:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
}

.page-context-picker {
    position: relative;
}

.page-context-summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 280px;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.24);
    padding: 9px 14px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.page-context-summary::-webkit-details-marker {
    display: none;
}

.page-context-summary span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-context-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1200;
    width: min(420px, calc(100vw - 44px));
    padding: 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

.page-context-panel-title {
    margin-bottom: 8px;
    color: var(--text-main);
    font-weight: 600;
}

.page-context-search {
    margin: 8px 0;
}

.page-context-list {
    max-height: 300px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.16);
    padding: 5px;
}

.page-context-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 7px 8px;
    border-radius: 6px;
    color: var(--text-main);
    font-weight: 400;
    cursor: pointer;
}

.page-context-option:hover {
    background: rgba(96, 165, 250, 0.12);
}

.page-context-option input {
    margin-top: 3px;
    flex: 0 0 auto;
}

.page-context-option-all {
    border: 1px solid rgba(96, 165, 250, 0.22);
    background: rgba(96, 165, 250, 0.10);
}

.page-context-apply {
    margin-top: 10px;
}

.page-content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}

.page-legal-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 14px 8px 0;
    color: var(--text-soft);
    font-size: 12px;
}

.page-legal-footer a {
    color: var(--text-soft);
}

.page-legal-footer a:hover,
.page-legal-footer a:focus {
    color: var(--primary-dark);
}

.page-title {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-main);
}

.page-subtitle {
    margin: 0 0 18px;
    color: var(--text-soft);
    font-size: 14px;
}

/* Inhaltsbereiche: Karten fassen fachliche Gruppen zusammen, ohne Formularlogik zu beeinflussen. */
.section-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
    overflow: hidden;
    scroll-margin-top: 98px;
}

.section-header {
    background: var(--bg-header-soft);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    transition: var(--transition-fast);
}

.section-header:hover {
    background: #1e3a5f;
}

.section-header h3,
.section-header h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-main);
}

.section-header .section-subtext {
    display: block;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 400;
    margin-top: 2px;
}

.section-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapse-icon {
    color: var(--primary-dark);
    transition: transform var(--transition-fast);
    font-size: 16px;
    flex-shrink: 0;
}

.section-body {
    padding: 14px;
    background: var(--bg-card);
}

.panel-soft {
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.form-section-title {
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 600;
}

label {
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 6px;
}

.form-control,
select.form-control,
textarea.form-control {
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: none;
    min-height: 42px;
    transition: var(--transition-fast);
    background: #1a2531;
    color: var(--text-main);
}

.form-control::placeholder,
textarea.form-control::placeholder {
    color: #8fa0b2;
}

.form-control:focus,
select.form-control:focus,
textarea.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
    background: #1a2531;
    color: var(--text-main);
}

.form-control[readonly] {
    background: #273444;
    color: #cbd5e1;
}

.form-control[disabled],
.form-control:disabled,
select.form-control[disabled],
select.form-control:disabled,
textarea.form-control[disabled],
textarea.form-control:disabled,
fieldset[disabled] .form-control {
    background: #273444;
    border-color: #3a4a5d;
    color: #cbd5e1;
    opacity: 1;
    cursor: not-allowed;
    -webkit-text-fill-color: #cbd5e1;
}

.form-control[disabled]::placeholder,
.form-control:disabled::placeholder,
textarea.form-control[disabled]::placeholder,
textarea.form-control:disabled::placeholder {
    color: #9aaabd;
    opacity: 1;
}

input[type="checkbox"][disabled],
input[type="radio"][disabled] {
    opacity: 1;
    cursor: not-allowed;
    accent-color: #64748b;
}

.checkbox-inline,
.radio-inline {
    font-weight: 500;
}

.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.search-box {
    max-width: 420px;
    margin-bottom: 14px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-responsive > .table {
    min-width: 100%;
}

.table {
    margin-bottom: 0;
    background: var(--bg-card);
    color: var(--text-main);
}

.table > thead > tr > th {
    background: #243140;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    border-top: none !important;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.table > tbody > tr > td {
    vertical-align: middle !important;
    border-top: 1px solid #314253;
    background: var(--bg-card);
    line-height: 1.42;
    font-weight: 400;
    color: #dbe6f2;
}

.frozen-table-head {
    display: none;
    position: fixed;
    top: 0;
    z-index: 19;
    overflow: hidden;
    pointer-events: none;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

.frozen-table-head-table {
    table-layout: fixed;
    margin: 0;
}

.frozen-table-head-table > thead > tr > th {
    background: #243140;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    border-top: none !important;
    white-space: nowrap;
}

.table > tbody > tr > td strong,
.table > tbody > tr > td b {
    font-weight: 600;
    color: #f3f7fc;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #1c2734;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: #1c2734;
}

.muted-empty {
    text-align: center;
    color: var(--text-soft);
    padding: 14px !important;
}

.btn {
    border-radius: 10px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.btn:focus,
.btn:active:focus {
    outline: none !important;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #08111f;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-primary:hover,
/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #08111f;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-success {
    background: #22c55e;
    border-color: #22c55e;
    color: #08111f;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-success:hover,
/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-success:focus {
    background: #4ade80;
    border-color: #4ade80;
    color: #08111f;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-info {
    background: #38bdf8;
    border-color: #38bdf8;
    color: #08111f;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-info:hover,
/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-info:focus {
    background: #7dd3fc;
    border-color: #7dd3fc;
    color: #08111f;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-warning {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #111827;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-warning:hover,
/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-warning:focus {
    background: #fbbf24;
    border-color: #fbbf24;
    color: #111827;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-danger {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-danger:hover,
/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-danger:focus {
    background: #f87171;
    border-color: #f87171;
    color: #fff;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-default {
    border-color: var(--border-strong);
    background: #273444;
    color: var(--text-main);
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-default:hover,
/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-default:focus {
    background: #304255;
    border-color: var(--primary);
    color: var(--primary-dark);
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-uniform {
    min-width: 118px;
    text-align: center;
}

/* Interaktionselemente: visuelle Zustaende bleiben hier, Berechtigungen werden serverseitig geprueft. */
.btn-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-ja,
.badge-on {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-nein,
.badge-off {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.alert {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info-text);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.inline-meta {
    color: var(--text-soft);
    font-size: 12px;
}

.row > [class*="col-"] {
    position: relative;
}

.setting-hint-anchor {
    position: relative;
}

.setting-hint {
    display: none !important;
}

.setting-hint-floating {
    position: fixed;
    left: 12px;
    top: 12px;
    width: min(380px, calc(100vw - 24px));
    max-height: min(360px, calc(100vh - 24px));
    overflow: auto;
    z-index: 5000;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #182431;
    color: var(--text-main);
    font-size: 12px;
    line-height: 1.35;
    box-shadow: var(--shadow-md);
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.setting-hint-floating.is-visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.setting-hint-title {
    color: var(--primary-dark);
    font-weight: 600;
    padding: 8px 10px 0;
}

.setting-hint-body {
    padding: 2px 10px 10px;
    color: var(--text-soft);
}

.setting-hint-body p {
    margin: 6px 0 0;
}

.page-help-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 9px 14px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: var(--transition-fast);
}

.page-help-toggle:hover,
.page-help-toggle:focus-within,
.page-help-toggle.is-active {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.30);
}

.page-help-toggle input {
    margin: 0;
}

.page-help-toggle-icon {
    display: none;
}

.hr-soft,
hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 18px 0;
}

.sticky-page-actions {
    position: sticky;
    top: 0;
    z-index: 20;
}

.color-dot {
    border-color: var(--border-strong) !important;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}

.field-span-1,
.field-span-2,
.field-span-3,
.field-span-4,
.field-span-5,
.field-span-6,
.field-span-7,
.field-span-8,
.field-span-9,
.field-span-10,
.field-span-11,
.field-span-12 {
    min-width: 0;
}

.field-span-1 { grid-column: span 1; }
.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: span 3; }
.field-span-4 { grid-column: span 4; }
.field-span-5 { grid-column: span 5; }
.field-span-6 { grid-column: span 6; }
.field-span-7 { grid-column: span 7; }
.field-span-8 { grid-column: span 8; }
.field-span-9 { grid-column: span 9; }
.field-span-10 { grid-column: span 10; }
.field-span-11 { grid-column: span 11; }
.field-span-12 { grid-column: span 12; }

.field-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkbox-stack {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
    min-height: 42px;
}

.checkbox-stack label,
.checkbox-stack .checkbox-inline {
    margin: 0;
}

.records-grid {
    display: grid;
    gap: 14px;
}

.record-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(35, 48, 63, 0.98) 0%, rgba(29, 40, 53, 0.98) 100%);
    box-shadow: var(--shadow-sm);
    padding: 16px;
}

.record-card-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.record-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.color-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.color-chip-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    flex: 0 0 14px;
}

.text-break-soft {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.row-gap-md {
    margin-top: 14px;
}

.form-actions-spaced {
    margin-top: 18px;
}

.alert-spaced {
    margin-top: 18px;
    margin-bottom: 0;
}

.note-spaced {
    margin-bottom: 16px;
}

.checkbox-panel {
    min-height: 42px;
    display: flex;
    align-items: center;
}

.checkbox-panel label {
    margin: 0;
    font-weight: 600;
}

.checkbox-inline-wrap {
    padding-top: 8px;
}

.action-column {
    min-width: 220px;
}

.action-column-sm {
    min-width: 180px;
}

.action-column-xs {
    min-width: 140px;
}

.action-column-md {
    min-width: 250px;
}

.action-column-lg {
    min-width: 290px;
}

.action-column-xl {
    min-width: 320px;
}

.inline-form {
    display: inline-block;
    margin: 0;
}

.actions-end {
    justify-content: flex-end;
}

.text-right-md {
    text-align: right;
}

.kpi-value-lg {
    font-size: 22px;
    line-height: 1.2;
}

.meta-gap-4 {
    margin-top: 4px;
}

.meta-gap-6 {
    margin-top: 6px;
}

.compact-hr {
    margin: 10px 0;
}

.mt-12 {
    margin-top: 12px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-14 { margin-bottom: 14px; }

@media (max-width: 991px) {
    .page-shell {
        padding: 14px;
    }

    .page-content-card {
        padding: 16px;
    }

    .section-body {
        padding: 14px;
    }

    .page-title {
        font-size: 24px;
    }

    .field-span-1,
    .field-span-2,
    .field-span-3,
    .field-span-4,
    .field-span-5,
    .field-span-6 {
        grid-column: span 6;
    }

    .field-span-7,
    .field-span-8,
    .field-span-9,
    .field-span-10,
    .field-span-11,
    .field-span-12 {
        grid-column: span 12;
    }
}

@media (max-width: 767px) {
    .page-topbar {
        padding: 14px;
        border-radius: 14px;
    }

    .page-topbar-inner {
        min-height: 0;
        padding-right: 0;
    }

    .page-brand-title {
        font-size: 19px;
    }

    .page-topbar-left,
    .page-logo-stack,
    .page-actions {
        width: 100%;
        justify-content: center;
    }

    .page-topbar-left {
        min-width: 0;
        align-items: center;
        text-align: center;
    }

    .page-brand-subrow,
    .page-user-meta {
        align-items: center;
        justify-content: center;
    }

    .page-meta-row {
        justify-content: center;
    }

    .page-portal-logo-frame {
        width: 220px;
        min-width: 0;
        height: 70px;
    }

    .page-logo-stack {
        position: static;
        top: auto;
        right: auto;
        max-width: none;
        min-width: 0;
        margin-top: -8px;
        margin-bottom: -8px;
        transform: none;
    }

    .page-portal-logo {
        width: 220px;
    }

    .page-company-logo {
        max-height: 38px;
    }

    .page-content-card {
        padding: 12px;
        border-radius: 14px;
    }

    .section-card {
        border-radius: 12px;
    }

    .section-header {
        padding: 12px 14px;
    }

    .section-header h3,
    .section-header h4 {
        font-size: 16px;
    }

    .section-body {
        padding: 12px;
    }

    .btn,
    .btn-uniform {
        width: 100%;
        min-width: 0;
    }

    .page-context-picker,
    .page-context-summary {
        width: 100%;
    }

    .page-context-panel {
        left: 0;
        right: auto;
        width: min(420px, calc(100vw - 44px));
    }

    .btn-action-group {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .toolbar-row {
        display: block;
    }

    .toolbar-row > * {
        margin-bottom: 10px;
    }

    .page-actions {
        width: 100%;
        justify-content: stretch;
    }

    .page-action-link,
    .page-help-toggle {
        width: 100%;
        justify-content: center;
    }

    .form-grid,
    .record-card-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .field-span-1,
    .field-span-2,
    .field-span-3,
    .field-span-4,
    .field-span-5,
    .field-span-6,
    .field-span-7,
    .field-span-8,
    .field-span-9,
    .field-span-10,
    .field-span-11,
    .field-span-12 {
        grid-column: auto;
    }

    .record-card-actions {
        justify-content: stretch;
    }

    .record-card-actions .btn {
        width: 100%;
    }

    .text-right-md {
        text-align: left;
    }
}


/* =========================================================
   Dark menu / tile cards
   ========================================================= */

.menu-grid,
.admin-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.menu-card,
.admin-menu-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-height: 88px;
    padding: 16px 16px;
    border: 1px solid #2f3f53;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(32, 44, 57, 0.98) 0%, rgba(26, 37, 49, 0.98) 100%);
    color: var(--text-main);
    text-decoration: none !important;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    overflow: hidden;
}

.menu-card::after,
.admin-menu-card::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.9) 0%, rgba(59, 130, 246, 0.25) 100%);
    opacity: 0.9;
}

.menu-card:hover,
.menu-card:focus,
.admin-menu-card:hover,
.admin-menu-card:focus {
    background: linear-gradient(180deg, rgba(38, 52, 67, 1) 0%, rgba(30, 42, 55, 1) 100%);
    border-color: #46607c;
    color: #f8fbff;
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.menu-icon,
.admin-menu-icon {
    position: relative;
    width: 48px;
    height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(47, 66, 88, 0.98) 0%, rgba(38, 53, 72, 0.98) 100%);
    border: 1px solid rgba(126, 167, 214, 0.18);
    color: #8bc8ff;
    font-size: 20px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 18px rgba(0,0,0,0.18);
}

.menu-icon::before,
.admin-menu-icon::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 10px;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.12), rgba(255,255,255,0) 70%);
    pointer-events: none;
}

.menu-content,
.admin-menu-content {
    min-width: 0;
}

.menu-title,
.admin-menu-title {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 5px;
    color: #eff6ff;
    font-size: 15px;
}

.menu-sub,
.admin-menu-sub {
    color: #9eb0c6;
    font-size: 12px;
    line-height: 1.45;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.info-box,
.admin-info-box {
    border: 1px solid #324356;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(35, 48, 63, 0.98) 0%, rgba(29, 40, 53, 0.98) 100%);
    color: var(--text-main);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.info-box {
    padding: 13px 15px;
}

.admin-info-box {
    padding: 14px 16px;
    color: #aabacf;
}

.info-label {
    color: #90a3b8;
    font-size: 12px;
    margin-bottom: 5px;
}

.info-value {
    font-weight: 600;
    line-height: 1.35;
    color: #eef4fb;
}

/* Farbvarianten für Menükarten */
.tile-start .menu-icon,
.tile-start .admin-menu-icon,
.tile-dashboard .menu-icon,
.tile-dashboard .admin-menu-icon {
    background: linear-gradient(180deg, rgba(18, 64, 53, 0.98) 0%, rgba(15, 48, 40, 0.98) 100%);
    color: #74e2b1;
}

.tile-chart .menu-icon,
.tile-chart .admin-menu-icon,
.tile-energy .menu-icon,
.tile-energy .admin-menu-icon {
    background: linear-gradient(180deg, rgba(22, 48, 85, 0.98) 0%, rgba(18, 39, 69, 0.98) 100%);
    color: #7fc8ff;
}

.tile-alarm .menu-icon,
.tile-alarm .admin-menu-icon {
    background: linear-gradient(180deg, rgba(89, 52, 18, 0.98) 0%, rgba(67, 39, 14, 0.98) 100%);
    color: #ffc168;
}

.tile-settings .menu-icon,
.tile-settings .admin-menu-icon,
.tile-admin .menu-icon,
.tile-admin .admin-menu-icon {
    background: linear-gradient(180deg, rgba(57, 43, 90, 0.98) 0%, rgba(44, 34, 71, 0.98) 100%);
    color: #c9a6ff;
}

.tile-user .menu-icon,
.tile-user .admin-menu-icon,
.tile-mail .menu-icon,
.tile-mail .admin-menu-icon {
    background: linear-gradient(180deg, rgba(54, 39, 74, 0.98) 0%, rgba(42, 30, 58, 0.98) 100%);
    color: #f0b8ff;
}

.tile-company .menu-icon,
.tile-company .admin-menu-icon,
.tile-location .menu-icon,
.tile-location .admin-menu-icon,
.tile-plant .menu-icon,
.tile-plant .admin-menu-icon,
.tile-sensor .menu-icon,
.tile-sensor .admin-menu-icon,
.tile-meter .menu-icon,
.tile-meter .admin-menu-icon {
    background: linear-gradient(180deg, rgba(45, 58, 30, 0.98) 0%, rgba(34, 45, 23, 0.98) 100%);
    color: #b8e986;
}

@media (max-width: 767px) {
    .menu-grid,
    .admin-menu-grid,
    .info-grid {
        grid-template-columns: 1fr;
    }
}



/* =========================================================
   V1 SVG Menu Cards
   ========================================================= */

:root {
    --v1-card-bg: linear-gradient(180deg, rgba(34, 47, 62, 0.98) 0%, rgba(28, 40, 53, 0.98) 100%);
    --v1-card-border: #415469;
    --v1-card-hover-border: #587596;
    --v1-card-shadow: 0 12px 28px rgba(7, 14, 24, 0.24);
    --v1-card-shadow-hover: 0 18px 34px rgba(7, 14, 24, 0.30);
    --v1-card-title: #f3f6fb;
    --v1-card-text: #b3c0cf;
    --v1-card-link: #8cc6ff;
    --v1-card-link-hover: #bedfff;
    --v1-icon-bg: rgba(140, 198, 255, 0.12);
    --v1-icon-border: rgba(140, 198, 255, 0.16);
}

.v1-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.v1-menu-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 185px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--v1-card-border);
    background: var(--v1-card-bg);
    box-shadow: var(--v1-card-shadow);
    text-decoration: none !important;
    color: var(--v1-card-title);
    position: relative;
    overflow: hidden;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.v1-menu-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--accent-strong) 0%, var(--accent-soft) 100%);
    opacity: 0.95;
}

.v1-menu-card::after {
    content: "";
    position: absolute;
    right: -24px;
    top: -24px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.0) 70%);
    pointer-events: none;
}

.v1-menu-card:hover,
.v1-menu-card:focus {
    transform: translateY(-4px);
    border-color: var(--v1-card-hover-border);
    box-shadow: var(--v1-card-shadow-hover);
    color: var(--v1-card-title);
}

.v1-menu-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    background: var(--v1-icon-bg);
    border: 1px solid var(--v1-icon-border);
    color: var(--accent-strong);
    position: relative;
    z-index: 1;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.v1-menu-icon svg {
    width: 24px;
    height: 24px;
    display: block;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.v1-menu-content {
    width: 100%;
    position: relative;
    z-index: 1;
}

.v1-menu-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 6px;
    color: var(--v1-card-title);
}

.v1-menu-sub {
    font-size: 13px;
    line-height: 1.45;
    color: var(--v1-card-text);
    margin: 0 0 14px;
    max-width: 36ch;
}

.v1-menu-link {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 600;
    color: var(--v1-card-link);
}

.v1-menu-card:hover .v1-menu-link,
.v1-menu-card:focus .v1-menu-link {
    color: var(--v1-card-link-hover);
}

.v1-menu-link svg {
    width: 16px;
    height: 16px;
    display: block;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.v1-menu-card.tone-blue {
    --accent-strong: #79b8ff;
    --accent-soft: #3b82f6;
    --v1-icon-bg: rgba(96, 165, 250, 0.14);
    --v1-icon-border: rgba(96, 165, 250, 0.22);
}

.v1-menu-card.tone-cyan {
    --accent-strong: #67e8f9;
    --accent-soft: #06b6d4;
    --v1-icon-bg: rgba(34, 211, 238, 0.14);
    --v1-icon-border: rgba(34, 211, 238, 0.22);
}

.v1-menu-card.tone-green {
    --accent-strong: #86efac;
    --accent-soft: #22c55e;
    --v1-icon-bg: rgba(34, 197, 94, 0.14);
    --v1-icon-border: rgba(34, 197, 94, 0.22);
}

.v1-menu-card.tone-violet {
    --accent-strong: #c4b5fd;
    --accent-soft: #8b5cf6;
    --v1-icon-bg: rgba(139, 92, 246, 0.14);
    --v1-icon-border: rgba(139, 92, 246, 0.22);
}

.v1-menu-card.tone-amber {
    --accent-strong: #fcd34d;
    --accent-soft: #f59e0b;
    --v1-icon-bg: rgba(245, 158, 11, 0.14);
    --v1-icon-border: rgba(245, 158, 11, 0.22);
}

.v1-menu-card.tone-rose {
    --accent-strong: #fda4af;
    --accent-soft: #f43f5e;
    --v1-icon-bg: rgba(244, 63, 94, 0.14);
    --v1-icon-border: rgba(244, 63, 94, 0.22);
}

.v1-menu-card.tone-slate {
    --accent-strong: #cbd5e1;
    --accent-soft: #94a3b8;
    --v1-icon-bg: rgba(148, 163, 184, 0.14);
    --v1-icon-border: rgba(148, 163, 184, 0.22);
}

.v1-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.v1-info-box {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(35, 47, 62, 0.96) 0%, rgba(29, 40, 53, 0.96) 100%);
    box-shadow: var(--shadow-sm);
}

.v1-info-label {
    color: var(--text-soft);
    font-size: 12px;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.v1-info-value {
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-main);
}

.v1-note-box {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(33, 45, 60, 0.96) 0%, rgba(29, 40, 53, 0.96) 100%);
    color: var(--text-soft);
}

@media (max-width: 991px) {
    .v1-menu-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 12px;
    }

    .v1-menu-card {
        min-height: 170px;
    }
}

@media (max-width: 767px) {
    .v1-menu-grid,
    .v1-info-grid {
        grid-template-columns: 1fr;
    }

    .v1-menu-card {
        min-height: 0;
        padding: 15px;
        border-radius: 16px;
    }

    .v1-menu-title {
        font-size: 15px;
    }
}

/* Gemeinsamer Smartphone-Rahmen fuer Portal-Seiten; chart.php nimmt nicht daran teil. */
@media (max-width: 767px) {
    body.portal-mobile-app {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
        overscroll-behavior: none;
    }

    body.portal-mobile-app .page-shell {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
        overflow: hidden;
    }

    body.portal-mobile-app .page-topbar {
        flex: 0 0 auto;
        min-height: 48px;
        margin: 0 0 6px;
        padding: 5px 6px 5px 12px;
        border-radius: 13px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
    }

    body.portal-mobile-app .page-topbar-inner {
        min-height: 38px;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 0;
    }

    body.portal-mobile-app .page-topbar-left {
        width: auto;
        min-width: 68px;
        flex: 1 1 auto;
        align-items: flex-start;
        text-align: left;
    }

    body.portal-mobile-app .page-brand {
        width: 100%;
        min-width: 0;
    }

    body.portal-mobile-app .page-brand-title {
        overflow: hidden;
        font-size: 17px;
        line-height: 1.1;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.portal-mobile-app .page-brand-subrow {
        align-items: flex-start;
        margin-top: 2px;
    }

    body.portal-mobile-app .page-brand-subtitle,
    body.portal-mobile-app .page-user-meta .page-meta-row:nth-child(n+2),
    body.portal-mobile-app .page-user-meta .page-meta-item:nth-child(n+2),
    body.portal-mobile-app .page-logo-stack {
        display: none;
    }

    body.portal-mobile-app .page-user-meta,
    body.portal-mobile-app .page-meta-row {
        min-width: 0;
        width: 100%;
        align-items: flex-start;
        justify-content: flex-start;
        flex-wrap: nowrap;
        font-size: 11px;
        line-height: 1.1;
    }

    body.portal-mobile-app .page-meta-item {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.portal-mobile-app .page-actions {
        width: auto;
        max-width: calc(100vw - 92px);
        flex: 0 1 auto;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 4px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    body.portal-mobile-app .page-actions::-webkit-scrollbar {
        display: none;
    }

    body.portal-mobile-app .page-action-link,
    body.portal-mobile-app .page-context-summary,
    body.portal-mobile-app .page-help-toggle {
        width: 38px;
        min-width: 38px;
        height: 38px;
        padding: 0;
        justify-content: center;
        border-radius: 11px;
        font-size: 15px;
    }

    body.portal-mobile-app .page-help-toggle {
        position: relative;
        display: inline-flex;
        min-width: 38px;
        margin: 0;
        padding: 0;
    }

    body.portal-mobile-app .page-help-toggle input,
    body.portal-mobile-app .page-help-toggle span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    body.portal-mobile-app .page-help-toggle-icon {
        display: inline-block;
    }

    body.portal-mobile-app .page-action-link span,
    body.portal-mobile-app .page-context-summary span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    body.portal-mobile-app .page-context-picker,
    body.portal-mobile-app .page-context-summary {
        width: 38px;
        min-width: 38px;
    }

    body.portal-mobile-app .page-context-panel {
        position: fixed;
        z-index: 100;
        top: 58px;
        right: 6px;
        left: 6px;
        width: auto;
        max-height: calc(100dvh - 70px);
        overflow: auto;
    }

    body.portal-mobile-app .page-content-card {
        display: block;
        flex: 1 1 auto;
        min-height: 0;
        padding: 10px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        border-radius: 13px;
        -webkit-overflow-scrolling: touch;
    }

    body.portal-mobile-app .page-legal-footer {
        display: none;
    }

    body.portal-mobile-app .page-title {
        margin: 0 0 4px;
        font-size: 20px;
        line-height: 1.2;
    }

    body.portal-mobile-app .page-subtitle {
        margin: 0 0 10px;
        font-size: 12px;
        line-height: 1.35;
    }

    body.portal-mobile-app .section-card {
        margin-bottom: 8px;
        border-radius: 12px;
        box-shadow: none;
        scroll-margin-top: 4px;
    }

    body.portal-mobile-app .section-header {
        min-height: 42px;
        padding: 9px 11px;
        gap: 8px;
    }

    body.portal-mobile-app .section-header h3,
    body.portal-mobile-app .section-header h4 {
        font-size: 15px;
        line-height: 1.2;
    }

    body.portal-mobile-app .section-header .section-subtext {
        display: none;
    }

    body.portal-mobile-app .section-body,
    body.portal-mobile-app .panel-soft {
        padding: 10px;
    }

    body.portal-mobile-app .alert {
        margin-bottom: 8px;
        padding: 9px 11px;
        border-radius: 10px;
        font-size: 13px;
    }

    body.portal-mobile-app .form-grid,
    body.portal-mobile-app [class*="-form-grid"],
    body.portal-mobile-app [class*="-filter-grid"],
    body.portal-mobile-app [class*="-create-grid"],
    body.portal-mobile-app [class*="-settings-grid"] {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 9px !important;
    }

    body.portal-mobile-app .field-span-1,
    body.portal-mobile-app .field-span-2,
    body.portal-mobile-app .field-span-3,
    body.portal-mobile-app .field-span-4,
    body.portal-mobile-app .field-span-5,
    body.portal-mobile-app .field-span-6,
    body.portal-mobile-app .field-span-7,
    body.portal-mobile-app .field-span-8,
    body.portal-mobile-app .field-span-9,
    body.portal-mobile-app .field-span-10,
    body.portal-mobile-app .field-span-11,
    body.portal-mobile-app .field-span-12 {
        grid-column: 1 / -1 !important;
    }

    body.portal-mobile-app .row {
        margin-right: -5px;
        margin-left: -5px;
    }

    body.portal-mobile-app .row > [class*="col-"] {
        float: none;
        width: 100%;
        padding-right: 5px;
        padding-left: 5px;
    }

    body.portal-mobile-app .form-inline,
    body.portal-mobile-app .inline-form,
    body.portal-mobile-app [class*="inline-form"],
    body.portal-mobile-app .toolbar-row,
    body.portal-mobile-app [class*="-toolbar"] {
        display: flex;
        width: 100%;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 7px;
    }

    body.portal-mobile-app .form-inline .form-group,
    body.portal-mobile-app .search-box,
    body.portal-mobile-app [class*="search-box"] {
        width: 100%;
        max-width: none;
    }

    body.portal-mobile-app .form-control,
    body.portal-mobile-app select.form-control,
    body.portal-mobile-app input.form-control {
        min-width: 0;
        height: 42px;
        padding: 8px 10px;
        font-size: 16px;
    }

    body.portal-mobile-app textarea.form-control {
        height: auto;
        min-height: 88px;
    }

    body.portal-mobile-app input[type="checkbox"],
    body.portal-mobile-app input[type="radio"] {
        width: 20px;
        height: 20px;
    }

    body.portal-mobile-app .btn,
    body.portal-mobile-app .btn-uniform {
        width: auto;
        min-width: 42px;
        min-height: 42px;
        padding: 9px 12px;
        white-space: normal;
    }

    body.portal-mobile-app .btn-block,
    body.portal-mobile-app button[type="submit"]:only-child {
        width: 100%;
    }

    body.portal-mobile-app .btn-action-group {
        display: flex;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 6px;
    }

    body.portal-mobile-app .btn-action-group .btn {
        flex: 1 1 120px;
    }

    body.portal-mobile-app .table-responsive,
    body.portal-mobile-app .table-wrap {
        width: 100%;
        max-width: 100%;
        margin-bottom: 0;
        overflow-x: auto;
        overflow-y: visible;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    body.portal-mobile-app .table-responsive > table.table,
    body.portal-mobile-app .table-wrap > table.table {
        width: max-content;
        min-width: 100%;
        margin-bottom: 0;
        font-size: 12px;
    }

    body.portal-mobile-app .table > thead > tr > th,
    body.portal-mobile-app .table > tbody > tr > td,
    body.portal-mobile-app .table > tfoot > tr > td {
        padding: 8px 9px;
        vertical-align: top;
        white-space: normal;
    }

    body.portal-mobile-app .table > thead > tr > th {
        position: sticky;
        top: 0;
        z-index: 2;
        white-space: nowrap;
    }

    body.portal-mobile-app .table-responsive:has(> table.mobile-card-table),
    body.portal-mobile-app .table-wrap:has(> table.mobile-card-table) {
        overflow: visible;
        border: 0;
        border-radius: 0;
    }

    body.portal-mobile-app table.mobile-card-table,
    body.portal-mobile-app table.mobile-card-table > tbody {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        background: transparent;
    }

    body.portal-mobile-app table.mobile-card-table > thead {
        display: none;
    }

    body.portal-mobile-app table.mobile-card-table > tbody > tr {
        display: block;
        width: 100%;
        margin: 0 0 8px;
        overflow: hidden;
        border: 1px solid var(--border-color);
        border-radius: 11px;
        background: var(--bg-muted);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
    }

    body.portal-mobile-app table.mobile-card-table > tbody > tr:last-child {
        margin-bottom: 0;
    }

    body.portal-mobile-app table.mobile-card-table > tbody > tr > td {
        display: grid;
        grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
        align-items: start;
        gap: 8px;
        width: 100%;
        min-width: 0;
        padding: 8px 9px;
        border: 0;
        border-bottom: 1px solid rgba(83, 103, 125, 0.42);
        background: transparent;
        text-align: left !important;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    body.portal-mobile-app table.mobile-card-table > tbody > tr > td:last-child {
        border-bottom: 0;
    }

    body.portal-mobile-app table.mobile-card-table > tbody > tr > td::before {
        content: attr(data-mobile-label);
        color: var(--text-soft);
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.035em;
        line-height: 1.35;
        text-transform: uppercase;
    }

    body.portal-mobile-app table.mobile-card-table .form-control {
        width: 100%;
    }

    body.portal-mobile-app table.mobile-card-table .btn,
    body.portal-mobile-app table.mobile-card-table .btn-action-group {
        max-width: 100%;
    }

    body.portal-mobile-app .frozen-table-head {
        display: none !important;
    }

    body.portal-mobile-app .modal-dialog {
        width: auto;
        margin: 8px;
    }

    body.portal-mobile-app .modal-content {
        max-height: calc(100dvh - 16px);
        overflow: auto;
        border-radius: 14px;
    }

    body.portal-mobile-app .v1-menu-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    body.portal-mobile-app .v1-menu-card {
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        min-width: 0;
        min-height: 58px;
        padding: 7px 8px;
        border-radius: 11px;
        box-shadow: none;
    }

    body.portal-mobile-app .v1-menu-card:hover,
    body.portal-mobile-app .v1-menu-card:focus {
        transform: none;
    }

    body.portal-mobile-app .v1-menu-icon {
        width: 34px;
        height: 34px;
        margin: 0;
        border-radius: 9px;
    }

    body.portal-mobile-app .v1-menu-icon svg {
        width: 18px;
        height: 18px;
    }

    body.portal-mobile-app .v1-menu-content {
        min-width: 0;
    }

    body.portal-mobile-app .v1-menu-title {
        display: -webkit-box;
        margin: 0;
        overflow: hidden;
        font-size: clamp(11px, 3.35vw, 13px);
        line-height: 1.2;
        overflow-wrap: anywhere;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    body.portal-mobile-app .v1-menu-sub,
    body.portal-mobile-app .v1-menu-link {
        display: none;
    }

    body.portal-mobile-app .v1-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    body.portal-mobile-app .v1-info-box,
    body.portal-mobile-app .v1-note-box {
        padding: 9px 10px;
        border-radius: 10px;
    }
}

/* Startseite: eigenstaendiger App-Modus nur fuer schmale Smartphone-Ansichten. */
.start-mobile-nav {
    display: none;
}

@media (max-width: 767px) {
    body.start-mobile-app.is-start-mobile-mode {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
        overscroll-behavior: none;
    }

    body.start-mobile-app.is-start-mobile-mode .page-shell {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
        overflow: hidden;
    }

    body.start-mobile-app.is-start-mobile-mode .page-topbar {
        flex: 0 0 auto;
        min-height: 48px;
        margin: 0 0 6px;
        padding: 5px 6px 5px 12px;
        border-radius: 13px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
    }

    body.start-mobile-app.is-start-mobile-mode .page-topbar-inner {
        min-height: 38px;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 0;
    }

    body.start-mobile-app.is-start-mobile-mode .page-topbar-left {
        width: auto;
        min-width: 0;
        flex: 1 1 auto;
        align-items: flex-start;
        text-align: left;
    }

    body.start-mobile-app.is-start-mobile-mode .page-brand {
        min-width: 0;
        width: 100%;
    }

    body.start-mobile-app.is-start-mobile-mode .page-brand-title {
        font-size: 17px;
        line-height: 1.1;
    }

    body.start-mobile-app.is-start-mobile-mode .page-brand-subrow {
        align-items: flex-start;
        margin-top: 2px;
    }

    body.start-mobile-app.is-start-mobile-mode .page-brand-subtitle,
    body.start-mobile-app.is-start-mobile-mode .page-user-meta .page-meta-row:nth-child(n+2),
    body.start-mobile-app.is-start-mobile-mode .page-user-meta .page-meta-item:nth-child(n+2),
    body.start-mobile-app.is-start-mobile-mode .page-logo-stack,
    body.start-mobile-app.is-start-mobile-mode .page-help-toggle {
        display: none;
    }

    body.start-mobile-app.is-start-mobile-mode .page-user-meta,
    body.start-mobile-app.is-start-mobile-mode .page-meta-row {
        min-width: 0;
        width: 100%;
        align-items: flex-start;
        justify-content: flex-start;
        flex-wrap: nowrap;
        font-size: 11px;
        line-height: 1.1;
    }

    body.start-mobile-app.is-start-mobile-mode .page-meta-item {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.start-mobile-app.is-start-mobile-mode .page-actions {
        width: auto;
        flex: 0 0 auto;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 5px;
    }

    body.start-mobile-app.is-start-mobile-mode .page-action-link,
    body.start-mobile-app.is-start-mobile-mode .page-context-summary {
        width: 38px;
        min-width: 38px;
        height: 38px;
        padding: 0;
        justify-content: center;
        border-radius: 11px;
        font-size: 15px;
    }

    body.start-mobile-app.is-start-mobile-mode .page-action-link span,
    body.start-mobile-app.is-start-mobile-mode .page-context-summary span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    body.start-mobile-app.is-start-mobile-mode .page-context-picker,
    body.start-mobile-app.is-start-mobile-mode .page-context-summary {
        width: 38px;
    }

    body.start-mobile-app.is-start-mobile-mode .page-context-panel {
        position: fixed;
        top: 58px;
        right: 6px;
        left: 6px;
        width: auto;
        max-height: calc(100dvh - 70px);
        overflow: auto;
    }

    body.start-mobile-app.is-start-mobile-mode .page-content-card {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        padding: 0;
        overflow: hidden;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    body.start-mobile-app.is-start-mobile-mode .page-title,
    body.start-mobile-app.is-start-mobile-mode .page-subtitle,
    body.start-mobile-app.is-start-mobile-mode .page-legal-footer {
        display: none;
    }

    body.start-mobile-app.is-start-mobile-mode [data-start-mobile-section] {
        display: none;
        flex: 1 1 auto;
        min-height: 0;
        margin: 0 0 6px;
        overflow: hidden;
        border-radius: 13px;
        box-shadow: none;
    }

    body.start-mobile-app.is-start-mobile-mode [data-start-mobile-section].is-mobile-active {
        display: flex;
        flex-direction: column;
    }

    body.start-mobile-app.is-start-mobile-mode [data-start-mobile-section] .section-header {
        flex: 0 0 auto;
        min-height: 36px;
        padding: 7px 11px;
        pointer-events: none;
    }

    body.start-mobile-app.is-start-mobile-mode [data-start-mobile-section] .section-header h3 {
        font-size: 14px;
        line-height: 1.15;
    }

    body.start-mobile-app.is-start-mobile-mode [data-start-mobile-section] .section-subtext,
    body.start-mobile-app.is-start-mobile-mode [data-start-mobile-section] .collapse-icon {
        display: none;
    }

    body.start-mobile-app.is-start-mobile-mode [data-start-mobile-section] .section-body {
        display: block;
        flex: 1 1 auto;
        min-height: 0;
        padding: 6px;
        overflow: hidden;
    }

    body.start-mobile-app.is-start-mobile-mode .v1-menu-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: clamp(50px, 9dvh, 64px);
        align-content: start;
        gap: 6px;
        height: 100%;
    }

    body.start-mobile-app.is-start-mobile-mode .v1-menu-card {
        display: grid;
        grid-template-columns: 32px minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        min-width: 0;
        min-height: 0;
        padding: 6px 8px;
        border-radius: 11px;
        box-shadow: none;
    }

    body.start-mobile-app.is-start-mobile-mode .v1-menu-card:hover,
    body.start-mobile-app.is-start-mobile-mode .v1-menu-card:focus {
        transform: none;
    }

    body.start-mobile-app.is-start-mobile-mode .v1-menu-icon {
        width: 32px;
        height: 32px;
        margin: 0;
        border-radius: 10px;
    }

    body.start-mobile-app.is-start-mobile-mode .v1-menu-icon svg {
        width: 17px;
        height: 17px;
    }

    body.start-mobile-app.is-start-mobile-mode .v1-menu-content {
        min-width: 0;
    }

    body.start-mobile-app.is-start-mobile-mode .v1-menu-title {
        display: -webkit-box;
        margin: 0;
        overflow: hidden;
        color: #f7f9fc;
        font-size: clamp(11px, 3.35vw, 13px);
        font-weight: 600;
        line-height: 1.18;
        overflow-wrap: anywhere;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    body.start-mobile-app.is-start-mobile-mode .v1-menu-sub,
    body.start-mobile-app.is-start-mobile-mode .v1-menu-link {
        display: none;
    }

    body.start-mobile-app.is-start-mobile-mode .start-mobile-nav {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
        flex: 0 0 58px;
        gap: 4px;
        min-height: 58px;
        padding: 4px;
        border: 1px solid var(--border-color);
        border-radius: 14px;
        background: #202c39;
        box-shadow: 0 -5px 18px rgba(0, 0, 0, 0.18);
    }

    body.start-mobile-app.is-start-mobile-mode .start-mobile-nav-item {
        display: flex;
        min-width: 0;
        padding: 5px 3px 4px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--text-soft);
        font-size: 10px;
        line-height: 1;
        transition: background var(--transition-fast), color var(--transition-fast);
    }

    body.start-mobile-app.is-start-mobile-mode .start-mobile-nav-item i {
        font-size: 17px;
    }

    body.start-mobile-app.is-start-mobile-mode .start-mobile-nav-item.is-active {
        background: var(--primary-soft);
        color: #dcecff;
    }

    body.start-mobile-app.is-start-mobile-mode .start-mobile-nav-item:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: -2px;
    }
}

/* Zentrale Typo-Normalisierung fuer Portal-Seiten mit lokalen Inline-Styles */
.page-content-card,
.page-content-card .table,
.page-content-card .section-card,
.page-content-card .info-box,
.page-content-card .admin-info-box,
.page-content-card .v1-menu-card,
.page-content-card .v1-info-box {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.page-content-card strong,
.page-content-card b,
.page-content-card th,
.page-content-card .page-title,
.page-content-card .section-header h3,
.page-content-card .section-header h4,
.page-content-card .form-section-title,
.page-content-card .menu-title,
.page-content-card .admin-menu-title,
.page-content-card .info-value,
.page-content-card .v1-menu-title,
.page-content-card .v1-menu-link,
.page-content-card .v1-info-value,
.page-content-card .badge-status,
.page-content-card .energy-metric-title,
.page-content-card .energy-metric-value,
.page-content-card .alert-title,
.page-content-card .sensor-name,
.page-content-card .sensor-mini-name,
.page-content-card .sensor-mini-value,
.page-content-card .summary-headline,
.page-content-card .summary-mini-value {
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-shadow: none !important;
}

.page-content-card label,
.page-content-card .table > tbody > tr > td,
.page-content-card .energy-metric-compare,
.page-content-card .energy-metric-meta,
.page-content-card .sensor-mini-meta,
.page-content-card .sensor-mini-limits,
.page-content-card .summary-topline,
.page-content-card .summary-foot,
.page-content-card .page-subtitle,
.page-content-card .section-subtext,
.page-content-card .text-muted,
.page-content-card small {
    font-weight: 400 !important;
    text-shadow: none !important;
}

.page-content-card .table > thead > tr > th,
.page-content-card .table > tbody > tr > td {
    letter-spacing: 0 !important;
}

.page-content-card .table > tbody > tr > td strong,
.page-content-card .table > tbody > tr > td b {
    color: #f4f8fc !important;
}
