:root {
    /* Sigmatek CI: Dunkelblau 192B74, Blau 0B68B6, Grün AFC81A, Grau B3B9BD */
    --primary: #192b74;
    --primary-light: #0b68b6;
    --accent: #afc81a;
    --ci-grau: #b3b9bd;
    /* Karten-Cluster (Kartenkacheln sind immer hell, daher ohne dunkle Variante): Grundfarben von leaflet.markercluster,
       Deckkraft 0,3 statt 0,6 */
    --cluster-small: rgba(110, 204, 57, 0.3);
    --cluster-medium: rgba(240, 194, 12, 0.3);
    --cluster-large: rgba(241, 128, 23, 0.3);
    --cluster-text: #1a1a1a;
    --bg: #f3f5f7;
    --card: #fff;
    --text: #1c2230;
    --muted: #6c7378;          /* aus CI-Grau abgedunkelt (lesbar) */
    --border: #dcdfe2;         /* CI-Grau, aufgehellt */
    --tint-blue: #e7f0f8;      /* CI-Blau, aufgehellt */
    --tint-blue-light: #f2f7fb;
    --tint-green: #f2f6dc;     /* CI-Grün, aufgehellt */
    --tint-grey: #eceeef;
    --green-text: #5c7300;     /* CI-Grün abgedunkelt für Text (Kontrast) */
    --kunde: #8aa514;          /* Status Kunde: CI-Grün (Punkte, Marker) */
    --potenziell: #0b68b6;           /* Status potenzieller Kunde: CI-Blau */
    --chart-teams: #7b4fa8;    /* Diagramme: Teamsmeetings (Cockpit), CI hat dafür keine Farbe */
    --inaktiv: #9aa1a6;        /* Status inaktiv: CI-Grau */
    --error: #b3261e;
    --success: #5c7300;
    --primary-text: #192b74;   /* Dunkelblau als Schriftfarbe (im Dunkelmodus aufgehellt) */
    --btn-hover: #0b68b6;
    --input-bg: #fff;
    --hover-grey: #dcdfe2;
    --badge-text: #444;
    --comment-text: #3a4150;
    --group-bg: #e4e7f2;
    --warn-text: #b26a00;
    --warn-bg: #fff8e1;
    --warn-bg-strong: #fff3e0;
    --warn-border: #ef6c00;
    --error-bg: #fce8e6;
    --error-bg-light: #fff5f5;
    --internal-bg: #fffaf0;
    --logo-hell: block;        /* Logo-Variante je Farbschema (Anmeldeseite) */
    --logo-dunkel: none;
    --globe-filter: none;      /* Globus „Standard-Sprache“ */
    --overlay: rgba(16, 24, 48, 0.55);   /* Hintergrund hinter dem PDF-Fenster (halbtransparent) */
    --overlay-panel: rgba(255, 255, 255, 0.82);
    color-scheme: light;
}

/* Dunkelmodus: Settings → Darstellung „Dunkel“ oder „System“ bei dunkler Einstellung von Windows/Browser */
:root[data-theme="dunkel"] {
    --primary: #1f3a8f;
    --primary-light: #5ba3dc;
    --bg: #12161f;
    --card: #1b212c;
    --text: #e3e7ec;
    --muted: #9aa3ab;
    --border: #2e3643;
    --tint-blue: #1a2c45;
    --tint-blue-light: #172233;
    --tint-green: #26301a;
    --tint-grey: #262d38;
    --green-text: #b5cf4a;
    --kunde: #9cbc1a;
    --potenziell: #3d8fd6;
    --chart-teams: #b48ee0;
    --inaktiv: #7a8288;
    --error: #f28b82;
    --success: #b5cf4a;
    --primary-text: #8fb8ea;
    --btn-hover: #0b68b6;
    --input-bg: #11151d;
    --hover-grey: #313946;
    --badge-text: #c9ced4;
    --comment-text: #c3c9d0;
    --group-bg: #232c4d;
    --warn-text: #f0b54d;
    --warn-bg: #33290f;
    --warn-bg-strong: #3a2a14;
    --warn-border: #b26a00;
    --error-bg: #3b1f1e;
    --error-bg-light: #2f1a1a;
    --internal-bg: #2b2614;
    --logo-hell: none;
    --logo-dunkel: block;
    --globe-filter: invert(1) brightness(1.4);
    --overlay: rgba(0, 0, 0, 0.6);
    --overlay-panel: rgba(27, 33, 44, 0.85);
    --table-line: #3d4757;        /* Tabellen im Dunkelmodus: deutlichere Linien, Kopf und Streifen */
    --table-head-bg: #232b38;
    --table-stripe: rgba(255, 255, 255, 0.035);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root[data-theme="system"] {
        --primary: #1f3a8f;
        --primary-light: #5ba3dc;
        --bg: #12161f;
        --card: #1b212c;
        --text: #e3e7ec;
        --muted: #9aa3ab;
        --border: #2e3643;
        --tint-blue: #1a2c45;
        --tint-blue-light: #172233;
        --tint-green: #26301a;
        --tint-grey: #262d38;
        --green-text: #b5cf4a;
        --kunde: #9cbc1a;
        --potenziell: #3d8fd6;
        --chart-teams: #b48ee0;
        --inaktiv: #7a8288;
        --error: #f28b82;
        --success: #b5cf4a;
        --primary-text: #8fb8ea;
        --btn-hover: #0b68b6;
        --input-bg: #11151d;
        --hover-grey: #313946;
        --badge-text: #c9ced4;
        --comment-text: #c3c9d0;
        --group-bg: #232c4d;
        --warn-text: #f0b54d;
        --warn-bg: #33290f;
        --warn-bg-strong: #3a2a14;
        --warn-border: #b26a00;
        --error-bg: #3b1f1e;
        --error-bg-light: #2f1a1a;
        --internal-bg: #2b2614;
        --logo-hell: none;
        --logo-dunkel: block;
        --globe-filter: invert(1) brightness(1.4);
        --overlay: rgba(0, 0, 0, 0.6);
        --overlay-panel: rgba(27, 33, 44, 0.85);
        --table-line: #3d4757;        /* Tabellen im Dunkelmodus: deutlichere Linien, Kopf und Streifen */
        --table-head-bg: #232b38;
        --table-stripe: rgba(255, 255, 255, 0.035);
        color-scheme: dark;
    }
}
/* Eingabefelder, Karten-Popups und Textfelder folgen dem Farbschema */
input, select, textarea { color: var(--text); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card); color: var(--text); }
/* Cluster-Kreis knapp um die Zahl (app.js, iconCreateFunction) */
.cluster-compact { display: flex; align-items: center; justify-content: center; border-radius: 10px; font: 700 11px/1 sans-serif; color: var(--cluster-text); }
.cluster-compact.cluster-small { background: var(--cluster-small); }
.cluster-compact.cluster-medium { background: var(--cluster-medium); }
.cluster-compact.cluster-large { background: var(--cluster-large); }

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    font-family: "OfficinaSansEF", "Officina Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
}

body { display: flex; flex-direction: column; }

a { color: var(--primary-light); }

