/* plusconnect-V2 — Minimales Default-Styling.
   Tenant-Brand-Farben werden inline via Twig auf .topbar gesetzt. */

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/assets/fonts/roboto-latin.woff2') format('woff2-variations'),
         url('/assets/fonts/roboto-latin.woff2') format('woff2');
}

* { box-sizing: border-box; }
body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    color: #1a1d28;
    background: #f6f7fb;
    line-height: 1.5;
}
.container { max-width: 1100px; margin: 0 auto; padding: 16px 20px; }
.topbar { background: #1c2028; color: #fff; padding: 14px 0; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.topbar .logo { height: 32px; }
.topnav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.topnav a, .topnav button {
    color: rgba(255,255,255,.85); text-decoration: none; font-size: 14px;
    background: none; border: 0; cursor: pointer; padding: 4px 8px;
}
.topnav a:hover, .topnav button:hover { color: #fff; }
main.container { padding-top: 28px; padding-bottom: 60px; }

/* =========================================================
   Site-Header (Tenant-Layout, V1-Optik)
   weisser Hintergrund, schwarzer fetter Caps-Nav, Trenner
   nach dem Logo, Initial-Avatar mit Dropdown rechts.
   ========================================================= */
.site-body { margin: 0; background: #fff; min-height: 100vh; display: flex; flex-direction: column; }
/* Main-Content begrenzt fuer Lesbarkeit, Header+Footer dagegen full-width */
.site-body main#content { flex: 1; padding: 20px; max-width: 1200px; margin: 0 auto; width: 100%; box-sizing: border-box; }
/* Footer im V1-Stil — dunkel, 3-spaltig + Copyright-Trenner */
.site-footer {
    background: #1c2028; color: #f4f4f4;
    padding: 40px 20px 20px; font-size: 14px;
    margin-top: 60px;
}
.footer-container {
    display: flex; flex-wrap: wrap; justify-content: space-between;
    gap: 24px; max-width: 1400px; margin: 0 auto;
}
.footer-column { flex: 1 1 30%; min-width: 240px; }
.footer-column h4 { font-size: 17px; margin: 0 0 10px; color: #fff; }
.footer-column p { margin: 6px 0; color: #ddd; line-height: 1.6; }
.footer-column .footer-link {
    color: #6fa3ef; text-decoration: none; transition: color .25s ease;
    word-break: break-word;
}
.footer-column .footer-link:hover { color: #fff; }

.footer-copyright {
    max-width: 1400px; margin: 24px auto 0;
    padding: 16px 0 0;
    text-align: center; font-size: 12px; color: #bbb;
    border-top: 1px solid #444;
    word-spacing: 14px;
}
.footer-copyright .footer-link {
    color: #bbb; text-decoration: none; transition: color .25s ease;
}
.footer-copyright .footer-link:hover { color: #fff; }

@media (max-width: 768px) {
    .footer-container { flex-direction: column; align-items: stretch; text-align: center; }
    .footer-column { flex: 1 1 100%; max-width: 100%; min-width: 0; }
}

/* =========================================================
   Inactivity-Modal (Bank-Portal-Stil)
   ========================================================= */
.idle-modal {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(28, 32, 40, .55);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
    animation: idleFadeIn .2s ease-out;
}
.idle-modal[hidden] { display: none; }
@keyframes idleFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.idle-modal-card {
    background: #fff; border-radius: 14px; padding: 32px 36px;
    max-width: 460px; width: 100%;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .25);
    text-align: center;
}
.idle-modal-card h2 { margin: 0 0 12px; font-size: 22px; color: #1c2028; }
.idle-modal-card p { margin: 0 0 8px; color: #4b5563; line-height: 1.5; }
.idle-countdown {
    font-weight: 600; color: #ff9800; margin: 16px 0 22px;
    font-size: 15px;
}
.idle-modal-actions {
    display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
body.idle-modal-open { overflow: hidden; }

/* =========================================================
   Angebote-Freigabe-Modal (Download-Pflicht + Häkchen)
   ========================================================= */
.approve-modal {
    position: fixed; inset: 0; z-index: 9998;
    background: rgba(28, 32, 40, .55);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
    animation: idleFadeIn .2s ease-out;
}
.approve-modal.hidden { display: none; }
.approve-modal-card {
    background: #fff; border-radius: 14px; padding: 32px 36px;
    max-width: 540px; width: 100%;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .25);
    max-height: 90vh; overflow-y: auto;
}
.approve-modal-card h2 {
    margin: 0 0 6px; font-size: 22px; color: #1c2028;
}
.approve-modal-subtitle {
    margin: 0 0 18px; color: #6b7280; font-size: 13px;
}
.approve-modal-actions {
    display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
    margin-top: 18px;
}
body.approve-modal-open { overflow: hidden; }
.approve-modal-message {
    margin: 0 0 16px; color: #4b5563; font-size: 14px; line-height: 1.5;
}

/* Signatur-Block im Freigabe-Modal */
.signature-tabs {
    display: flex; gap: 4px; border-bottom: 1px solid #e5e7eb;
    margin: 14px 0 12px;
}
.signature-tab {
    background: transparent; border: none; padding: 8px 14px;
    color: #6b7280; cursor: pointer; font-size: 14px;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.signature-tab.is-active { color: #1c2028; border-bottom-color: var(--brand-primary, #2563eb); font-weight: 600; }
.signature-panel label { display: block; font-size: 13px; color: #4b5563; margin-bottom: 4px; }
.signature-panel .canvas-wrapper {
    border: 1px solid #d1d5db; border-radius: 8px; background: #fff;
    width: 100%; overflow: hidden;
}
.signature-panel canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.signature-panel input[type="text"] { width: 100%; padding: 8px 10px; }
.approve-error {
    background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
    padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-top: 10px;
}

/* =========================================================
   Firmen-Auswahl-Modal (Multi-Tenancy)
   ========================================================= */
.company-modal {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(28, 32, 40, .65);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
    animation: idleFadeIn .2s ease-out;
}
.company-modal.hidden { display: none; }
.company-modal-card {
    background: #fff; border-radius: 14px; padding: 36px 40px;
    max-width: 720px; width: 100%;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .25);
    max-height: 90vh; overflow-y: auto;
}
.company-modal-card h2 {
    margin: 0 0 8px; font-size: 26px; color: #1c2028; text-align: center;
}
.company-modal-card p {
    margin: 0 0 24px; color: #4b5563; line-height: 1.5; text-align: center;
}
.company-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.company-card {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 28px 20px;
    background: #f8f9fa; border: 2px solid #e2e6ee; border-radius: 10px;
    color: #1c2028; cursor: pointer; font: inherit;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.company-card:hover {
    background: #0073aa; border-color: #0073aa; color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 115, 170, .25);
}
.company-card .company-icon { font-size: 2.4em; line-height: 1; }
.company-card .company-name { font-size: 15px; font-weight: 600; text-align: center; }
body.company-modal-open { overflow: hidden; }

/* Firmenname unter dem Benutzernamen im Profilmenü.
   Klickbar (mit Tausch-Symbol) wenn der User mehrere Firmen hat. */
.profile-company {
    display: inline-flex; align-items: center; gap: 6px;
    align-self: flex-start;
    margin: 2px 0;
    font-size: 12px; color: #4b5563;
    background: none; border: 0; padding: 0;
    text-align: left; font-family: inherit;
}
.profile-company.switchable {
    cursor: pointer;
    transition: color .15s ease;
}
.profile-company.switchable:hover,
.profile-company.switchable:focus {
    color: #0073aa; outline: none;
}
.profile-company-name { font-weight: 500; }
.profile-company-icon { opacity: .7; transition: opacity .15s ease; }
.profile-company.switchable:hover .profile-company-icon,
.profile-company.switchable:focus .profile-company-icon { opacity: 1; }

.site-header { background: #fff; }
.site-header .header-container {
    display: flex; align-items: center; justify-content: space-between;
    padding: 40px; gap: 24px;
}
.site-header .logo-container { display: flex; align-items: center; }
.site-header .logo-link { display: inline-flex; align-items: center; text-decoration: none; }
.site-header #company-logo { height: 60px; width: auto; display: block; }
.site-header .company-name-fallback { font-size: 22px; font-weight: 700; color: #1c2028; padding-right: 4px; }
.site-header .centered-text {
    display: inline-flex; align-items: center;
    margin-left: 28px;
    font-size: 2.0em;
}
.site-header .portal-title {
    display: inline-flex; align-items: center; font-weight: 100;
    color: #1c2028; line-height: 1;
}
.site-header .portal-title::before {
    content: ""; display: inline-block;
    width: 2px; height: calc(60px - 14px); background-color: #333; margin-right: 18px;
}

.site-header .menu-container { display: flex; align-items: center; }
.site-header .custom-menu { display: flex; align-items: center; }
.site-header ul.menu { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.site-header ul.menu li { position: relative; }
.site-header ul.menu a {
    display: inline-block; padding: 10px 15px; font-size: 1.2em;
    color: #333; font-weight: 700; text-transform: uppercase;
    text-decoration: none; transition: all .25s ease; border-radius: 8px;
}
.site-header ul.menu a:hover,
.site-header ul.menu .current-menu-item a {
    background-color: #1c2028; color: #fff;
    transform: scale(1.05);
}

#profile {
    width: 60px; height: 60px; border-radius: 50%;
    background-color: #ededed; display: flex;
    justify-content: center; align-items: center;
    cursor: pointer; margin-left: 20px; position: relative;
    transition: background-color .25s ease;
    user-select: none;
}
#profile.active { background-color: #1c2028; }
#profile .initials { font-size: 1em; font-weight: 700; color: #333; }
#profile.active .initials { color: #fff; }
#profile-menu {
    position: absolute; top: 70px; right: 0;
    min-width: 220px; padding: 14px 18px;
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
    display: none; z-index: 100;
}
#profile-menu.active { display: block; }
#profile-menu::before {
    content: ''; width: 10px; height: 10px;
    background: #fff; position: absolute; top: -6px; right: 24px;
    transform: rotate(45deg);
    border-left: 1px solid #e2e6ee; border-top: 1px solid #e2e6ee;
}
#profile-menu .profile-header {
    padding-bottom: 10px; margin-bottom: 10px;
    border-bottom: 1px solid #eef0f4; display: flex; flex-direction: column;
}
#profile-menu .profile-header strong { color: #1c2028; }
#profile-menu .profile-header small { color: #6b7280; font-size: 12px; margin-top: 2px; }
#profile-menu form { margin: 0; }
#profile-menu .profile-link,
#profile-menu .logout-link {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; gap: 8px;
    background: none; border: 0; padding: 8px 0; margin: 0;
    color: #54595f; font: inherit; cursor: pointer; text-align: left;
    text-decoration: none;
}
#profile-menu .profile-link:hover,
#profile-menu .logout-link:hover { color: #1c2028; }

/* Trenner zwischen User-Funktionen und Logout */
#profile-menu .profile-link + .profile-link,
#profile-menu .logout-link {
    border-top: 1px solid #eef0f4;
}

.profile-link-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 7px;
    background: #ff9800; color: #fff;
    font-size: 11px; font-weight: 700; border-radius: 11px;
}

/* Avatar-Badge oben rechts auf den Initialen */
#profile { position: relative; }
.profile-badge {
    position: absolute; top: -2px; right: -2px;
    min-width: 20px; height: 20px; padding: 0 6px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #ff9800; color: #fff;
    font-size: 11px; font-weight: 700; border-radius: 10px;
    border: 2px solid #fff;
    pointer-events: none;
}

/* Admin-Index-Karten */
.admin-card-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px; margin-top: 24px;
}
.admin-card {
    display: block; background: #fff; border: 1px solid #e2e6ee;
    border-radius: 10px; padding: 22px 24px; text-decoration: none;
    color: #1c2028; transition: all .2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.admin-card:hover {
    border-color: #1c2028; transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.07);
}
.admin-card h2 { font-size: 18px; margin: 0 0 8px; color: #1c2028; }
.admin-card p { font-size: 14px; margin: 0; color: #6b7280; line-height: 1.5; }

/* =========================================================
   Admin Sub-Navigation — Zurück-Link + Tab-Pills.
   Wird oben auf jeder Admin-Sub-Seite eingebunden.
   ========================================================= */
.admin-nav {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    padding: 12px 16px; margin: -50px 0 0;
    background: #f8fafb; border: 1px solid #e2e6ee;
    border-radius: 12px;
}
.admin-nav-back {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 8px;
    font-size: 13px; font-weight: 600; color: #4b5563;
    text-decoration: none; background: #fff;
    border: 1px solid #e2e6ee;
    transition: all .15s ease;
    white-space: nowrap;
}
.admin-nav-back:hover {
    color: #1c2028; border-color: #1c2028;
    transform: translateX(-2px);
}
.admin-nav-tabs {
    display: flex; flex-wrap: wrap; gap: 6px;
    flex: 1; justify-content: flex-end;
}
.admin-nav-tab {
    padding: 6px 14px; border-radius: 999px;
    font-size: 13px; font-weight: 500; color: #6b7280;
    text-decoration: none;
    transition: all .15s ease;
    border: 1px solid transparent;
}
.admin-nav-tab:hover {
    color: #1c2028; background: #fff; border-color: #e2e6ee;
}
.admin-nav-tab.active {
    color: #fff;
    background: var(--btn-primary-bg, #e94e1b);
    border-color: var(--btn-primary-bg, #e94e1b);
}
.admin-nav-tab.active:hover {
    background: var(--btn-primary-hover, #c43d12);
    border-color: var(--btn-primary-hover, #c43d12);
}
@media (max-width: 720px) {
    .admin-nav { flex-direction: column; align-items: stretch; }
    .admin-nav-tabs { justify-content: center; }
}

/* =========================================================
   Leistungen — Vertrags-Match-Ampel (V1-Optik)
   ========================================================= */
.group-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px; margin-bottom: 30px;
}
.group-tile {
    background: #f9f9f9; border: 1px solid #ddd; border-radius: 8px;
    overflow: hidden; display: flex; flex-direction: column;
}
.group-title {
    padding: 14px 16px; color: #fff; font-weight: 700; text-align: center;
    font-size: 16px; line-height: 1.3;
}
.group-title.red    { background: #dc3545; }
.group-title.yellow { background: #ff9800; }
.group-title.green  { background: #28a745; }

.group-info {
    padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
}
.group-percentage { font-size: 24px; font-weight: 700; }
.group-percentage.red    { color: #dc3545; }
.group-percentage.yellow { color: #ff9800; }
.group-percentage.green  { color: #28a745; }

.details-toggle {
    cursor: pointer; color: #4b5563; font-size: 14px;
    user-select: none; transition: color .2s ease;
}
.details-toggle:hover { color: #1c2028; }

.bundle-list {
    list-style: none; margin: 0; padding: 0 16px 12px;
    border-top: 1px solid #eef0f4;
}
.bundle-list li {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 0; font-size: 13px;
}
.bundle-list li .percentage {
    flex: 0 0 50px; font-weight: 700;
}
.bundle-list li.red    .percentage { color: #dc3545; }
.bundle-list li.yellow .percentage { color: #ff9800; }
.bundle-list li.green  .percentage { color: #28a745; }
.bundle-list li .bundle-name { color: #4b5563; }

.progress-bar {
    height: 8px; background: #e5e7eb; border-radius: 4px;
    margin: 0 16px 16px; overflow: hidden;
}
.progress-fill {
    height: 100%; transition: width .4s ease;
}
.progress-fill.red    { background: #dc3545; }
.progress-fill.yellow { background: #ff9800; }
.progress-fill.green  { background: #28a745; }

.contract-list-container { margin-top: 30px; text-align: center; }
.contract-list-title,
.page-title {
    font-size: 36px; font-weight: 600; color: #1c2028;
    margin-bottom: 6px; position: relative;
    text-align: center;
}
.contract-list-title { display: inline-block; }
.page-title { display: block; margin: 10px 0 24px; }
/* Direkt nach Admin-Sub-Nav: kein Top-Margin, damit Titel auf gleicher
   Hoehe wie auf Seiten ohne Sub-Nav bleibt (Sub-Nav hat negativen
   top-margin und schiebt sich ueber den eigenen Platz). */
.admin-nav + .page-title { margin-top: 0; }
.contract-list-title::after,
.page-title::after {
    content: ""; display: block; width: 50px; height: 3px;
    background: #1c2028; margin: 6px auto 0;
}
.contract-empty { color: #6b7280; font-size: 15px; margin-top: 18px; }
.contract-list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px; margin-top: 24px; text-align: left;
}
.contract-tile {
    display: block; background: #fff; border: 1px solid #e2e6ee;
    border-radius: 10px; padding: 22px 24px; text-decoration: none;
    color: #1c2028; transition: all .2s ease;
    font-size: 16px;
}
.contract-tile:hover {
    border-color: #1c2028; transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.07);
}
.contract-tile.active { border-color: #1c2028; background: #f6f7fb; }

.contract-details {
    margin-top: 30px; background: #fff; padding: 20px;
    border-radius: 10px; border: 1px solid #e2e6ee;
}
.contract-details h2 { font-size: 18px; margin: 0 0 14px; }
.contract-details td.price { text-align: right; }

/* =========================================================
   Vertragsbewertungs-Admin (Akkordeon + Drag-Reorder)
   ========================================================= */
.leistungen-toolbar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    margin: 16px 0 24px;
}
#csv-import-form {
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    padding: 18px 20px; margin-bottom: 24px;
}

.lst-tree { display: flex; flex-direction: column; gap: 12px; }
.lst-empty { color: #6b7280; font-style: italic; padding: 20px 0; }

.lst-group, .lst-bundle {
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    overflow: hidden;
}
.lst-group-header, .lst-bundle-header {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; background: #f1f3f8; cursor: default;
}
.lst-bundle-header { background: #f8f9fb; padding: 10px 14px; }
.lst-bundle { margin: 8px 14px; }

.drag-handle {
    cursor: grab; color: #9aa0a8; font-weight: 700; user-select: none;
    padding: 4px 6px;
}
.drag-handle:active { cursor: grabbing; }

.lst-name { flex: 1; font-size: 15px; }
.lst-cat { font-size: 12px; color: #6b7280; padding: 2px 8px;
    background: #e5e7eb; border-radius: 6px; }
.lst-toggle { cursor: pointer; padding: 2px 6px; transition: transform .2s; }
.lst-group.collapsed .lst-toggle, .lst-bundle.collapsed .lst-toggle { transform: rotate(-90deg); }
.lst-group.collapsed .lst-bundles, .lst-bundle.collapsed .lst-products { display: none; }
.lst-actions { display: inline-flex; gap: 6px; }

.lst-bundles { padding: 6px 0 12px; }

table.lst-products {
    width: calc(100% - 28px); margin: 4px 14px 12px; border-collapse: collapse;
}
table.lst-products th, table.lst-products td {
    padding: 8px 10px; text-align: left; font-size: 13px;
    border-bottom: 1px solid #eef0f4;
}
table.lst-products th {
    color: #6b7280; font-weight: 500; text-transform: uppercase; font-size: 11px;
    letter-spacing: .04em;
}
table.lst-products tbody tr:last-child td { border-bottom: 0; }
table.lst-products .drag-handle { padding-left: 0; }

/* Inline-Editor-Zeilen (Add/Edit Group/Bundle) */
.lst-inline-row {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    padding: 10px 14px; background: #f0f7ff; border: 1px solid #c7ddfa;
    border-radius: 8px; margin: 4px 0;
}
.lst-inline-row input[type="text"],
.lst-inline-row input[type="number"],
.lst-inline-row select {
    flex: 1 1 auto; min-width: 140px; padding: 6px 10px;
    border: 1px solid #d1d5db; border-radius: 6px; font: inherit; background: #fff;
}
.lst-inline-row input[type="number"] { max-width: 100px; flex: 0 0 auto; }
.lst-inline-row select { max-width: 280px; }

/* Inline-Editor in der Products-Tabelle: kein Block-Layout, in <tr> integriert */
tr.lst-inline-row {
    display: table-row; background: #f0f7ff; border: none; padding: 0; margin: 0;
}
tr.lst-inline-row td { vertical-align: middle; }
tr.lst-inline-row input[type="text"],
tr.lst-inline-row input[type="number"] {
    width: 100%; padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px;
    font: inherit; background: #fff; box-sizing: border-box;
}
tr.lst-inline-row input[type="number"] { max-width: 100px; }

/* 2-Klick-Loesch-Bestaetigung (Inline) */
.lst-confirm-actions {
    display: inline-flex; gap: 6px; align-items: center;
    background: #fff7ed; padding: 4px 8px; border-radius: 6px; border: 1px solid #fed7aa;
}

/* Toast (Fehlermeldungen statt alert()) */
.lst-toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 10000;
    background: #1c2028; color: #fff; padding: 12px 18px; border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,.2); font-size: 14px;
    opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
    pointer-events: none;
}
.lst-toast.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.lst-toast.is-error  { background: #b91c1c; }
.lst-toast.is-success { background: #047857; }

/* =========================================================
   Checkbox-Field im Helpdesk-Frontend-Formular
   ========================================================= */
.form-group-checkbox label.checkbox-row {
    display: inline-flex; align-items: center; gap: 10px;
    cursor: pointer; user-select: none;
    font-weight: 400; color: #1c2028;
}
.form-group-checkbox label.checkbox-row input[type="checkbox"] {
    appearance: auto;
    width: 18px; height: 18px;
    flex: 0 0 auto;
    margin: 0;
    accent-color: var(--brand-primary, #2563eb);
    cursor: pointer;
}
.form-group-checkbox label.checkbox-row span { line-height: 1.4; }

/* =========================================================
   Helpdesk-Formular-Builder
   ========================================================= */
.hf-form .form-group { max-width: 720px; }
#hf-fields { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.hf-field {
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
}
.hf-field-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: #f1f3f8; border-bottom: 1px solid #e2e6ee;
}
.hf-field-header strong { flex: 1; }
.hf-field-body { padding: 14px 16px; }
.hf-add-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 22px; }

/* =========================================================
   Freigabe-Log
   ========================================================= */
/* Webhook-Konfig-Karte im Freigabe-Log */
.webhook-card {
    background: #f8fafb; border: 1px solid #e2e6ee;
    border-radius: 12px; padding: 16px 18px;
    margin: 12px 0 8px;
}
.webhook-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 18px; align-items: end;
}
.webhook-row .form-group { margin: 0; }
.webhook-url-group input { width: 100%; }
.webhook-url-group .hint { display: block; margin-top: 4px; color: #6b7280; font-size: 12px; }
.webhook-url-group code {
    background: #fff; padding: 1px 6px; border-radius: 4px;
    border: 1px solid #e2e6ee; font-size: 11px;
}
.webhook-toggle-group { padding-bottom: 6px; }
@media (max-width: 720px) {
    .webhook-row { grid-template-columns: 1fr; }
}

.filter-toolbar {
    display: grid;
    /* Datum kompakt, Status schmal, Such-Feld bekommt den Rest, Actions auto */
    grid-template-columns: 150px 150px 120px minmax(180px, 1fr) auto;
    gap: 14px; align-items: end;
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    padding: 14px 18px; margin: 16px 0 24px;
}
.filter-toolbar .form-group { margin: 0; min-width: 0; }
.filter-toolbar input,
.filter-toolbar select { width: 100%; }
.filter-toolbar .filter-actions {
    display: flex; gap: 8px; flex-wrap: nowrap; align-items: center;
}
/* Schmale Viewports: klappt auf zwei Reihen */
@media (max-width: 900px) {
    .filter-toolbar {
        grid-template-columns: 1fr 1fr;
    }
    .filter-toolbar .filter-search,
    .filter-toolbar .filter-actions { grid-column: 1 / -1; }
}
.pagination {
    display: flex; gap: 14px; align-items: center; justify-content: center;
    margin: 24px 0; color: #6b7280; font-size: 14px;
}
.pagination a { color: #1c2028; text-decoration: none; font-weight: 500; }
.pagination a:hover { text-decoration: underline; }

table.data.detail th {
    text-align: left; width: 180px; background: #f8f9fb;
    font-weight: 500;
}
.signature-image {
    max-width: 500px; height: auto; background: #fff;
    border: 1px solid #e2e6ee; border-radius: 8px; padding: 8px;
    display: block; margin-top: 12px;
}
.signature-text {
    background: #f8f9fb; padding: 14px; border-radius: 8px;
    font-family: monospace; font-size: 13px; white-space: pre-wrap;
}

/* =========================================================
   Toggle-Switches (modern, an iOS angelehnt) — fuer alle
   Boolean-Settings im Admin-Bereich.
   ========================================================= */
/* Doppel-Selektor (label.toggle-switch + .form-group label.toggle-switch),
   damit `.form-group label { display: block; … }` (in app.css Form-Group-Block)
   den Toggle nicht zum block-level macht — sonst verlieren slider/::before
   ihre Dimensionen und der Knopf landet mittig im Label-Text. */
.toggle-switch,
.form-group label.toggle-switch {
    position: relative;
    display: inline-flex; align-items: center; gap: 12px;
    cursor: pointer; user-select: none;
    padding: 6px 0;
    margin-bottom: 0;
    color: inherit; font-size: 14px;
}
/* Visually-hidden — bleibt fokussierbar, nimmt aber keinen Platz im Flow.
   Wichtig: NICHT display:none (sonst nicht fokussierbar/screenreader-stumm). */
.toggle-switch input[type="checkbox"] {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.toggle-slider {
    position: relative; flex: 0 0 auto;
    width: 42px; height: 24px;
    background: #d1d5db; border-radius: 12px;
    transition: background .2s ease;
}
.toggle-slider::before {
    content: ""; position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    background: #fff; border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s ease;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--btn-primary-bg, #e94e1b);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}
.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid #1c2028; outline-offset: 2px;
}
.toggle-switch input:disabled + .toggle-slider {
    opacity: .5; cursor: not-allowed;
}
.toggle-label { font-size: 14px; color: #1c2028; }

/* Layout-Helfer */
.toggle-row { margin: 12px 0 24px; }
.toggle-section-label {
    display: block; font-weight: 600; color: #1c2028;
    margin-bottom: 8px;
}
.toggle-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 6px 14px; margin-top: 8px;
}

/* =========================================================
   Ticket-Detail (Verlauf: Kommentare, Mails, Leistungen)
   ========================================================= */
.ticket-subject { font-size: 18px; color: #1c2028; }
.ticket-meta {
    display: flex; gap: 24px; flex-wrap: wrap;
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    padding: 12px 16px; margin: 16px 0;
}
.ticket-description {
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    padding: 18px 22px; margin-bottom: 24px;
}
.ticket-description h2 { margin-top: 0; }
.ticket-content { font-size: 15px; line-height: 1.6; }

.history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.history-entry {
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    padding: 14px 18px;
}
.history-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
    flex-wrap: wrap;
}
.history-header strong { flex: 1; font-size: 15px; }
.history-date { font-size: 12px; color: #6b7280; }
.history-body { font-size: 14px; line-height: 1.55; color: #1c2028; }

.history-badge {
    display: inline-block; padding: 2px 8px; border-radius: 6px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em;
}
.badge-comment    { background: #dbeafe; color: #1e40af; }
.badge-mail-in    { background: #d1fae5; color: #065f46; }
.badge-mail-out   { background: #fef3c7; color: #92400e; }
.badge-support    { background: #ede9fe; color: #5b21b6; }

.history-mail .history-mail-meta,
.history-support .history-support-meta {
    font-size: 13px; color: #4b5563; margin-bottom: 8px;
    display: flex; gap: 16px; flex-wrap: wrap;
}
.history-mail.mail-inbound  { border-left: 3px solid #28a745; }
.history-mail.mail-outbound { border-left: 3px solid #ff9800; }
.history-support           { border-left: 3px solid #8b5cf6; }

.ticket-comment-form {
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    padding: 18px 22px; margin-top: 28px;
}

/* =========================================================
   Ticket-Liste (Karten-Style wie V1)
   ========================================================= */
.ticket-filter {
    display: flex; flex-wrap: wrap; gap: 14px; align-items: end;
    justify-content: center;
    padding: 14px 18px; margin: 16px 0 18px;
}
.ticket-filter .form-group { margin: 0; }
.ticket-filter-actions { display: flex; align-items: end; }

.ticket-create-button-container {
    margin: 16px 0;
    text-align: center;
}

#ticket-listing, #docs-list { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.list-item {
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    padding: 14px 18px;
    display: grid;
    grid-template-columns: 60px 1fr auto;
    grid-template-areas:
        "icon  title  actions"
        "icon  meta   actions";
    column-gap: 16px; row-gap: 6px; align-items: center;
}
.list-item-open {
    border-color: #ff9800;
    box-shadow: 0 0 0 2px rgba(255,152,0,.12);
}

.list-item-image { grid-area: icon; color: #1c2028; }
.list-item-image svg { width: 40px; height: 40px; }
.list-item-open .list-item-image { color: #ff9800; }

.list-item-title { grid-area: title; font-size: 16px; font-weight: 600;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.list-item-content { grid-area: meta; display: flex; gap: 20px; flex-wrap: wrap;
    font-size: 13px; color: #4b5563; align-items: center; }
.list-item-content .date strong, .list-item-content .ticket-info strong { color: #1c2028; }

.list-item-actions {
    grid-area: actions; display: inline-flex; gap: 10px; align-items: center;
    justify-content: flex-end; white-space: nowrap;
}
.list-item-actions form { display: inline; margin: 0; }

/* Skeleton-Variante fuer asynchron geladene Beleglisten.
   Nutzt die bestehende skeletonPulse-Animation aus dem Dashboard-Block. */
.list-item-skeleton { opacity: .8; }
.list-item-skeleton .list-item-image {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
}
.list-item-skeleton .skeleton-line {
    height: 12px; border-radius: 4px; background: #e5e7eb;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    margin: 6px 0;
}
.list-item-skeleton .skeleton-line-lg { height: 16px; width: 50%; }
.list-item-skeleton .skeleton-line-sm { width: 30%; }
/* Listen-Action-Buttons elegant groesser — gleichmaessige Min-Breite,
   subtile Schatten + Hover-Lift, ohne klobig zu werden. */
.list-item-actions .btn,
.list-item-actions .btn-sm {
    min-width: 110px; padding: 10px 20px; font-size: 14px; font-weight: 600;
    border-radius: 8px; text-align: center; letter-spacing: .2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.list-item-actions .btn:hover:not(:disabled),
.list-item-actions .btn-sm:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .08);
}
.list-item-actions .btn:disabled,
.list-item-actions .btn-sm:disabled { opacity: .55; cursor: not-allowed; }

/* Status-Tags fuer Listen (Tickets + Dokumente) */
.status-tag {
    display: inline-block; padding: 3px 10px; border-radius: 6px;
    font-size: 12px; font-weight: 600;
    white-space: nowrap;
}
.tag-default { background: #f1f3f8; color: #4b5563; }
.tag-warning { background: #fef3c7; color: #92400e; }
.tag-success { background: #d1fae5; color: #065f46; }
.tag-info    { background: #dbeafe; color: #1e40af; }
.tag-danger  { background: #fee2e2; color: #991b1b; }

/* Responsive: bei schmalen Viewports Buttons unter Inhalt */
@media (max-width: 720px) {
    .list-item {
        grid-template-columns: 60px 1fr;
        grid-template-areas:
            "icon    title"
            "meta    meta"
            "actions actions";
    }
    .list-item-actions { justify-content: flex-start; }
}

.ticket-pagination { margin: 24px 0; }
.no-documents-message {
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    padding: 30px; text-align: center; color: #6b7280;
}

/* =========================================================
   Dokumente-Liste (Angebote/Aufträge/Rechnungen/Mahnungen)
   nutzt das gleiche Karten-Schema wie Tickets, daher nur
   wenige Anpassungen:
   ========================================================= */
.doc-filter {
    display: flex; flex-wrap: wrap; gap: 14px; align-items: end;
    justify-content: center;
    padding: 14px 18px; margin: 16px 0 18px;
}
.doc-filter .form-group { margin: 0; }
.doc-filter-actions { display: flex; align-items: end; }

.doc-download-form { display: inline; margin: 0; }
.doc-count { color: #6b7280; margin: 8px 0 24px; }

/* =========================================================
   Dashboard (V1-Stil — 4 Bereiche)
   ========================================================= */
.dashboard-section { margin: 24px 0 32px; }
.dashboard-section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.dashboard-section-header h2 { margin: 0; }

/* Bereich 1: Metriken — V1-Optik: blau gefuellter Pie-Anteil + farbige Title-Bar */
.metrics-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}
.group-tile.dashboard-tile {
    display: flex; flex-direction: column; align-items: stretch;
    background: #fff; border: none; border-radius: 8px;
    overflow: hidden; text-decoration: none; color: inherit;
    transition: all .2s ease;
}
.group-tile.dashboard-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.07);
}
.group-tile.dashboard-tile .tile-content {
    background: transparent;
    display: flex; justify-content: center; align-items: center;
    padding: 30px 15px;
}
.pie-chart-container {
    position: relative; width: 180px; height: 180px; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
}
.pie-chart-container .pie-chart {
    width: 180px; height: 180px; border-radius: 50%; display: block;
}
.pie-center {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    text-align: center; pointer-events: none;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 10;
    background: rgba(255, 255, 255, 0.85);
    padding: 12px 30px; border-radius: 8px;
    /* V1: width 80% (=144 bei 180px Container) + 60px padding = 204px total -> 24px Ueberstand.
       box-sizing:content-box explizit, damit Padding zusaetzlich wirkt (unabhaengig vom Default). */
    width: 80%; box-sizing: content-box;
}
.pie-total { font-size: 1.5em; font-weight: 700; color: #333; line-height: 1; }
.pie-ratio { font-size: 1.5em; font-weight: 700; color: #333; line-height: 1; }
.pie-label { font-size: .85em; font-weight: 600; color: #666; margin-top: 5px; }

.metric-title {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 15px; font-size: 1.1em; font-weight: 700;
    background-color: #f9f9f9; color: #333;
    border-top: 1px solid #ddd; border-radius: 0 0 8px 8px;
}
.metric-title .tile-icon {
    margin-right: 8px; font-style: normal;
    display: inline-flex; align-items: center; justify-content: center;
}
.metric-title .tile-icon svg { vertical-align: middle; }

/* Metrik-Skeleton (vor AJAX-Response) */
.metric-tile-skeleton {
    pointer-events: none; display: flex; flex-direction: column; align-items: stretch;
    background: #fff; border: none; border-radius: 8px; overflow: hidden;
}
.metric-tile-skeleton .metric-pie {
    padding: 30px 15px; display: flex; align-items: center; justify-content: center;
}
.pie-skeleton {
    width: 180px; height: 180px; border-radius: 50%;
    background: #e5e7eb; display: flex; align-items: center; justify-content: center;
}
.pie-spinner {
    width: 32px; height: 32px; border-radius: 50%;
    border: 3px solid rgba(28,32,40,.12); border-top-color: #1c2028;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Inline-Spinner fuer Buttons (PDF-Download etc.) — uebernimmt die
   currentColor des Buttons, sodass er sich automatisch ans Button-Theme
   anpasst. */
.btn-spinner {
    display: inline-block; vertical-align: -3px;
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    opacity: .7;
    animation: spin .7s linear infinite;
}
.metric-title-skeleton {
    background: #e5e7eb; color: transparent !important; min-height: 44px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}
@keyframes skeletonPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .55; }
}
.metrics-error {
    grid-column: 1 / -1;
    background: #fee2e2; color: #991b1b;
    padding: 18px; border-radius: 10px; text-align: center;
}

/* Bereich 3: Helpdesk-Formulare */
.helpdesk-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}
.helpdesk-tile {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 16px 18px; background: #fff;
    border: 1px solid #e2e6ee; border-radius: 10px;
    text-decoration: none; color: #1c2028; transition: all .2s ease;
}
.helpdesk-tile:hover { border-color: #1c2028; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.07); }
.helpdesk-tile-icon { color: #1c2028; flex: 0 0 28px; }
.helpdesk-tile-body strong { display: block; font-size: 15px; margin-bottom: 4px; }
.helpdesk-tile-body p { margin: 0; font-size: 13px; color: #6b7280; line-height: 1.5; }

/* Bereich 4: Social-Posts (V1-Stil — Image-Cards mit Hover-Overlay) */
.plusleads-social-media { width: 100%; }
.plusleads-social-media .social-media-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}
.plusleads-social-media .social-post {
    background: #fff; border-radius: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    height: 460px;
    position: relative;
    overflow: hidden;
    transition: all .3s ease;
}
.plusleads-social-media .social-post:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,.12);
}

.plusleads-social-media .post-image {
    width: 100%; height: 100%; overflow: hidden;
    background: #f0f0f0;
    position: absolute; inset: 0;
}
.plusleads-social-media .post-image-placeholder {
    background: linear-gradient(135deg, #1c2028, #4b5563);
}
.plusleads-social-media .post-image img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .3s ease;
}
.plusleads-social-media .social-post:hover .post-image img {
    transform: scale(1.05);
}

.plusleads-social-media .post-platform-overlay {
    position: absolute; top: 15px; right: 15px; z-index: 10;
}
.plusleads-social-media .post-date-overlay {
    position: absolute; bottom: 15px; right: 15px; z-index: 10;
}
.plusleads-social-media .post-date-overlay .post-date {
    background: rgba(0, 0, 0, .7); color: #fff;
    padding: 6px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 500;
    backdrop-filter: blur(5px);
}

.plusleads-social-media .platform-badge {
    display: inline-block; padding: 6px 14px; border-radius: 20px;
    font-size: 13px; font-weight: 600;
    background: rgba(255, 255, 255, .95); color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    backdrop-filter: blur(5px);
}
.plusleads-social-media .platform-badge.platform-facebook  { background: rgba(24, 119, 242, .95); color: #fff; }
.plusleads-social-media .platform-badge.platform-instagram { background: linear-gradient(45deg, rgba(228, 64, 95, .95), rgba(252, 175, 69, .95)); color: #fff; }
.plusleads-social-media .platform-badge.platform-linkedin  { background: rgba(0, 119, 181, .95); color: #fff; }
.plusleads-social-media .platform-badge.platform-twitter,
.plusleads-social-media .platform-badge.platform-x         { background: rgba(29, 161, 242, .95); color: #fff; }
.plusleads-social-media .platform-badge.platform-google,
.plusleads-social-media .platform-badge.platform-youtube,
.plusleads-social-media .platform-badge.platform-tiktok    { background: rgba(66, 133, 244, .95); color: #fff; }

.plusleads-social-media .post-content {
    position: absolute; inset: 0; z-index: 20;
    background: rgba(0, 0, 0, .85); color: #fff;
    font-size: 15px; line-height: 1.7;
    padding: 25px;
    opacity: 0; transition: opacity .3s ease;
    overflow-y: auto;
}
.plusleads-social-media .social-post:hover .post-content { opacity: 1; }
.plusleads-social-media .post-content::-webkit-scrollbar { width: 8px; }
.plusleads-social-media .post-content::-webkit-scrollbar-track { background: rgba(255,255,255,.1); border-radius: 4px; }
.plusleads-social-media .post-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 4px; }
.plusleads-social-media .post-content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.5); }

/* Social-Post-Skeleton — sichtbar waehrend AJAX-Fetch laeuft */
.plusleads-social-media .social-post-skeleton {
    background: #fff; border: 1px solid #e0e0e0; border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    height: 460px; position: relative; overflow: hidden; pointer-events: none;
}
.plusleads-social-media .social-post-skeleton .post-image-placeholder {
    width: 100%; height: 60%;
    background: #e5e7eb;
    display: flex; align-items: center; justify-content: center;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}
.plusleads-social-media .social-post-skeleton .post-content {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: #fff; padding: 18px;
    display: flex; flex-direction: column; gap: 10px;
    height: 40%;
}
.plusleads-social-media .social-post-skeleton .skeleton-line {
    height: 12px; border-radius: 4px;
    background: #e5e7eb;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}
.plusleads-social-media .social-post-skeleton .skeleton-line-lg { height: 18px; width: 70%; }
.plusleads-social-media .social-post-skeleton .skeleton-line-sm { width: 40%; }

/* =========================================================
   Mitteilungen / Postfach
   ========================================================= */
.dashboard-messages {
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    padding: 18px 22px; margin: 16px 0 24px;
}
.dashboard-messages-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.dashboard-messages-header h2 { margin: 0; }

.messages-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.message-card {
    display: block; background: #fff; border: 1px solid #e2e6ee;
    border-radius: 10px; padding: 16px 18px; text-decoration: none;
    color: #1c2028; transition: all .2s ease;
}
.message-card:hover {
    border-color: #1c2028; transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.07);
}
.message-card.unread { border-left: 3px solid #ff9800; }
.message-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px; gap: 8px;
}
.message-card-date { font-size: 12px; color: #6b7280; }
.message-card-title { margin: 0 0 6px; font-size: 16px; }
.message-card-excerpt { margin: 0; font-size: 13px; color: #4b5563; line-height: 1.5; }

.messages-list-read { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.message-row {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 14px; background: #fff;
    border: 1px solid #e2e6ee; border-radius: 8px;
    text-decoration: none; color: #4b5563; transition: all .2s ease;
}
.message-row:hover { border-color: #1c2028; color: #1c2028; }
.message-row-icon { color: #9aa0a8; flex: 0 0 20px; }
.message-row-content { flex: 1; display: flex; align-items: baseline; gap: 12px; }
.message-row-content strong { color: #1c2028; }
.message-row-date { font-size: 12px; color: #6b7280; }
.message-row-link { font-size: 13px; color: #4b5563; }

.message-detail {
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    padding: 22px 26px; max-width: 800px;
}
.message-detail-header {
    display: flex; align-items: baseline; justify-content: space-between;
    border-bottom: 1px solid #eef0f4; padding-bottom: 12px; margin-bottom: 16px; gap: 14px;
}
.message-detail-header h1 { margin: 0; font-size: 22px; }
.message-detail-body { font-size: 15px; line-height: 1.6; }

h1 { font-size: 28px; margin: 0 0 16px; }
h2 { font-size: 22px; margin: 24px 0 12px; }

.login-card {
    max-width: 420px; margin: 60px auto; background: #fff;
    border: 1px solid #e2e6ee; border-radius: 12px; padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: #4b5563; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 15px; background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: #E94E1B;
}

.btn {
    display: inline-block; padding: 10px 18px; border: 0; border-radius: 8px;
    font-size: 15px; font-weight: 500; cursor: pointer;
    text-decoration: none; line-height: 1.2;
}
.btn-primary { background: var(--btn-primary-bg, #e94e1b); color: var(--btn-primary-text, #fff); }
.btn-primary:hover { background: var(--btn-primary-hover, #c43d12); color: var(--btn-primary-text, #fff); }
.btn-secondary { background: var(--btn-secondary-bg, #e5e7eb); color: var(--btn-secondary-text, #1a1d28); }
.btn-secondary:hover { background: var(--btn-secondary-hover, #d4d7df); color: var(--btn-secondary-text, #1a1d28); }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-danger:hover { background: #fca5a5; color: #7f1d1d; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0; border-radius: 6px;
}
.btn-icon svg { width: 16px; height: 16px; display: block; }

.row-actions { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.row-actions form { display: inline; margin: 0; }

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

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info  { background: #dbeafe; color: #1e40af; }
.alert-success { background: #d1fae5; color: #065f46; }

.flash { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }

.hint { font-size: 13px; color: #6b7280; margin-top: 18px; }

/* Tabellen */
table.data { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden;
             box-shadow: 0 1px 3px rgba(0,0,0,.04); margin: 16px 0; }
table.data th { text-align: left; padding: 12px 14px; background: #f1f3f8; font-size: 13px;
                text-transform: uppercase; letter-spacing: .04em; color: #4b5563; border-bottom: 1px solid #e2e6ee; }
table.data td { padding: 12px 14px; border-bottom: 1px solid #eef0f4; font-size: 14px; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fbfbfd; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.badge-open { background: #fef3c7; color: #92400e; }
.badge-done { background: #d1fae5; color: #065f46; }

footer { color: #6b7280; font-size: 13px; padding: 30px 20px; }
.anschrift { margin-top: 8px; }

/* =========================================================
   Tenant-Form (Master-Admin)
   ========================================================= */
.tenant-form { max-width: 800px; margin: 0 auto; }
.tenant-form-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px;
}
.tenant-form-header h1 { margin: 0; }
.tenant-form-section {
    background: #fff; border: 1px solid #e2e6ee; border-radius: 10px;
    padding: 18px 22px; margin: 0 0 18px;
}
.tenant-form-section legend {
    padding: 0 8px; font-weight: 600; color: #1c2028;
}
.tenant-form-actions { display: flex; gap: 10px; margin-top: 18px; }

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

.color-picker { display: flex; gap: 8px; align-items: center; }
.color-picker input[type="color"] {
    width: 50px; height: 38px; padding: 0; border: 1px solid #d1d5db;
    border-radius: 8px; cursor: pointer; background: none;
}
.color-picker input[type="text"] { flex: 1; font-family: monospace; }

/* Branding-Admin: Color-Picker-Grid */
.branding-color-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px; margin-bottom: 18px;
}
.branding-color-grid input[type="color"] {
    width: 100%; height: 42px; padding: 0; border: 1px solid #d1d5db;
    border-radius: 8px; cursor: pointer; background: none;
}
.branding-hint { color: #6b7280; font-size: 13px; margin: -6px 0 12px; }

.logo-preview { margin-top: 8px; padding: 10px; border: 1px solid #e2e6ee;
    border-radius: 8px; background: #f8f9fb; display: inline-block; }
.logo-preview img { max-height: 60px; max-width: 200px; display: block; }

/* (alter Toggle-Block entfernt — siehe einheitliche Definition oben.) */

/* =========================================================
   Login-Page (V1-Optik) — vollflächiger Gradient,
   animiertes Grid, schwebende Shapes, transparente Box.
   Farben werden pro Tenant via CSS-Variablen gesetzt.
   ========================================================= */
.plus-login-page {
    position: fixed; inset: 0; margin: 0; padding: 0; overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}
.plus-login-background {
    position: absolute; inset: 0; overflow: hidden;
    background: linear-gradient(135deg, var(--plus-color-1, #E94E1B) 0%, var(--plus-color-2, #1c2028) 100%);
}
.plus-login-background::before {
    content: ""; position: absolute; width: 200%; height: 200%; top: -50%; left: -50%;
    background-image:
        repeating-linear-gradient(0deg,  rgba(255,255,255,.05) 0px, transparent 1px, transparent 40px, rgba(255,255,255,.05) 41px),
        repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0px, transparent 1px, transparent 40px, rgba(255,255,255,.05) 41px);
    animation: plusGridMove 20s linear infinite;
}
@keyframes plusGridMove {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(40px, 40px); }
}
.plus-login-shapes { position: absolute; inset: 0; }
.plus-login-shapes .shape {
    position: absolute; border-radius: 50%;
    background: rgba(255,255,255,.1); backdrop-filter: blur(10px);
    animation: plusFloat 20s ease-in-out infinite;
}
.plus-login-shapes .shape:nth-child(1) { width: 300px; height: 300px; top: 10%;    left: 10%;  animation-delay: 0s;    }
.plus-login-shapes .shape:nth-child(2) { width: 200px; height: 200px; top: 60%;    right: 15%; animation-delay: -5s;   }
.plus-login-shapes .shape:nth-child(3) { width: 150px; height: 150px; bottom: 10%; left: 20%;  animation-delay: -10s;  }
@keyframes plusFloat {
    0%, 100% { transform: translate(0, 0)     rotate(0deg);   }
    25%      { transform: translate(20px,20px) rotate(90deg);  }
    50%      { transform: translate(0, 40px)  rotate(180deg); }
    75%      { transform: translate(-20px,20px) rotate(270deg); }
}
.plus-login-container {
    position: relative; display: flex; justify-content: center; align-items: center;
    min-height: 100vh; z-index: 1;
}
.plus-login-box {
    background: transparent; backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.2); border-radius: 20px;
    padding: 50px 40px; width: 100%; max-width: 420px;
    animation: plusSlideUp .6s ease-out;
}
@keyframes plusSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
.plus-login-logo { text-align: center; margin-bottom: 40px; }
.plus-login-logo img { max-width: 200px; height: auto; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }
.plus-login-logo .name { color: #fff; font-size: 26px; font-weight: 600; letter-spacing: .02em;
    text-shadow: 0 2px 8px rgba(0,0,0,.25); }

.plus-login-form .form-group { margin-bottom: 25px; }
.plus-login-form label {
    display: block; font-size: 14px; font-weight: 500; color: #fff; margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.plus-login-form input[type="text"],
.plus-login-form input[type="email"],
.plus-login-form input[type="password"] {
    width: 100%; padding: 14px 16px; font-size: 15px;
    border: 2px solid rgba(255,255,255,.3); border-radius: 10px;
    background: rgba(255,255,255,.9); transition: all .3s ease; box-sizing: border-box;
}
.plus-login-form input[type="text"]:focus,
.plus-login-form input[type="email"]:focus,
.plus-login-form input[type="password"]:focus {
    outline: none; border-color: rgba(255,255,255,.8); background: #fff;
}
.plus-login-form input[type="submit"],
.plus-login-form button[type="submit"] {
    width: 100%; padding: 14px 16px; font-size: 15px; font-weight: 600;
    color: #fff; background: rgba(255,255,255,.25);
    border: 2px solid rgba(255,255,255,.4); border-radius: 10px;
    cursor: pointer; transition: all .3s ease; margin-top: 10px; box-sizing: border-box;
}
.plus-login-form input[type="submit"]:hover,
.plus-login-form button[type="submit"]:hover {
    background: rgba(255,255,255,.35); border-color: rgba(255,255,255,.6);
}
.plus-login-error {
    background: rgba(220,53,69,.2); border: 1px solid rgba(220,53,69,.5);
    border-left: 4px solid #dc3545; color: #fff;
    padding: 12px 16px; border-radius: 8px; margin-bottom: 20px;
    font-size: 14px; backdrop-filter: blur(10px);
}
.plus-login-info {
    background: rgba(59,130,246,.2); border: 1px solid rgba(59,130,246,.5);
    border-left: 4px solid #3b82f6; color: #fff;
    padding: 12px 16px; border-radius: 8px; margin-bottom: 20px;
    font-size: 14px; backdrop-filter: blur(10px);
}
.plus-login-hint {
    margin-top: 24px; font-size: 13px; color: rgba(255,255,255,.7); text-align: center;
}
.plus-login-optional { font-size: 13px; color: rgba(255,255,255,.7); font-weight: 400; }

/* Fehlerseiten (404/403/429/...) — gleicher Stil wie Login-Box */
.plus-error-code {
    font-size: 64px; font-weight: 700; letter-spacing: .05em;
    text-align: center; margin: 8px 0 4px;
    color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.plus-error-message {
    text-align: center; margin: 0 0 24px;
    color: rgba(255,255,255,.85); font-size: 15px; line-height: 1.5;
}

/* Rate-Limit-Banner (mehrzeilig, groesserer Block ohne Form) */
.plus-login-error.plus-login-rate-limited {
    border-left-width: 4px;
    padding: 18px 22px;
    line-height: 1.5;
}
.plus-login-error.plus-login-rate-limited strong { font-size: 15px; }
.plus-login-error.plus-login-rate-limited p { margin: 8px 0 0; font-size: 14px; }
.plus-login-actions { display: flex; justify-content: center; margin-top: 12px; }
.plus-login-link {
    color: #fff; text-decoration: none; padding: 10px 22px; border-radius: 8px;
    border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1);
    font-size: 14px; transition: background .2s ease;
}
.plus-login-link:hover { background: rgba(255,255,255,.25); }