/* --- Kopfzeile ------------------------------------------------------------ */
.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0 1rem;
    height: 48px;
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
}
.topbar .brand { color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; }
.topbar .brand img { display: block; height: 30px; width: auto; }
.topbar nav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.topbar nav a { white-space: nowrap; }
.topbar nav a {
    color: #d6e2f2;
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
}
.topbar nav a:hover, .topbar nav a.active { background: rgba(255, 255, 255, 0.15); color: #fff; }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.topbar .user form { margin: 0; }
.topbar .link { color: #d6e2f2; }

/* --- Allgemeine Elemente -------------------------------------------------- */
main { padding: 1.5rem; }
.page-narrow main { max-width: 420px; margin: 3rem auto; width: 100%; }
.page-wide main { max-width: 1200px; margin: 0 auto; width: 100%; }
/* breite Arbeitstabellen (z. B. Opportunity-Import): ganze Bildschirmbreite */
.page-full main { max-width: none; width: 100%; padding-left: 1.25rem; padding-right: 1.25rem; }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.card > h3:first-child { margin-top: 0; }

.form { display: flex; flex-direction: column; gap: 0.9rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.form label, label.block { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; }
.form small, label small { font-weight: 400; color: var(--muted); }

input, select, button { font: inherit; }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select,
input[type=tel], input[type=date], input[type=number], input[type=url] {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--input-bg);
    width: 100%;
}

.btn {
    padding: 0.55rem 1.1rem;
    border: 0;
    border-radius: 5px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}
.btn:hover { background: var(--btn-hover); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-secondary { background: var(--tint-grey); color: var(--text); }
.btn-secondary:hover { background: var(--hover-grey); }
/* Im Seitenkopf alle Knöpfe blau (auch „Abbrechen“, „Zur Reiseliste“); vorgemerkte Reiseliste behält ihre Farbe */
.page-head .btn-secondary:not(.in-list) { background: var(--primary); color: #fff; }
.page-head .btn-secondary:not(.in-list):hover { background: var(--btn-hover); }
.link { background: none; border: 0; padding: 0; color: var(--primary-light); cursor: pointer; text-decoration: underline; }

.flash { padding: 0.7rem 1rem; margin: 0.75rem 1.5rem 0; border-radius: 5px; }
main .flash { margin: 0 0 1rem; }
.flash-success { background: var(--tint-green); color: var(--success); }
.flash-error { background: var(--error-bg); color: var(--error); }
.flash-info { background: var(--tint-blue); color: var(--primary-text); }
.flash-warn { background: var(--warn-bg); color: var(--warn-text); border-left: 4px solid var(--warn-border); }

/* Anleitung Zwei-Faktor-Anmeldung (zwei-faktor.php) */
.guide-steps { list-style: none; counter-reset: guide; padding: 0; margin: 0; display: grid; gap: 1rem; }
.guide-steps > li { counter-increment: guide; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1rem 1.5rem; align-items: start;
    padding: 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.guide-steps h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.guide-steps h2::before { content: counter(guide); display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; margin-right: 0.5rem;
    border-radius: 50%; background: var(--primary); color: #fff; font-size: 0.9rem; }
.guide-steps p { margin: 0.3rem 0; }
.guide-steps figure { margin: 0; text-align: center; }
.guide-steps img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; }
.guide-steps img.guide-phone { max-height: 300px; border: 0; }
.guide-steps figcaption { color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 1rem 0; }
@media (max-width: 720px) { .guide-steps > li { grid-template-columns: 1fr; } }

.hint { color: var(--muted); font-size: 0.88rem; }
details.hint { margin-top: 1rem; }
details.hint summary { cursor: pointer; }

.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; }
.table tr.muted td { color: var(--muted); }
.table .actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.table .actions form { margin: 0; }
.table .actions form.inline { display: flex; gap: 0.4rem; align-items: center; }
.table .actions input { width: 150px; padding: 0.3rem 0.4rem; }

/* --- Import ----------------------------------------------------------------- */
.stats { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.stat {
    flex: 1 1 120px;
    padding: 0.75rem;
    border-radius: 6px;
    background: var(--bg);
    font-size: 0.85rem;
    color: var(--muted);
}
.stat span { display: block; font-size: 1.6rem; font-weight: 700; color: var(--text); }
.stat-new span { color: var(--green-text); }
.stat-changed span { color: var(--potenziell); }
.stat-missing span { color: var(--warn-text); }
.stat-skipped span { color: var(--error); }
.actions-row { display: flex; gap: 0.75rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 1rem; }
.name-list { margin: 0; padding-left: 1.2rem; max-height: 320px; overflow: auto; }
.name-list small { color: var(--muted); }

/* --- Karte ------------------------------------------------------------------- */
.page-map { overflow: hidden; }
.page-map > .flash { margin-bottom: 0.75rem; }
.map-layout { flex: 1; display: flex; min-height: 0; }
.sidebar {
    width: 290px;
    flex-shrink: 0;
    padding: 1rem;
    overflow-y: auto;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.sidebar fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.sidebar legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; }
.sidebar fieldset label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.count { margin: 0; font-weight: 600; }
#map { flex: 1; padding: 0; }

.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #ccc; }
.dot-kunde { background: var(--kunde); }
.dot-potenziell { background: var(--potenziell); }
.dot-inaktiv { background: var(--inaktiv); }

.sidebar label.check { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; margin-top: -0.4rem; cursor: pointer; }
.legend { list-style: none; margin: -0.5rem 0 0; padding: 0; font-size: 0.85rem; display: flex; flex-direction: column; gap: 0.2rem; }
.legend li { display: flex; align-items: center; gap: 0.4rem; cursor: default; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; opacity: 0.8; }

.ranges { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.range { background: var(--bg); border-radius: 4px; padding: 1px 6px; font-size: 0.8rem; white-space: nowrap; }
.range-form { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.range-form select { width: auto; min-width: 180px; padding: 0.25rem 0.4rem; }
.color-form input[type=color] { width: 36px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; }

.geocode-panel { background: var(--warn-bg); border-radius: 6px; padding: 0.75rem; font-size: 0.9rem; }
.geocode-panel p { margin: 0 0 0.5rem; }
.geocode-panel progress { width: 100%; }

/* Popup */
.popup h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.popup p { margin: 0.5rem 0; }
.popup .details { border-collapse: collapse; font-size: 0.85rem; width: 100%; }
.popup .details th { text-align: left; color: var(--muted); font-weight: 500; padding: 2px 8px 2px 0; vertical-align: top; white-space: nowrap; }
.popup .details td { padding: 2px 0; }
.popup .description { font-size: 0.85rem; background: var(--bg); padding: 0.5rem; border-radius: 4px; max-height: 120px; overflow: auto; }
.cockpit-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.cockpit-figure { display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem; background: var(--bg); border-radius: 8px; }
.cockpit-acquired { background: var(--tint-green); }
.cockpit-label { font-weight: 600; color: var(--muted); }
.cockpit-value { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cockpit-note { grid-column: 1 / -1; margin: 0; }
.row-self td { background: var(--tint-blue-light); }
.table tfoot th { border-top: 2px solid var(--border); }
.chart-box.chart-box-tall { height: 340px; }
.change { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.change.change-up { color: var(--green-text); }
.change.change-down { color: var(--error); }
.change.change-none { color: var(--muted); font-weight: 400; }
.stat span.change { display: inline; font-size: inherit; }
.customer-years { font-size: 0.88rem; }
.customer-years .muted-value { color: var(--ci-grau); }
.chart-box { position: relative; height: 280px; margin: 0.5rem 0 1rem; }
.revenue-table { font-size: 0.8rem; }
.revenue-table td { white-space: nowrap; }
.revenue-table td.negative { color: var(--error); }
.popup-umsatz { background: var(--tint-green); border-radius: 4px; padding: 0.4rem 0.5rem; font-size: 0.85rem; }
.badge { display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 10px; background: var(--tint-grey); color: var(--badge-text); margin-right: 4px; }
.badge-kunde { background: var(--tint-green); color: var(--green-text); }
.badge-potenziell { background: var(--tint-blue); color: var(--potenziell); }
.badge-inaktiv { background: var(--tint-grey); color: var(--muted); }

/* --- Accounts-Liste ------------------------------------------------------------ */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin-bottom: 0.4rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; padding: 0.9rem 1rem; }
.filter-bar input[type=search] { flex: 1 1 260px; width: auto; }
.filter-bar select { width: auto; max-width: 220px; }
.filter-bar .check { display: flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.table-hover tbody tr { cursor: pointer; }
.table-hover tbody tr:hover td { background: var(--tint-blue-light); }
.table th a { color: inherit; text-decoration: none; white-space: nowrap; }
.table th a:hover { text-decoration: underline; }
.table td a { color: var(--text); text-decoration: none; }
.nowrap { white-space: nowrap; }
.pagination { display: flex; gap: 0.75rem; justify-content: center; margin-top: 1rem; }
.pagination a { text-decoration: none; }

/* --- Account-Detail ------------------------------------------------------------ */
.breadcrumb { margin: 0 0 0.5rem; font-size: 0.9rem; }
.breadcrumb a { text-decoration: none; }
.account-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
.fields { display: grid; grid-template-columns: 180px 1fr; gap: 0.45rem 1rem; margin: 0; }
.fields dt { color: var(--muted); font-size: 0.9rem; }
.fields dd { margin: 0; word-break: break-word; }
.fields-compact { grid-template-columns: 110px 1fr; font-size: 0.9rem; }
.description-full { margin: 0; line-height: 1.5; }
.lock { color: var(--warn-text); font-size: 0.7rem; margin-left: 0.3rem; vertical-align: middle; cursor: help; }
.mini-map { height: 240px; border-radius: 6px; margin-bottom: 0.5rem; }
.mini-map.group-map { height: 340px; }
.pre-line { white-space: pre-line; margin: 0; }
.contact-description { margin-top: 0.45rem; }
.cat-icon { cursor: help; }
.file-icon { cursor: default; }
#dateien form.form .btn { align-self: flex-start; } /* Upload-Knopf nicht über die volle Kartenbreite */
.contact-filter { margin: 0 0 0.6rem; } /* auch Aktivitäten-Filter der Company-Seite */
.contact-filter select { width: auto; max-width: 240px; }
.totp-qr { margin: 0.6rem 0; width: 180px; padding: 8px; background: #fff; }
.totp-qr img, .totp-qr canvas { display: block; }
.setup-steps { padding-left: 1.2rem; margin: 0 0 0.8rem; }
.setup-steps li { margin-bottom: 0.6rem; }
.recovery-codes { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.3rem; }
.recovery-codes code { font-size: 1rem; letter-spacing: 0.05em; }
.flag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1.5rem; }
.flag-list li.on { font-weight: 600; }
.flag-list li.muted { color: var(--muted); }
.field-group { border: 0; padding: 0; margin: 0 0 1rem; }
.field-group legend { font-weight: 700; margin-bottom: 0.6rem; font-size: 1rem; }
.field-group .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.8rem; align-items: end; }
.field-group label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; }
.field-group label.check { flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 500; }
.span-all { grid-column: 1 / -1; }
.row-start { grid-column-start: 1; } /* beginnt im Raster eine neue Zeile (z. B. Von/Bis unter Datum) */
/* Uhrzeitfelder in Formularen wie die übrigen Eingabefelder (Aktivität: Von/Bis) */
.field-group input[type=time] { padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 5px; background: var(--input-bg); width: 100%; }
textarea { font: inherit; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 5px; width: 100%; resize: vertical; background: var(--input-bg); }
.history { list-style: none; margin: 0; padding: 0; font-size: 0.88rem; max-height: 420px; overflow: auto; }
.history li { padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.history-meta { color: var(--muted); font-size: 0.8rem; }
.history del { color: var(--muted); }

/* --- Kontakte -------------------------------------------------------------------- */
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.card-head h2 { margin: 0; }
.btn-small { padding: 0.3rem 0.75rem; font-size: 0.85rem; text-decoration: none; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.contact-list li:last-child { border-bottom: 0; }
.contact-list li.muted { opacity: 0.6; }
.contact-list li[hidden], .more-contacts > summary[hidden] { display: none; } /* hidden-Attribut gegen display: flex durchsetzen */
.contact-list a { text-decoration: none; }
.contact-list .hint { margin-top: 0.15rem; }
.contact-reach { display: flex; flex-direction: column; align-items: flex-end; font-size: 0.88rem; gap: 0.1rem; }

/* --- Aktivitäten ----------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 0.75rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline-icon { flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.timeline-body { min-width: 0; flex: 1; }
.timeline-meta { font-size: 0.82rem; color: var(--muted); }
.timeline-meta a { color: var(--muted); }
.timeline-subject { font-weight: 600; color: var(--text); text-decoration: none; }
.timeline-subject:hover { text-decoration: underline; }
.timeline-comment { font-size: 0.88rem; margin-top: 0.25rem; color: var(--comment-text); overflow-wrap: anywhere; }
.table input.input-icon { width: 3.2rem; text-align: center; padding: 0.25rem; }
.table input.input-small { width: 5rem; padding: 0.25rem 0.4rem; }
.more-contacts summary { cursor: pointer; color: var(--primary-light); padding: 0.5rem 0; font-size: 0.9rem; }
#job progress, form[data-chunk-upload] progress { width: 100%; height: 0.9rem; }
.activity-comment { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.92rem; line-height: 1.5; max-height: 70vh; overflow: auto;
                    background: var(--bg); padding: 0.9rem; border-radius: 6px; margin: 0; font-family: inherit; }

/* --- Opportunities -------------------------------------------------------------- */
.org-form { display: flex; gap: 0.4rem; align-items: center; }
.org-form input { width: 120px; padding: 0.25rem 0.4rem; }
.org-form select { width: auto; padding: 0.25rem 0.4rem; }
.org-form { flex-wrap: wrap; }
.badge-warn { background: var(--warn-bg-strong); color: var(--warn-text); }
.table .num { text-align: right; }
.entry-form textarea { margin-bottom: 0.5rem; }
.entry-options { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.2rem; font-size: 0.9rem; }
.entry-options .check { display: flex; align-items: center; gap: 0.35rem; font-weight: 500; }
.entry-options input[type=date] { width: auto; padding: 0.25rem 0.4rem; }
.entries { list-style: none; margin: 1rem 0 0; padding: 0; }
.entries li { padding: 0.75rem 0; border-top: 1px solid var(--border); }
.entries li.entry-internal { background: var(--internal-bg); padding-left: 0.6rem; border-left: 3px solid #f0b54d; }
.entry-text { margin-top: 0.3rem; line-height: 1.5; overflow-wrap: anywhere; }
.file-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.file-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.file-list form.inline { display: inline; }

/* --- Bericht ------------------------------------------------------------------------ */
/* volle Fensterbreite, kompakte Filter und Kennzahlen – Platz für die Tabelle */
.page-report main { max-width: none; padding: 1rem 1.25rem; }
.page-report .page-head { margin-bottom: 0.6rem; }
.page-report .page-head h1 { margin-bottom: 0; }
.page-report .filter-bar { padding: 0.6rem 0.8rem; gap: 0.5rem; margin-bottom: 0.6rem; }
.page-report .filter-bar select { max-width: 170px; padding-top: 0.3rem; padding-bottom: 0.3rem; }
.page-report .filter-bar input[type=date] { width: auto; padding-top: 0.3rem; padding-bottom: 0.3rem; }
.page-report .report-summary { padding: 0.6rem 0.8rem; margin-bottom: 0.6rem; }
.page-report .report-summary .stats { margin-bottom: 0; gap: 0.5rem; }
.page-report .report-summary .stat { flex: 0 1 auto; padding: 0.35rem 0.8rem; font-size: 0.82rem; }
.page-report .report-summary .stat span { display: inline; font-size: 1.05rem; margin-right: 0.35rem; }
.page-report .report-group { padding: 0.8rem; }
.page-report .report-group h2 { font-size: 1.05rem; margin-bottom: 0.4rem; }

.report-table { font-size: 0.84rem; }
.report-table th, .report-table td { vertical-align: top; padding: 0.4rem 0.45rem; }
.report-table th { font-size: 0.78rem; line-height: 1.25; background: var(--card); }
.report-table .col-summary { width: 16%; }
.report-table .col-history { width: 30%; }
.report-entry { margin-bottom: 0.45rem; line-height: 1.35; overflow-wrap: anywhere; }
.report-entry:last-child { margin-bottom: 0; }
.print-only { display: none; }

/* breite Bildschirme: Tabelle passt ohne seitliches Scrollen, Kopfzeile bleibt beim Scrollen sichtbar */
@media screen and (min-width: 1100px) {
    .page-report .table-scroll { overflow: visible; }
    .page-report .report-table thead th { position: sticky; top: 0; z-index: 1; box-shadow: inset 0 -1px 0 var(--border); }
}

@media print {
    @page { size: A4 landscape; margin: 10mm; }
    body, .page-report { background: #fff; font-size: 8.5pt; overflow: visible; }
    .topbar, .no-print, .flash { display: none !important; }
    .print-only { display: block; }
    main { padding: 0 !important; max-width: none !important; }
    .card { border: 0; padding: 0; margin: 0 0 6mm; break-inside: auto; }
    .report-summary .stat { padding: 2mm; }
    .report-summary .stat span { font-size: 11pt; }
    .table-scroll { overflow: visible; }
    .report-table { font-size: 7.5pt; }
    .report-table th, .report-table td { padding: 1.2mm 1.5mm; }
    .report-table tr { break-inside: avoid; }
    .report-table thead { display: table-header-group; }
    .report-group h2 { break-after: avoid; font-size: 11pt; }
    .report-table .col-history { min-width: 0; max-width: none; width: 30%; }
    a { color: inherit; text-decoration: none; }
    .badge { border: 1px solid #ccc; }
}

/* --- Schmale Bildschirme ------------------------------------------------------ */
@media (max-width: 720px) {
    .topbar { gap: 0.75rem; }
    .topbar .user { font-size: 0; }
    .topbar .user .link { font-size: 0.85rem; }
    .topbar .user a.user-link .icon { width: 1.4rem; height: 1.4rem; } /* Zahnrad zu den Settings bleibt sichtbar (Name ausgeblendet) */
    .map-layout { flex-direction: column; }
    .sidebar { width: auto; max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--border); }
    #map { min-height: 60vh; }
    main { padding: 1rem; }
    .account-grid { grid-template-columns: 1fr; }
    .fields { grid-template-columns: 1fr; gap: 0.1rem; }
    .fields dd { margin-bottom: 0.5rem; }
    .contact-reach { align-items: flex-start; }
}

/* Werkbank / Aufgaben */
.nav-count { display: inline-block; min-width: 1.2em; padding: 0 5px; margin-left: 2px; border-radius: 9px; background: #e53935; color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center; line-height: 1.5; }
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: 0.5rem 0.9rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--primary-text); border-bottom-color: var(--primary-text); font-weight: 600; }
.tab-count { font-size: 0.8rem; background: var(--tint-grey); border-radius: 9px; padding: 0 6px; margin-left: 2px; }
.task-group h2 { margin-top: 0; }
.task-group-ueberfaellig h2 { color: var(--error); }
.task-list { list-style: none; margin: 0; padding: 0; }
.task { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.task:last-child { border-bottom: 0; }
.task-main { flex: 1 1 320px; min-width: 0; }
.task-title a { text-decoration: none; }
.task-icon { margin-right: 0.3rem; }
.task-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; margin-top: 0.25rem; font-size: 0.9rem; }
.task-meta a { text-decoration: none; }
.task-desc { margin-top: 0.3rem; font-size: 0.9rem; color: var(--comment-text); }
.task-done .task-title { text-decoration: line-through; opacity: 0.65; }
.badge-overdue { background: var(--error-bg); color: var(--error); font-weight: 600; }
.task-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.task-complete summary { list-style: none; cursor: pointer; }
.task-complete summary::-webkit-details-marker { display: none; }
.task-complete[open] summary { margin-bottom: 0.4rem; }
.task-complete-form { display: flex; flex-direction: column; gap: 0.4rem; width: min(320px, 80vw); }
.task-complete-form textarea { width: 100%; }
.task-postpone { display: flex; gap: 0.6rem; font-size: 0.85rem; }
/* ToDo: Rückfrage nach „Aktivität protokollieren“, Folge-ToDo's im Verlauf */
.task-next { background: var(--tint-blue); border-left: 4px solid var(--primary); }
.task-next h2 { margin-top: 0; }
.task-next-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; }
.task-next-actions form { margin: 0; align-items: center; flex-wrap: wrap; }
.task-next-actions .inline-label { display: flex; align-items: center; gap: 0.4rem; }
.timeline-task.task-done .timeline-subject { text-decoration: line-through; opacity: 0.65; }
@media (max-width: 640px) { .task-actions { align-items: flex-start; } }
.form label.check, .task-complete-form label.check { flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 500; display: flex; }

/* Reiseplanung */
.nav-count[hidden] { display: none; }
.nav-count-list { background: #ef6c00; }
.col-check { width: 2.2rem; white-space: nowrap; }
[data-reiseliste].in-list { background: var(--warn-bg-strong); color: var(--warn-text); border-color: var(--warn-border); }
.place-choice { border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem 0.75rem; display: flex; flex-direction: column; gap: 0.35rem; }
.place-choice legend { font-weight: 600; font-size: 0.9rem; }
.place-choice label.check { flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 500; display: flex; flex-wrap: wrap; }
.place-choice input[type=text], .place-choice input:not([type]) { flex: 1; min-width: 200px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: 0; }
.trip-map { height: 440px; border-radius: 8px; margin-bottom: 1rem; border: 1px solid var(--border); }
.trip-marker-wrap { background: none; border: 0; }
.trip-marker { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 0.8rem; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.trip-marker-start, .trip-marker-hotel { background: #fff; color: #333; font-size: 0.9rem; }
.trip-num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 0.8rem; }
.trip-leg { margin: 0.4rem 0; }
.trip-table select { max-width: 220px; }
.trip-contact { font-size: 0.85rem; display: flex; flex-direction: column; margin-top: 0.2rem; }
.trip-contact a { text-decoration: none; }
.trip-late td { background: var(--warn-bg); }
.negative { color: var(--error); }
.trip-hotel { background: var(--tint-blue-light); border-radius: 6px; padding: 0.5rem 0.75rem; margin-top: 0.4rem; }
.trip-hotel p { margin: 0.25rem 0; }
.form-inline { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.4rem; }
.form-inline input { flex: 1; min-width: 180px; }
.print-only { display: none; }
@media print {
    .topbar, .no-print, .flash { display: none !important; }
    .print-only { display: inline; }
    .trip-map { height: 360px; break-inside: avoid; }
    .trip-day { break-inside: avoid; box-shadow: none; }
}
.time-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; } .time-choice label.check { flex-direction: row; align-items: center; gap: 0.35rem; font-weight: 500; display: flex; } .time-choice input[type=time] { width: auto; }
.drag-handle { cursor: grab; color: var(--muted); font-size: 1.1rem; padding: 0 0.3rem 0 0; user-select: none; touch-action: none; }
.drag-ghost { opacity: 0.4; background: var(--tint-blue); }
.trip-newday { border: 2px dashed var(--border); box-shadow: none; }
.trip-newday .drop-hint td { color: var(--muted); text-align: center; padding: 0.9rem; }
.fixed-time { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.8rem; margin-top: 0.25rem; }
.fixed-time input { font-size: 0.8rem; padding: 1px 3px; width: 6.5rem; }
.small-link { font-size: 0.8rem; text-decoration: none; }
body.is-saving { cursor: progress; opacity: 0.7; }
.fixed-time { display: flex; width: fit-content; }
.badge-group { background: var(--group-bg); color: var(--primary-text); text-decoration: none; }
.inline-form { display: block; margin-top: 0.15rem; }
/* Akkordeon-Karten (z. B. Company-Seite) */
details.accordion > summary { list-style: none; cursor: pointer; margin-bottom: 0; }
details.accordion > summary::-webkit-details-marker { display: none; }
details.accordion > summary h2::before { content: '▸'; display: inline-block; width: 1.1em; color: var(--muted); transition: transform 0.15s; }
details.accordion[open] > summary h2::before { transform: rotate(90deg); }
details.accordion[open] > summary { margin-bottom: 0.75rem; }
/* Company-Seite kompakt: Feldgruppen in einer Karte, engere Abstände */
.company-compact { grid-template-columns: minmax(0, 1fr); gap: 0; }
.company-compact .card { padding: 0.8rem 1rem; margin-bottom: 0.6rem; }
.company-compact h2 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.company-compact .card-head { margin-bottom: 0.3rem; }
.company-compact details.accordion[open] > summary { margin-bottom: 0.4rem; }
.company-compact .fields { gap: 0.2rem 1rem; }
.field-sheet .description-full { margin: 0; max-height: 15em; overflow-y: auto; padding-right: 0.5rem; } /* höchstens 10 Zeilen (Zeilenhöhe 1.5), dann scrollen */
.status-flags { display: flex; flex-wrap: wrap; gap: 0.3rem 2rem; }
/* Ungültige Eingabe (z. B. E-Mail) schon beim Tippen markieren */
.field-group input:user-invalid { border-color: var(--error); background: var(--error-bg-light); }
/* Oben zwei Spalten (50/50): Stammdaten | Adresse + Konditionen; weitere Gruppen über die volle Breite */
.field-sheet { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 1.5rem; align-items: start; }
.field-sheet > section { grid-column: 1 / -1; }
.field-sheet > section, .sheet-col > section + section, .sheet-col:nth-child(n+3) { border-top: 1px solid var(--border); margin-top: 0.6rem; padding-top: 0.6rem; }
@media (max-width: 720px) {
    .field-sheet { grid-template-columns: minmax(0, 1fr); }
    .sheet-col + .sheet-col { border-top: 1px solid var(--border); margin-top: 0.6rem; padding-top: 0.6rem; }
}

/* Icons, Flaggen, Login */
.icon { width: 1.2em; height: 1.2em; vertical-align: -0.2em; flex-shrink: 0; }
.flag { width: 2.1rem; height: 1.4rem; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); display: block; }
.login-card { max-width: 360px; margin: 3rem auto; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; color: var(--primary-text); font-weight: 700; font-size: 1.15rem; margin-bottom: 1.2rem; }
.login-brand .icon { width: 3rem; height: 3rem; }
.login-brand img { display: block; width: 220px; max-width: 100%; height: auto; }
.login-brand img.logo-hell { display: var(--logo-hell); }
.login-brand img.logo-dunkel { display: var(--logo-dunkel); }
.login-form { display: flex; flex-direction: column; gap: 0.8rem; }
.input-icon { display: flex; align-items: center; gap: 0.6rem; border: 1px solid var(--border); border-radius: 6px; padding: 0 0.7rem; background: var(--input-bg); color: var(--muted); }
.input-icon:focus-within { border-color: var(--primary-light); box-shadow: 0 0 0 2px rgba(11, 104, 182, 0.15); }
.input-icon input { border: 0; outline: none; flex: 1; padding: 0.65rem 0; font-size: 1rem; background: transparent; }
.lang-choice { display: flex; justify-content: center; gap: 0.6rem; border: 0; padding: 0; margin: 0.2rem 0; }
.lang-choice label { cursor: pointer; padding: 4px; border-radius: 6px; border: 2px solid transparent; }
.lang-choice input { position: absolute; opacity: 0; pointer-events: none; }
.lang-choice label:has(input:checked) { border-color: var(--primary-light); background: var(--tint-blue); }
.lang-choice label:has(input:focus-visible) { outline: 2px solid var(--primary-light); }
.lang-choice .flag[src$="default.svg"] { object-fit: contain; box-shadow: none; filter: var(--globe-filter); }
.login-actions { display: flex; justify-content: space-between; align-items: center; }
.icon-link { color: var(--muted); padding: 0.4rem; border-radius: 6px; display: inline-flex; }
.icon-link:hover { color: var(--primary-text); background: var(--tint-blue); }
.icon-link .icon, .btn-icon .icon { width: 1.5rem; height: 1.5rem; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; padding: 0.55rem 1.6rem; }
.topbar .user a.user-link { color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 0.35rem; }
.topbar .user .link.icon-only { color: #fff; text-decoration: none; display: inline-flex; padding: 0.2rem; }
.lang-choice-left { justify-content: flex-start; flex-wrap: wrap; } .lang-option { display: flex !important; flex-direction: column; align-items: center; gap: 0.25rem; font-size: 0.8rem; font-weight: 500; min-width: 5rem; text-align: center; }
.topbar .user a.user-link span { white-space: nowrap; }
.theme-choice { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.theme-choice label.check { flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 500; }

/* --- Handy: größere Schrift und Bedienelemente (Fingertipp ca. 44 px) -------------------------------- */
@media (max-width: 720px) {
    html, body { font-size: 17px; }
    input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select, textarea,
    .field-group input[type=tel], .field-group input[type=date], input[type=date], input[type=time], input[type=number] {
        font-size: 16px;            /* ab 16 px zoomt iOS beim Antippen nicht mehr hinein */
        min-height: 44px;
    }
    input[type=date], input[type=time], input[type=number] {
        padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 5px; background: var(--input-bg);
    }
    .input-icon input { font-size: 16px; }
    .btn { min-height: 44px; padding: 0.6rem 1.1rem; }
    .btn-small { min-height: 40px; padding: 0.45rem 0.9rem; font-size: 0.9rem; display: inline-flex; align-items: center; }
    input[type=checkbox], input[type=radio] { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
    label.check, .filter-bar .check, .sidebar fieldset label, .sidebar label.check { min-height: 40px; font-size: 1rem; }
    .topbar { height: 52px; }
    .topbar nav a { padding: 0.6rem 0.8rem; }
    .topbar .user .link.icon-only, .topbar .user a.user-link { padding: 0.45rem; }
    .topbar .user .link.icon-only .icon { width: 1.4rem; height: 1.4rem; }
    .table { font-size: 0.95rem; }
    .table th, .table td { padding: 0.6rem 0.5rem; }
    .contact-list li, .timeline li, .task, .file-list li, .plain-list li { padding-top: 0.8rem; padding-bottom: 0.8rem; }
    .hint, .history-meta, .timeline-meta, .badge { font-size: 0.85rem; }
    .fields dt { font-size: 0.85rem; }
    details.accordion > summary { padding: 0.3rem 0; }
    .card-head { flex-wrap: wrap; }
    .page-head .actions-row, .actions-row { flex-wrap: wrap; }
    .page-head .actions-row { gap: 0.5rem; }
    .page-head .actions-row .btn { padding-left: 0.6rem; padding-right: 0.6rem; } /* z. B. Companies: beide Knöpfe in einer Zeile */
    .tabs a { padding: 0.65rem 0.9rem; }
    .breadcrumb a, .pagination a { display: inline-block; padding: 0.35rem 0; }
    input, select, textarea { max-width: 100%; }
    .task-postpone { gap: 1.2rem; font-size: 0.95rem; }
    .task-postpone a, .task-postpone button { display: inline-block; padding: 0.45rem 0; }
}

/* --- Handy-Menü: Knopf ☰ oben links öffnet alle Menüpunkte als große Zeilen (Laptop: Leiste wie bisher) --- */
.nav-toggle { display: none; }
@media (max-width: 720px) {
    .nav-toggle {
        display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
        width: 44px; height: 44px; margin-left: -0.4rem; padding: 0; border: 0; border-radius: 6px;
        background: none; color: #fff; cursor: pointer;
    }
    .nav-toggle:hover, .nav-open .nav-toggle { background: rgba(255, 255, 255, 0.15); }
    .nav-toggle .icon { width: 1.7rem; height: 1.7rem; }
    .nav-toggle .icon:last-child, .nav-open .nav-toggle .icon:first-child { display: none; }
    .nav-open .nav-toggle .icon:last-child { display: block; }
    .topbar { gap: 0.5rem; }
    .topbar nav {
        display: none; position: fixed; top: 52px; left: 0; right: 0; bottom: 0; z-index: 2000; /* über der Karte */
        flex-direction: column; gap: 0; overflow-y: auto; background: var(--card); padding: 0.4rem 0 2rem;
    }
    .nav-open .topbar nav { display: flex; }
    .nav-open body { overflow: hidden; }
    .topbar nav a {
        display: flex; align-items: center; justify-content: space-between; min-height: 56px;
        padding: 0.8rem 1.25rem; border-radius: 0; border-bottom: 1px solid var(--border);
        color: var(--text); font-size: 1.15rem; font-weight: 500;
    }
    .topbar nav a:hover { background: var(--tint-blue-light); color: var(--text); }
    .topbar nav a.active { background: var(--tint-blue); color: var(--primary-text); font-weight: 700; box-shadow: inset 4px 0 0 var(--primary-light); }
    .topbar nav .nav-count { font-size: 0.85rem; padding: 0 8px; }
}

/* --- Karte: Filterleiste ein-/ausklappen ------------------------------------------------------------ */
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.sidebar-head .count { font-size: 0.9rem; text-align: right; }
.sidebar-body { display: flex; flex-direction: column; gap: 1rem; }
.sidebar-toggle {
    display: inline-flex; align-items: center; gap: 0.4rem; flex-shrink: 0; min-height: 40px; padding: 0.4rem 0.75rem;
    border: 0; border-radius: 6px; background: var(--tint-blue); color: var(--primary-text); font-weight: 600; cursor: pointer;
}
.sidebar-toggle:hover { background: var(--tint-blue-light); box-shadow: inset 0 0 0 1px var(--primary-light); }
.sidebar-toggle .icon:last-child { transition: transform 0.15s; transform: rotate(90deg); }
.sidebar.collapsed .sidebar-toggle .icon:last-child { transform: rotate(0deg); }
.sidebar.collapsed .sidebar-body { display: none; }
/* Laptop zugeklappt: schmaler Streifen mit Filter-Symbol, Karte wird breiter */
@media (min-width: 721px) {
    .sidebar { transition: width 0.15s; }
    .sidebar.collapsed { width: 60px; padding: 0.6rem 0.4rem; align-items: center; }
    .sidebar.collapsed .sidebar-head { flex-direction: column; }
    .sidebar.collapsed .sidebar-toggle { flex-direction: column; padding: 0.5rem; }
    .sidebar.collapsed .sidebar-toggle span, .sidebar.collapsed .count { display: none; }
}
/* Handy zugeklappt: nur die Leiste „Filter“ mit Anzahl, die Karte nutzt den restlichen Bildschirm */
@media (max-width: 720px) {
    .sidebar { max-height: 50vh; }
    #map { min-height: 0; } /* Karte füllt den Platz unter der Filterleiste (Seite scrollt nicht) */
    .sidebar.collapsed { max-height: none; padding: 0.5rem 1rem; overflow: visible; }
    .sidebar-toggle { min-height: 44px; font-size: 1rem; }
}
.user-table tbody tr[hidden] { display: none; }
.user-filter { padding: 0 0 0.8rem; }
.user-table .flag { display: inline-block; width: 1.3rem; height: 0.85rem; margin-left: 0.3rem; vertical-align: -0.05em; }
.user-table tbody tr { cursor: pointer; }

/* --- Detailseiten: Kopf in einer Zeile („‹ Companies“ · Name · Badges · Knöpfe) ------------------------------ */
@media (min-width: 721px) {
    main:has(> .breadcrumb + .page-head) {
        display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 1rem; align-content: start;
    }
    main:has(> .breadcrumb + .page-head) > * { grid-column: 1 / -1; }
    main:has(> .breadcrumb + .page-head) > .breadcrumb {
        grid-column: 1; align-self: start; padding-top: 0.45rem; margin: 0 0 1rem; padding-right: 1rem; border-right: 1px solid var(--border);
        white-space: nowrap; font-size: 0.95rem;
    }
    main:has(> .breadcrumb + .page-head) > .breadcrumb + .page-head { grid-column: 2; align-items: flex-start; flex-wrap: nowrap; }
    main:has(> .breadcrumb + .page-head) > .page-head > div:first-child { flex: 1 1 auto; min-width: 0; }
    main:has(> .breadcrumb + .page-head) > .page-head > .actions-row,
    main:has(> .breadcrumb + .page-head) > .page-head > form { flex: 0 0 auto; }
    .page-head h1 { display: inline; margin: 0 0.6rem 0 0; vertical-align: middle; }
    .page-head h1 + .badge, .page-head h1 ~ .badge { vertical-align: middle; }
    .page-head > div:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
    .page-head > div:first-child > .hint { flex-basis: 100%; margin: 0.2rem 0 0; }
}

/* --- Akkordeons: lange Listen scrollen innerhalb des Akkordeons (Höhe = 10 Einträge, gesetzt von common.js) --- */
.list-scroll { overflow-y: auto; overscroll-behavior: contain; }
.list-scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--table-head-bg, var(--card)); }
.field-sheet .sheet-col > section.sheet-status { border-top: 0; margin-top: 0.4rem; padding-top: 0; } /* Status ohne Überschrift und Linie */

/* --- Company bearbeiten: wie die Ansicht (field-sheet), Feldname links, Eingabe rechts --------------------------- */
.edit-sheet { margin: 0; }
.edit-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.3rem; }
.edit-fields-wide { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); column-gap: 1.5rem; }
.edit-sheet .edit-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 1rem; font-weight: 400; }
.edit-sheet .edit-row > span:first-child { color: var(--muted); font-size: 0.9rem; }
.edit-sheet .edit-row input:not([type=checkbox]), .edit-sheet .edit-row select { padding: 0.32rem 0.5rem; }
.edit-sheet .status-flags label.check { font-weight: 400; }
.edit-sheet .edit-row-top { align-items: start; }
.edit-sheet .edit-row > span:first-child small { display: block; font-size: 0.78rem; }
.edit-sheet .edit-row-top > span:first-child { padding-top: 0.35rem; }
.edit-sheet > .grid-2 { gap: 0.3rem 2rem; }
.edit-sheet .edit-row input[type=checkbox] { justify-self: start; }
.edit-section h2 { margin: 0.4rem 0 0.5rem; padding-top: 0.7rem; border-top: 1px solid var(--border); font-size: 1rem; }
@media (max-width: 720px) { .edit-sheet .edit-row { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; } }

/* Knöpfe im Seitenkopf (head_btn() / headBtn()): überall nur das Symbol – Text für Screenreader und als title (Tooltip) */
.page-head .btn:has(.btn-text) { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 40px; padding: 0.4rem 0.6rem; }
.page-head .btn > .icon { width: 1.3rem; height: 1.3rem; }
.page-head .btn .btn-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Listen: Suchfeld immer sichtbar, Filter aufklappbar (common.js, .filter-collapsible) --------------------- */
.filter-bar.filter-collapsible { flex-direction: column; align-items: stretch; gap: 0.6rem; }
.filter-main { display: flex; gap: 0.5rem; align-items: center; }
.filter-main input[type=search] { flex: 1 1 auto; width: auto; }
.filter-toggle {
    display: inline-flex; align-items: center; gap: 0.35rem; flex-shrink: 0; min-height: 40px; padding: 0.4rem 0.7rem;
    border: 0; border-radius: 6px; background: var(--tint-blue); color: var(--primary-text); cursor: pointer;
}
.filter-toggle:hover { box-shadow: inset 0 0 0 1px var(--primary-light); }
.filter-toggle .icon:last-child { transition: transform 0.15s; transform: rotate(90deg); }
.filter-collapsible.collapsed .filter-toggle .icon:last-child { transform: rotate(0deg); }
.filter-count { min-width: 1.3rem; padding: 0 0.35rem; border-radius: 9px; background: var(--primary-light); color: #fff; font-size: 0.75rem; font-weight: 700; text-align: center; line-height: 1.3rem; }
.filter-more { display: flex; flex-direction: column; gap: 0.6rem; }
.filter-collapsible.collapsed .filter-more { display: none; }
.filter-row { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; }
.filter-row select { width: auto; max-width: 260px; }
.country-flag { width: 1.33em; line-height: 1em; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); vertical-align: -0.1em; }
.filter-row input[type=date] { width: auto; }

/* PDF-Fenster (common.js): PDF-Links öffnen innerhalb der Seite, Hintergrund halbtransparent */
.pdf-viewer { width: min(1100px, 94vw); height: 92vh; max-width: none; max-height: none; padding: 0; border: 1px solid var(--border);
              border-radius: 10px; background: var(--overlay-panel); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
              backdrop-filter: blur(6px); overflow: hidden; }
.pdf-viewer[open] { display: flex; flex-direction: column; }
.pdf-viewer::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.pdf-viewer-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.pdf-viewer-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-viewer iframe { flex: 1; width: 100%; border: 0; background: var(--card); }
@media (max-width: 640px) { .pdf-viewer { width: 100vw; height: 100vh; border-radius: 0; } .pdf-viewer-head .btn-secondary { display: none; } }

/* Cockpit: Aktivitäten je Kalenderwoche (Umschalten Balken/Linien/Tabelle über data-act, cockpit.js) */
#aktivitaeten:not([data-act="table"]) .act-view-table, #aktivitaeten[data-act="table"] .act-view-chart { display: none; }
#aktivitaeten form.actions-row { flex-wrap: wrap; align-items: center; margin-bottom: 0.5rem; }
#aktivitaeten form.actions-row select { width: auto; max-width: 220px; }
.act-switch { margin: 0 0 0 auto; border-bottom: 0; flex-wrap: nowrap; align-self: center; }
.act-switch a { padding: 0.35rem 0.8rem; }
.activity-table th small { font-weight: 400; }
.activity-table td.muted-zero { color: var(--muted); }
.activity-table th.act-kind { text-align: center; border-left: 1px solid var(--border); }
.act-group { margin-top: 0.75rem; }
.act-group summary { cursor: pointer; padding: 0.3rem 0; }
.act-compare { margin-top: 1.25rem; }
.act-compare-form { margin: 0.25rem 0 0.5rem; }
.act-compare-form select { width: auto; max-width: 100%; }
.act-single-head { margin: 1.25rem 0 0; }

/* Cockpit: Kalender je Mitarbeiter (kalender.js). Farbe je Art wie in den Diagrammen, pot. Kunden gestrichelt */
.act-calendar { margin-top: 1rem; --cal-hour: 44px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.cal-title { display: flex; flex-direction: column; }
.cal-title strong { font-size: 1.1rem; }
.cal-tools { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.cal-tools select { width: auto; padding: 0.25rem 0.4rem; }
.cal-nav { display: inline-flex; gap: 2px; }
.cal-body { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 1rem; align-items: start; }
.cal-main { min-width: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.cal-main.cal-loading { opacity: 0.6; }
.cal-main > .hint { padding: 1rem; margin: 0; }
.cal-grid { display: flex; flex-direction: column; }
.cal-row { display: grid; grid-template-columns: 3.2rem repeat(var(--days), minmax(0, 1fr)); }
.cal-gutter { font-size: 0.72rem; color: var(--muted); padding: 0.3rem 0.25rem; text-align: right; }
.cal-heads { border-bottom: 1px solid var(--border); }
.cal-dayhead { text-align: center; padding: 0.35rem 0.2rem; font-size: 0.85rem; border-left: 1px solid var(--border); }
.cal-dayhead button { text-transform: uppercase; color: var(--text); text-decoration: none; }
.cal-dayhead.cal-today button { color: var(--primary-text); font-weight: 700; }
.cal-allday { border-bottom: 1px solid var(--border); }
.cal-allday-cell { border-left: 1px solid var(--border); padding: 2px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-scroll { height: calc(var(--cal-hour) * 11.5); overflow-y: auto; }
.cal-times { position: relative; }
.cal-hours { padding: 0; }
.cal-hour { height: var(--cal-hour); position: relative; }
.cal-hour span { position: relative; top: -0.5em; padding-right: 0.3rem; }
.cal-hour:first-child span { visibility: hidden; }
.cal-col { position: relative; height: calc(var(--cal-hour) * 24); border-left: 1px solid var(--border); cursor: copy;
    background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px calc(var(--cal-hour) / 2),
        var(--tint-grey) calc(var(--cal-hour) / 2) calc(var(--cal-hour) / 2 + 1px), transparent calc(var(--cal-hour) / 2 + 1px) var(--cal-hour)); }
.cal-col.cal-today { background-color: var(--tint-blue-light); }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--error); pointer-events: none; z-index: 2; }
.cal-ev { --cal-c: var(--inaktiv); display: block; overflow: hidden; border-radius: 4px; border-left: 3px solid var(--cal-c);
    background: color-mix(in srgb, var(--cal-c) 24%, var(--card)); color: var(--text); text-decoration: none;
    font-size: 0.75rem; line-height: 1.25; padding: 1px 4px; cursor: pointer; }
.cal-col .cal-ev { position: absolute; z-index: 1; }
.cal-ev:hover { background: color-mix(in srgb, var(--cal-c) 40%, var(--card)); text-decoration: none; }
.cal-ev strong { font-weight: 600; }
.cal-col .cal-ev strong, .cal-col .cal-ev span, .cal-allday .cal-ev { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev span { color: var(--muted); white-space: nowrap; }
.cal-ev small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.cal-pot { border-left-style: dashed; background: color-mix(in srgb, var(--cal-c) 12%, var(--card)); }
.cal-k-anruf { --cal-c: var(--primary-light); }
.cal-k-besuch { --cal-c: var(--kunde); }
.cal-k-teams { --cal-c: var(--chart-teams); }
.cal-month { display: flex; flex-direction: column; }
.cal-mrow { display: grid; grid-template-columns: 2.4rem repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.cal-mrow:last-child { border-bottom: 0; }
.cal-mhead { font-size: 0.8rem; color: var(--muted); text-align: center; }
.cal-mhead > div { padding: 0.3rem 0; }
.cal-kw { font-size: 0.75rem; color: var(--muted); text-align: center; padding: 0.3rem 0; }
.cal-mcell { min-height: 5.5rem; border-left: 1px solid var(--border); padding: 2px; display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: pointer; }
.cal-mcell .cal-ev { white-space: nowrap; text-overflow: ellipsis; }
.cal-mcell.cal-other { background: var(--tint-grey); }
.cal-mcell.cal-other .cal-mday { color: var(--muted); }
.cal-mday { align-self: flex-start; font-size: 0.8rem; color: var(--text); padding: 0 0.3rem; border-radius: 999px; }
.cal-mcell.cal-today .cal-mday { background: var(--primary-light); color: #fff; }
.cal-more { font-size: 0.72rem; align-self: flex-start; }
.cal-mini { border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; }
.cal-mini-head { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.cal-mini-head button, .cal-mini-table button, .cal-kw, .cal-mday, .cal-more { text-decoration: none; }
.cal-mini-head strong { flex: 1; text-align: center; text-transform: uppercase; font-size: 0.82rem; }
.cal-mini-head select { width: auto; padding: 0.15rem 0.3rem; font-size: 0.82rem; }
.cal-mini-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; text-align: center; }
.cal-mini-table th { font-weight: 400; color: var(--muted); padding: 0.15rem 0; }
.cal-mini-table thead th:first-child, .cal-mini-table tbody th { font-size: 0.7rem; border-right: 1px solid var(--border); }
.cal-mini-table td { padding: 1px 0; }
.cal-mini-table button { width: 1.8rem; height: 1.8rem; border-radius: 999px; color: var(--text); text-decoration: none; }
.cal-mini-table tbody th button { color: var(--muted); font-size: 0.7rem; width: auto; }
.cal-mini-table button.cal-other { color: var(--muted); opacity: 0.6; }
.cal-mini-table button.cal-today { box-shadow: inset 0 0 0 1.5px var(--primary-text); font-weight: 700; }
.cal-mini-table button.cal-selected { background: var(--primary-light); color: #fff; }
.cal-mini-current td, .cal-mini-current th { background: var(--tint-blue); }
@media (max-width: 700px) {
    .cal-body { grid-template-columns: minmax(0, 1fr); }
    .cal-mini { order: -1; }
    .cal-mcell { min-height: 3.5rem; }
    .cal-mcell .cal-ev span { display: none; }
}
/* --- Online-Hilfe (Fragezeichen / F1, help_ui.php + hilfe.js) ------------------------------------------- */
.topbar .user .help-toggle .icon { width: 1.3rem; height: 1.3rem; }
.help-panel { margin: 0 0 0 auto; height: 100vh; max-height: none; width: min(440px, 100vw); max-width: none; padding: 0;
    border: 0; border-left: 1px solid var(--border); background: var(--card); color: var(--text);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18); }
.help-panel[open] { display: flex; flex-direction: column; animation: help-slide 0.18s ease-out; }
.help-panel::backdrop { background: var(--overlay); }
@keyframes help-slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.help-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border); }
.help-panel-kicker { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--primary-text); font-weight: 600; }
.help-panel-head .link.icon-only { color: var(--muted); display: inline-flex; padding: 0.3rem; }
.help-panel-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; }
.help-panel-body h2 { margin-top: 0; }
.help-panel-foot { padding: 0.9rem 1.25rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.6rem; }
.help-panel-foot .btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; text-decoration: none; }
.help-panel-links { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.9rem; }
.help-panel-training { padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.5rem; }
.help-panel-training .btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; text-decoration: none; }
.settings-training { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.settings-training h2 { margin-bottom: 0.2rem; }
.settings-training .hint { margin: 0; }
.help-text { line-height: 1.55; }
.help-text h3 { margin: 1.1rem 0 0.4rem; color: var(--primary-text); }
.help-text ul, .help-text ol { padding-left: 1.2rem; margin: 0.4rem 0 0.8rem; }
.help-text li { margin-bottom: 0.35rem; }
.help-text p { margin: 0.4rem 0 0.8rem; }
kbd { display: inline-block; padding: 0 0.35em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px;
    background: var(--tint-grey); font: 600 0.82em/1.5 ui-monospace, monospace; color: var(--text); }

/* Seite hilfe.php: Themenliste links, Text rechts */
.help-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1rem; align-items: start; }
.help-index { position: sticky; top: 1rem; padding: 0.9rem; }
.help-index ul { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.help-index li a { display: block; padding: 0.4rem 0.6rem; border-radius: 5px; text-decoration: none; color: var(--text); }
.help-index li a:hover { background: var(--tint-blue-light); }
.help-index li a.active { background: var(--tint-blue); color: var(--primary-text); font-weight: 600; }
.help-index li[hidden] { display: none; }
.help-article { max-width: 820px; }
.help-article-actions { margin-top: 1.25rem; gap: 0.6rem; }
.help-article-actions .btn { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; }
.page-head h1 .icon { width: 1.4rem; height: 1.4rem; vertical-align: -0.2em; }
@media (max-width: 720px) {
    .help-layout { grid-template-columns: minmax(0, 1fr); }
    .help-index { position: static; }
}

/* --- Schulung: Angebot der Einführung, Schulungsseite --------------------------------------------------- */
.training-offer { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; margin: 0.75rem 1.5rem 0; padding: 0.8rem 1rem;
    border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 6px; background: var(--card); }
.training-offer[hidden] { display: none; }
.training-offer p { margin: 0; flex: 1; min-width: 240px; }
.training-offer-icon { font-size: 1.6rem; }
.training-offer-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.training-offer-actions .btn { text-decoration: none; }
.training-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.training-summary > div { flex: 1; min-width: 220px; }
.training-summary .btn { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; }
.training-bar { height: 8px; border-radius: 4px; background: var(--tint-grey); overflow: hidden; margin-top: 0.5rem; max-width: 520px; }
.training-bar span { display: block; height: 100%; background: var(--kunde); border-radius: 4px; transition: width 0.3s; }
.training-bar.small { height: 6px; width: 90px; display: inline-block; margin: 0 0.5rem 0 0; vertical-align: middle; }
.training-cell { white-space: nowrap; }
.training-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.training-grid .card { margin: 0; display: flex; flex-direction: column; }
.training-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.training-card-head h2 { font-size: 1.05rem; margin: 0; }
.training-card p { flex: 1; color: var(--comment-text); margin: 0.5rem 0 0.9rem; }
.training-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.training-card-foot .btn { text-decoration: none; }
.training-card.is-done { border-color: var(--kunde); }
.training-finished a { font-weight: 600; }

/* --- Schulung: Tour (tour.js) – Hervorhebung, abgedunkelter Rest und Erklärfenster ---------------------- */
.tour-spot { position: fixed; z-index: 2000; border-radius: 8px; pointer-events: none;
    box-shadow: 0 0 0 3px var(--accent), 0 0 0 9999px var(--overlay); transition: top 0.2s, left 0.2s, width 0.2s, height 0.2s; }
.tour-spot[hidden], .tour-dim[hidden] { display: none; }
.tour-dim { position: fixed; inset: 0; z-index: 2000; background: var(--overlay); }
.tour-pop { position: fixed; z-index: 2001; width: min(360px, calc(100vw - 24px)); background: var(--card); color: var(--text);
    border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28); padding: 0.9rem 1rem; }
.tour-pop-center { width: min(440px, calc(100vw - 24px)); }
.tour-pop-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.tour-pop-tour { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.tour-pop-close { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 0.2rem 0.3rem; }
.tour-pop h3 { margin: 0 0 0.35rem; font-size: 1.05rem; color: var(--primary-text); }
.tour-pop-text { line-height: 1.5; font-size: 0.95rem; }
.tour-pop-text p { margin: 0 0 0.5rem; }
.tour-progress { height: 4px; border-radius: 2px; background: var(--tint-grey); margin: 0.6rem 0; overflow: hidden; }
.tour-progress span { display: block; height: 100%; background: var(--accent); }
.tour-pop-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.tour-pop-count { font-size: 0.82rem; color: var(--muted); }
.tour-pop-nav { display: flex; gap: 0.4rem; }
@media print { .tour-spot, .tour-dim, .tour-pop, .training-offer, .help-panel { display: none !important; } }

/* Reisen: bestehende Reise wählen + „Zu dieser Reise hinzufügen“ + „Neue Reise planen“ direkt unter der Reiseliste */
.trip-actions { flex-wrap: wrap; align-items: center; margin: 0.75rem 0 1rem; }
.trip-actions select { width: auto; min-width: 12rem; max-width: 100%; }
.trip-actions a.btn { text-decoration: none; }
/* Reisen: Companies suchen und direkt vormerken (unter der Reiseliste) */
.trip-search { margin-top: 0.75rem; }
.trip-search input[type=search] { flex: 1 1 220px; width: auto; }
.trip-search .table { margin-top: 0.5rem; }
#reise-planen { scroll-margin-top: 1rem; }
/* Reisen: „Meine Reisen“ in der rechten Spalte unter „Offene Besuchsaufgaben“, gruppiert nach Diese Woche / Geplant / Vergangen */
.my-trips .trip-group-head th { background: var(--tint-grey); color: var(--text); font-weight: 600; }
.my-trips .trip-group-woche tr:not(.trip-group-head) td { background: var(--tint-blue-light); }
.my-trips tbody + tbody .trip-group-head th { border-top: 0.75rem solid var(--card); }
/* Karte: langes Popup scrollt innen (maxHeight in app.js), Scrollbalken nicht über dem Text */
.leaflet-popup-scrolled { border: 0; padding-right: 4px; overscroll-behavior: contain; }
/* Handy: Kopfzeile passt auf schmale Bildschirme (Menü, Logo, ?, Settings, Abmelden) – Logo kleiner und darf schrumpfen */
@media (max-width: 720px) {
    .topbar { gap: 0.4rem; padding: 0 0.5rem; }
    .topbar .brand { flex-shrink: 1; min-width: 0; }
    .topbar .brand img { height: 24px; max-width: 100%; object-fit: contain; object-position: left center; }
    .topbar .user { gap: 0.1rem; flex-shrink: 0; }
    .topbar .nav-toggle { margin-left: 0; }
}

/* Kontakt-Dubletten zusammenführen (kontakt-zusammenfuehren.php) */
.merge-table th { vertical-align: top; }
.merge-table th .badge { margin-left: 0.3rem; }
.merge-table td:first-child { color: var(--muted); white-space: nowrap; width: 1%; }
.merge-table tr.merge-info td { font-size: 0.9rem; }
.merge-table tr.merge-same td:not(:first-child) { color: var(--muted); }
.merge-table tr.merge-choice label { display: flex; gap: 0.5rem; align-items: flex-start; cursor: pointer; font-weight: 400; margin: 0; }
.merge-table tr.merge-choice input[type=radio] { margin-top: 0.2rem; flex-shrink: 0; width: auto; }
.merge-table tr.merge-choice label:has(input:checked) { color: var(--primary-text); font-weight: 600; }
.merge-candidates tr.group-start td { border-top: 2px solid var(--border); }
.merge-page .table td a.btn { color: #fff; } /* Knopf in Tabellenzeilen: nicht die Link-Farbe der Tabelle */

/* Opportunities aus Excel importieren (opportunity-import.php) */
.opp-import .bulk-row { flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.5rem 0 0.75rem; }
.opp-import .bulk-row select { width: auto; min-width: 11rem; }
.opp-import-table td { vertical-align: top; }
.opp-import-table select, .opp-import-table input:not([type=checkbox]) { width: 100%; padding: 0.3rem 0.4rem; }
.opp-import-table .account-select { min-width: 17rem; }
.opp-import-table input[name$="[name]"] { min-width: 15rem; }
.opp-import-table select[name$="[owner]"] { min-width: 11rem; }
.opp-import-table .kind-select, .opp-import-table .stage-select { min-width: 9.5rem; }
.opp-import-table input[type=date] { min-width: 9.5rem; }
.opp-import-table input[name$="[amount]"] { min-width: 7rem; text-align: right; }
.opp-import-table select:invalid, .opp-import-table select.needs-choice { border-color: var(--warn-border); background: var(--warn-bg); }
.opp-import-table tr.row-error td { background: var(--error-bg); }
.opp-import-table .error-text { color: var(--error); font-weight: 600; }
.opp-import-table .account-search { margin-top: 0.3rem; }
.opp-import-table .account-hits { list-style: none; margin: 0.25rem 0 0; padding: 0; max-height: 12rem; overflow: auto; }
.opp-import-table .account-hits li { padding: 0.15rem 0; }
.opp-import-table .entry-preview { margin: 0.3rem 0 0; padding-left: 1rem; max-width: 26rem; white-space: normal; text-align: left; font-size: 0.85rem; }

/* Lange Listen mit Schnellauswahl am Rand (ListIndex, common.js) */
.list-sentinel { height: 1px; }
.list-more { height: auto; min-height: 1px; text-align: center; color: var(--muted); font-size: 0.85rem; padding: 0.4rem 0; }
.list-more:empty { padding: 0; }
.list-index {
    position: fixed; right: 4px; top: 56px; bottom: 8px; z-index: 30;
    display: flex; flex-direction: column; justify-content: center; align-items: stretch;
    padding: 4px 1px; border-radius: 10px; touch-action: none; user-select: none; -webkit-user-select: none;
}
.list-index a {
    flex: 0 1 auto; min-height: 0; overflow: hidden; padding: 0 5px; text-align: center; white-space: nowrap;
    font-size: 11px; line-height: 1.35; font-weight: 600; color: var(--primary-light); text-decoration: none;
}
.list-index.active { background: var(--tint-blue); }
.list-index a:focus-visible { outline: 2px solid var(--primary-light); border-radius: 4px; }
.list-index-bubble {
    position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 40; pointer-events: none;
    min-width: 84px; padding: 0.7rem 1.1rem; border-radius: 14px; text-align: center;
    font-size: 2rem; font-weight: 700; color: var(--text); background: var(--card); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.has-list-index main { padding-right: 2.2rem; }
@media (max-width: 720px) { .list-index a { font-size: 10px; padding: 0 4px; } .has-list-index main { padding-right: 1.8rem !important; } }

/* Kontakte auf der Company-Seite: Schnellauswahl A–Z neben der Liste (account.js) */
.contact-az-wrap { display: flex; align-items: flex-start; gap: 0.25rem; }
.contact-az-wrap > .contact-list { flex: 1 1 auto; min-width: 0; }
.contact-az {
    position: sticky; top: 8px; flex: 0 0 auto; display: flex; flex-direction: column; max-height: calc(100vh - 16px);
    padding: 4px 1px; border-radius: 10px; touch-action: none; user-select: none; -webkit-user-select: none;
}
.contact-az a { flex: 0 1 auto; min-height: 0; overflow: hidden; padding: 0 5px; text-align: center; font-size: 11px;
    line-height: 1.35; font-weight: 600; color: var(--primary-light); text-decoration: none; }
.contact-az.active { background: var(--tint-blue); }

/* Verwaltung → Benutzer: Accountinhaber ohne passenden Benutzer zusammenführen / anlegen */
.owner-unassigned summary { cursor: pointer; }
.owner-unassigned summary:hover strong { color: var(--primary-light); text-decoration: underline; }
.owner-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.4rem 0 0.8rem; }
.owner-actions .form-inline { margin-top: 0; }
.owner-actions select { min-width: 220px; }
.owner-aliases form { display: inline; margin-left: 0.3rem; }

/* Suchfeld der Listen: schmalerer Rand um die Eingabe */
.filter-bar.filter-collapsible { padding: 0.5rem 0.6rem; flex-wrap: nowrap; } /* nowrap: sonst wird die Zeile so breit wie das Suchfeld von sich aus */
.filter-main input[type=search] { min-width: 0; flex-basis: 0; }
.filter-main .filter-toggle { flex-shrink: 0; }
@media (max-width: 720px) {
    .filter-bar.filter-collapsible { padding: 0.35rem; margin-bottom: 0.6rem; border-radius: 6px; }
}

/* Listen mit festem Kopf (Company Groups, Companies, Contacts, ToDo's, Opportunities, ausgeblendete Companies):
   Menü, Titel, Suchfeld und Tabellenkopf bleiben stehen, nur .scroll-area scrollt (common.js: pageScroller) */
body.fixed-head { height: 100vh; height: 100dvh; overflow: hidden; }
body.fixed-head > * { flex-shrink: 0; }
body.fixed-head > main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding-bottom: 0.6rem; overflow-y: auto; } /* auto: Notlösung, falls der Kopf höher als das Fenster wird */
body.fixed-head > main > * { flex-shrink: 0; }
body.fixed-head > main > .fill { flex: 1 1 auto; min-height: 0; margin-bottom: 0; }
body.fixed-head > main > .card.fill { display: flex; flex-direction: column; padding-bottom: 0.4rem; }
body.fixed-head .fill > * { flex-shrink: 0; }
body.fixed-head .fill > .scroll-area, body.fixed-head > main > .scroll-area { flex: 1 1 auto; min-height: 3rem; overflow: auto; overscroll-behavior: contain; }
body.fixed-head.list-scrolled .card.fill > :has(~ .scroll-area) { display: none; } /* Anzahl/Summen beim Scrollen weg (common.js) */
body.fixed-head.list-scrolled .card.fill { padding-top: 0.4rem; }
body.fixed-head .scroll-area thead th { position: sticky; top: 0; z-index: 2; background: var(--table-head-bg, var(--card)); box-shadow: inset 0 -1px 0 var(--table-line, var(--border)); }
body.fixed-head .filter-collapsible:not(.collapsed) .filter-more { max-height: 45vh; overflow-y: auto; }
@media (max-width: 720px) { body.fixed-head .filter-collapsible:not(.collapsed) .filter-more { max-height: 35vh; } }
/* Sehr niedrige Fenster (Handy quer): normal scrollen, sonst bliebe für die Liste kaum Platz */
@media (max-height: 520px) {
    body.fixed-head { height: auto; min-height: 100%; overflow: visible; }
    body.fixed-head > main { display: block; }
    body.fixed-head .fill > .scroll-area, body.fixed-head > main > .scroll-area { overflow: visible; }
    body.fixed-head .fill > .table-scroll.scroll-area { overflow-x: auto; overflow-y: hidden; }
    body.fixed-head .scroll-area thead th { position: static; }
}

/* Verwaltung → API-Zugänge */
.api-keys input[name=name] { min-width: 10rem; }
.api-keys .api-ips { min-width: 12rem; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
/* SAP-Werte genau wie gespeichert zeigen (mehrfache Leerzeichen) */
.sapguard-result td { white-space: pre; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
.api-actions { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; }
.api-actions form { display: none; }
.api-new-key code { word-break: break-all; user-select: all; margin: 0 0.4rem; }

/* Nur am Desktop zeigen (z. B. Erklärtexte unter Listen) */
@media (max-width: 720px) { .hide-mobile { display: none !important; } }

/* Spalte nur mit Länderflagge (Opportunities) */
.table .col-flag { width: 1.8em; padding-left: 0.25rem; padding-right: 0.25rem; text-align: center; }

/* Kopieren per Klick (common.js [data-copy]); E-Mail in der Contacts-Liste mit fester Breite und … */
.copy-text { display: inline-block; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; cursor: copy; color: var(--primary-light); }
.copy-text:hover { text-decoration: underline; }
.copy-text.copied { color: var(--success); text-decoration: none; }
@media (max-width: 720px) { .copy-text { max-width: 10rem; } }

/* Notizblatt der Company (Button unter Konditionen, Fenster #notizen in account.php) */
.notes-btn { margin-top: 0.6rem; display: inline-flex; align-items: center; gap: 0.35rem; text-decoration: none; }
.notes-btn .notes-state { font-weight: 400; opacity: 0.85; }
.notes-btn.btn-secondary .notes-state { color: var(--muted); }
.notes-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--accent); display: inline-block; }
.notes-dialog { width: min(820px, 94vw); max-width: none; padding: 0; border: 1px solid var(--border); border-radius: 10px;
                background: var(--card); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); }
.notes-dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.notes-form { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.9rem 1rem 1rem; }
.notes-head { display: flex; align-items: center; gap: 0.5rem; }
.notes-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-head h2 small { font-weight: 400; color: var(--muted); }
.notes-form textarea { width: 100%; min-height: 50vh; resize: vertical; font: inherit; line-height: 1.45; padding: 0.6rem 0.7rem;
                       border: 1px solid var(--border); border-radius: 5px; background: var(--input-bg); }
.notes-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
@media (max-width: 640px) {
    .notes-dialog { width: 100vw; height: 100vh; max-height: none; border-radius: 0; }
    .notes-dialog[open] .notes-form { height: 100%; box-sizing: border-box; }
    .notes-form textarea { flex: 1; min-height: 0; }
}

/* Cockpit → Umsätze: Filter unter der Überschrift „Umsatzauswertung“ */
.cockpit-filter { margin-top: 0.4rem; justify-content: flex-start; }
.cockpit-filter select { width: auto; max-width: 260px; }

/* Tabellen: Linien, Kopfzeile und Zeilenstreifen über Variablen – hell unverändert, dunkel deutlicher (--table-*) */
.table th, .table td { border-bottom-color: var(--table-line, var(--border)); }
.table :where(thead th) { background: var(--table-head-bg, transparent); }
.table tfoot th { border-top-color: var(--table-line, var(--border)); }
:where(.table tbody tr:nth-child(even)) > td { background: var(--table-stripe, transparent); } /* niedrige Spezifität: Hover/eigene Zeile gewinnen */

/* Ladesymbol (common.js): Balken oben und „Wird geladen …“, solange eine Seite/Abfrage läuft */
.page-loading { position: fixed; inset: 0 0 auto 0; z-index: 3000; pointer-events: none; opacity: 0; transition: opacity 0.15s; }
.page-loading.active { opacity: 1; }
.page-loading-bar { height: 3px; background: linear-gradient(90deg, transparent, var(--accent), var(--primary-light), transparent);
                    background-size: 50% 100%; background-repeat: no-repeat; animation: page-loading-bar 1.1s linear infinite; }
@keyframes page-loading-bar { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.page-loading-pill { position: absolute; top: 4.2rem; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center;
                     gap: 0.5rem; padding: 0.4rem 0.9rem; border-radius: 999px; background: var(--card); color: var(--text);
                     border: 1px solid var(--border); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); font-size: 0.9rem; font-weight: 600; }
.page-loading-spinner { width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary-light);
                        animation: page-loading-spin 0.7s linear infinite; }
@keyframes page-loading-spin { to { transform: rotate(360deg); } }
html.is-loading, html.is-loading * { cursor: progress !important; }
@media (prefers-reduced-motion: reduce) { .page-loading-bar, .page-loading-spinner { animation-duration: 3s; } }

/* Verwaltung → Companies → Branchen */
.catalog-switch { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: center; margin: 0.5rem 0; }
.catalog-switch label { display: flex; gap: 0.4rem; align-items: center; }
details.sub-accordion { border-top: 1px solid var(--border); padding: 0.5rem 0; }
details.sub-accordion > summary { cursor: pointer; }
details.sub-accordion > summary h3 { display: inline; margin: 0; font-size: 1.05rem; }
details.sub-accordion[open] > summary { margin-bottom: 0.6rem; }
.industry-table input:not([type=checkbox]), .industry-table select { padding: 0.3rem 0.4rem; min-width: 9rem; }
.industry-table input.input-small { min-width: 0; }
.industry-table select.is-open { border: 2px solid var(--warn-text); }
.merge-box { background: var(--tint-grey); border-radius: 8px; padding: 0.8rem 1rem; margin-top: 1rem; }
.merge-box h3 { margin-top: 0; }

/* als Angebot erkannter Anhang */
.badge-angebot { background: var(--tint-green); color: var(--green-text); text-decoration: none; margin-left: 0.3rem; white-space: nowrap; }
