:root {
    --color-bg: #f6f8fa;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #1f2328;
    --color-text-muted: #6b7280;
    --color-dark: #2b2f33;
    --color-primary: #0d766e;
    --color-primary-hover: #0a5c55;
    --color-primary-rgb: 13, 118, 110;
    --color-accent: #4fd0c1;
    --color-available: #dcf5e3;
    --color-available-border: #16a34a;
    --color-success: #16a34a;
    --color-success-bg: #dcfce7;
    --color-success-text: #15803d;
    --color-warning: #f59e0b;
    --color-warning-bg: #fef3c7;
    --color-warning-text: #92610c;
    --color-danger: #ef4444;
    --color-danger-bg: #fdecea;
    --color-danger-text: #b91c1c;
    --color-info: #1f4b99;
    --color-info-bg: #eaf1ff;
    --color-info-text: #1f4b99;
    --radius: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

/* Platz fuer die Scrollleiste immer freihalten. Sonst wird die Seite
   schmaler, sobald sie hoeher als das Fenster wird und die Leiste
   erscheint - etwa beim Aufklappen einer Karte in einer kurzen Liste
   (Nutzerfeedback 2026-11-16). Auf Telefonen liegt die Leiste ueber dem
   Inhalt und belegt keinen Platz, dort aendert das nichts. */
html {
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

/* App shell */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --header-control ist die gemeinsame Hoehe ALLER Elemente in der Kopfzeile:
   Logo, Navigationslinks, die runden Icon-Knoepfe und der Profil-Avatar.
   Vorher hatte jedes seine eigene (Logo 32px, Knoepfe 36px, Links 37.6px) -
   vertikal zentriert waren sie zwar alle, aber drei verschiedene Hoehen
   nebeneinander lesen sich trotzdem als schief. Mobil setzt responsive.css
   den Wert einmal hoch, statt jede Regel einzeln nachzuziehen. */
/* Bleibt beim Scrollen oben stehen. Auf dem Telefon ist das der Zugang zum
   Menue: ohne sticky muesste man aus einer langen Buchungs- oder Umsatzliste
   erst wieder ganz nach oben scrollen, um ueberhaupt an die Navigation zu
   kommen.

   z-index 50 liegt ueber allem Seiteninhalt (die hoechsten sind die sticky
   Kalenderzeilen mit 30) und gleichauf mit dem Modal-Overlay - das steht
   spaeter im Dokument und deckt die Kopfzeile deshalb korrekt ab. Die
   Dropdowns der Kopfzeile (z-index 100) sind Kinder und stapeln innerhalb
   dieses Kontexts, bleiben also ueber ihr. */
.app-header {
    --header-control: 36px;
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    /* Abstaende hier, an .app-nav, .app-nav__link und .app-header__user
       fliessend: volle Groesse ab 1600px, bis 1025px kompakt (darunter
       klappt die Navigation ins Burger-Menue, responsive.css). Die
       clamp()-Mitte ist jeweils die Gerade zwischen beiden Endwerten.
       Ohne das reichte der Platz unter ~1280px nicht (2026-11-02). Der
       Endpunkt 1600 statt 1440, damit bei 1440px auch der Testphasen-
       Hinweis (.app-header__trial) noch hineinpasst. */
    gap: clamp(1rem, 2.78vw - 12.52px, 2rem);
    padding: 0.75rem clamp(1rem, 1.39vw + 1.74px, 1.5rem);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

/* Das Logo schrumpft auf dem Desktop nicht mehr - frueher gab es bei
   Platzmangel als erstes nach und verschwand ganz. Im Burger-Modus
   (responsive.css) darf es wieder schrumpfen. */
.app-header__brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 0; /* erlaubt dem Logo, bei Platzmangel zu schrumpfen (s.u.) */
}

/* Link um das Logo zur Startseite des Bereichs - selbst Flex-Container mit
   min-width 0, damit das Schrumpfen des Logos (s.u.) durch ihn hindurch greift. */
.app-header__home {
    display: flex;
    align-items: center;
    min-width: 0;
}

/* Etwas niedriger als die Knoepfe (seit dem Feedback-Knopf 2026-11-02, der
   rechts Platz braucht) - so ist das Logo rund 125px breit. Auf einem
   320px-Geraet bleiben neben Menue-Knopf und den vier Icons rechts auch die
   nicht uebrig - ohne die Begrenzung schoebe sich das Logo unter die
   Icons. max-width laesst es dann proportional kleiner werden (object-fit,
   damit es sich nicht staucht), statt zu ueberlappen. */
.app-header__logo {
    height: calc(var(--header-control) - 6px);
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

/* flex-basis auto statt 0: sonst rechnet der Browser mit Navigation = 0px,
   haelt die Zeile fuer gross genug und laesst rechts nichts schrumpfen. */
.app-nav {
    display: flex;
    gap: clamp(0px, 0.696vw - 7.13px, 0.25rem);
    flex: 1 1 auto;
}

/* Hoehe ueber min-height statt ueber vertikale Polsterung, damit der Link
   dieselbe Hoehe hat wie die Knoepfe daneben - der farbige Hintergrund des
   aktiven Punktes macht jede Abweichung sichtbar. */
.app-nav__link {
    display: flex;
    align-items: center;
    min-height: var(--header-control);
    padding: 0 clamp(0.45rem, 1.252vw - 5.64px, 0.9rem);
    border-radius: var(--radius);
    color: var(--color-text-muted);
    font-size: clamp(0.875rem, 0.348vw + 10.44px, 1rem);
    font-weight: 500;
    white-space: nowrap;
}

.app-nav__link:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.app-nav__link.is-active {
    background: var(--color-primary);
    color: #fff;
}

.app-header__user {
    display: flex;
    align-items: center;
    gap: clamp(0.4rem, 0.974vw - 3.58px, 0.75rem);
    min-width: 0; /* der Testphasen-Hinweis darf hier Platz abgeben (s.u.) */
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Gleiche Zeichenflaeche fuer alle Kopfzeilen-Symbole. Im Markup stehen
   unterschiedliche Groessen (Glocke 20px, Menue 22px); nebeneinander in
   gleich grossen runden Knoepfen faellt schon dieser Unterschied auf. */
.app-nav-toggle svg,
.notification-bell svg {
    width: 20px;
    height: 20px;
}


.link-button {
    background: none;
    border: none;
    margin-top: 0;
    color: var(--color-primary);
    cursor: pointer;
    font: inherit;
    font-weight: inherit;
    padding: 0;
    vertical-align: middle;
}

/* In Tabellenzellen auf der Grundlinie wie der Text der Nachbarzellen -
   "middle" schob "Details" sichtbar tiefer als "Bestätigt" daneben
   (Aufenthalte beim Gast, Buchungsliste; Nutzerfeedback 2026-11-16). */
td .link-button {
    vertical-align: baseline;
}

.link-button:hover {
    background: none;
    text-decoration: underline;
}

.link-button--danger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--color-danger);
}

/* display:inline-flex oben schlaegt sonst die UA-Regel [hidden]{display:none} -
   ohne das hier bleibt z.B. "Verbindung entfernen" unter Einstellungen →
   Kommunikation auch ohne verbundenes Postfach sichtbar. */
.link-button[hidden] {
    display: none;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Fusszeile mit Impressum/Datenschutz (layout.php) - schmal und gedaempft,
   damit sie unter langen Listen nicht wie ein Seitenende-Element wirkt. */
.app-footer {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem 1rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}
.app-footer a {
    color: inherit;
}

/* Per "Mehr"-Menü im Kalender umschaltbar (siehe cal-fullwidth-toggle in
   calendar.js) - nützlich auf großen Bildschirmen, wenn durch viele
   Einheiten-Spalten sonst ständig horizontal gescrollt werden müsste. */
.app-content--full-width {
    max-width: none;
}

/* Cards / tables */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.92rem;
}

th {
    color: var(--color-text-muted);
    font-weight: 600;
}

th[data-sort] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th[data-sort]::after {
    content: '';
    display: inline-block;
    width: 0.7em;
    margin-left: 0.2em;
    opacity: 0.35;
}

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

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

.empty-state {
    color: var(--color-text-muted);
    padding: 2rem 0;
    text-align: center;
}

/* Notification-Glocke + Dropdown (E-Mails/Zahlungen etc., siehe
   NotificationService) - links neben dem Profil-Dropdown */

.notification-menu {
    position: relative;
}

.notification-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--header-control);
    height: var(--header-control);
    margin-top: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--color-bg);
    color: var(--color-text-muted);
    cursor: pointer;
}

.notification-bell:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.notification-bell__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--color-surface);
}

.notification-bell__badge[hidden] {
    display: none;
}

.notification-menu__dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    min-width: 260px;
    z-index: 100;
    overflow: hidden;
}

.notification-menu__dropdown[hidden] {
    display: none;
}

.notification-menu__empty {
    padding: 0.9rem 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.notification-menu__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
}

.notification-menu__item:last-child {
    border-bottom: none;
}

.notification-menu__item:hover {
    background: var(--color-bg);
}

.notification-menu__count {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Persistente Ereignis-Zeile (Migration 0039): Titel + Alter links, ein
   Wegklick-Kreuz rechts. Anders als __item ein Container mit eigenem Link,
   damit das Kreuz nicht im <a> steckt (invalides HTML). */
.notification-menu__event {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
}

.notification-menu__event.is-read {
    background: var(--color-bg);
}

.notification-menu__event-link {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.6rem 0.4rem 0.6rem 1rem;
    font-size: 0.9rem;
    color: var(--color-text);
}

.notification-menu__event.is-read .notification-menu__label {
    color: var(--color-text-muted);
}

a.notification-menu__event-link:hover {
    background: var(--color-bg);
}

.notification-menu__age {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Die globale button-Regel (shared.css) bringt margin-top, Primaerfarbe,
   Polsterung und Radius mit - hier alles zuruecknehmen, sonst sitzt das × um
   den margin-top tiefer als seine Zeile. Bewusst ein kleiner runder Knopf
   (wie .icon-button) statt einer zeilenhohen Flaeche: der Hover soll das
   Kreuz markieren, nicht die halbe Zeile. */
.notification-menu__dismiss {
    flex-shrink: 0;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin: 0 0.6rem 0 0.2rem;
    padding: 0;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--color-text-muted);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}

/* button:hover (0,1,1) schlaegt die Klassenregel oben (0,1,0) - der
   Hintergrund MUSS deshalb hier stehen, sonst faerbt sich das × beim
   Ueberfahren in der Primaerfarbe ein. */
.notification-menu__dismiss:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

/* Hilfe-Button (öffnet die Einführungstour der aktuellen Seite/des Tabs erneut).
   Der Feedback-Knopf daneben traegt dieselbe Klasse (Form), sein Verhalten
   steht in feedback.js/feedback.css. */

.tour-help-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--header-control);
    height: var(--header-control);
    margin-top: 0;
    border-radius: 50%;
    background: var(--color-bg);
    border: none;
    color: var(--color-text-muted);
    /* Das Fragezeichen ist Text, kein Symbol - bei 1rem wirkt es neben den
       20px-Zeichnungen der Nachbarknoepfe kleiner, als es soll. */
    font-size: 1.15rem;
    font-weight: 700;
    padding: 0;
}

.tour-help-btn:hover {
    background: var(--color-border);
    color: var(--color-text);
}

/* Profil-Dropdown */

.profile-menu {
    position: relative;
}

.profile-menu__trigger {
    margin-top: 0;
    padding: 0;
    width: var(--header-control);
    height: var(--header-control);
    border-radius: 50%;
    background: var(--color-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-menu__trigger:hover {
    background: var(--color-primary-hover);
}

.profile-menu__avatar {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}

.profile-menu__dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    min-width: 200px;
    z-index: 100;
    overflow: hidden;
}

.profile-menu__dropdown[hidden] {
    display: none;
}

.profile-menu__info {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.profile-menu__name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
}

.profile-menu__email {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Restlaufzeit der kostenlosen Testphase (Migration 0052): Badge in der
   Kopfzeile plus Zeile im Profil-Dropdown (die bleibt auch dann sichtbar,
   wenn responsive.css den Badge auf schmalen Geraeten ausblendet). Drei
   Toene: neutral, ab 7 Tagen Warnfarbe, abgelaufen/heute rot. */

/* Huelle um den Testphasen-Hinweis: gibt als einziges Element der
   Kopfzeile Platz ab. Passt der Hinweis nicht mehr ganz hinein, rutscht er
   in eine zweite Zeile, die overflow:hidden abschneidet - er verschwindet
   also ganz statt halb abgeschnitten. Der ::before mit 0px Breite ist der
   Trick dafuer: Ein einzelnes Flex-Element bricht nie um, neben einem
   zweiten schon. Der Hinweis steht immer auch im Profil-Dropdown. */
.app-header__trial {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 0 1 auto;
    min-width: 0;
    height: var(--header-control);
    overflow: hidden;
}

.app-header__trial::before {
    content: "";
    width: 0;
    height: var(--header-control);
}

.trial-badge {
    display: inline-flex;
    align-items: center;
    height: var(--header-control);
    padding: 0 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    background: var(--color-bg);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    text-decoration: none;
}

.trial-badge:hover {
    filter: brightness(0.96);
}

.trial-badge--warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border-color: transparent;
}

.trial-badge--danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    border-color: transparent;
}

.profile-menu__trial {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.profile-menu__trial--warning {
    color: var(--color-warning-text);
}

.profile-menu__trial--danger {
    color: var(--color-danger-text);
}

.profile-menu__link {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: var(--color-text);
    background: none;
    border: none;
    font-weight: 400;
    margin-top: 0;
    border-radius: 0;
    cursor: pointer;
}

.profile-menu__link:hover {
    background: var(--color-bg);
}

.profile-menu__link--button {
    font: inherit;
}

/* Auth page */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 360px;
}

.auth-box h1 {
    font-size: 1.25rem;
    margin-top: 0;
}

/* Link auf besoo.de - nur so breit wie das Logo, damit nicht die ganze
   Kastenbreite klickbar ist. */
.auth-logo {
    display: block;
    width: fit-content;
    margin: 0 auto 1.5rem;
}

.auth-logo img {
    display: block;
    height: 2.5rem;
    width: auto;
}

/* Formular nur aus einem Knopf (E-Mail bestaetigen) - mittig statt links. */
.auth-box__actions {
    text-align: center;
}

/* Hauptknopf der Anmeldeseiten ueber die ganze Breite - passt zu "Mit
   Passkey anmelden" darunter (Nutzerwunsch 2026-10-24). */
.auth-box form:not(.auth-box__actions) > button[type="submit"]:not(.link-button) {
    width: 100%;
}

/* "Mit Passkey anmelden" unter dem Passwort-Formular (Migration 0091). */
.auth-passkey__divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0 0.75rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}
.auth-passkey__divider::before,
.auth-passkey__divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--color-border);
}
.auth-passkey__button {
    width: 100%;
}
.auth-passkey .alert {
    margin: 0 0 0.75rem;
}

.auth-box__footer-link {
    margin-top: 1rem;
    margin-bottom: 0;
    font-size: 0.875rem;
    text-align: center;
}

/* Impressum/Datenschutz unter dem Login-Kasten - Pflichtlinks auch auf der
   Anmeldeseite (eigenes Telemedium ohne App-Fusszeile), bewusst unauffaellig. */
.auth-box__legal {
    margin: 1.25rem 0 0;
    font-size: 0.8125rem;
    text-align: center;
    color: var(--color-text-muted);
}
.auth-box__legal a {
    color: inherit;
}

/* intro.js Einführungstour - Anpassung an das Farbschema der App */

.introjs-tooltip {
    font-family: var(--font);
    background-color: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
    width: min(420px, 90vw);
    max-width: min(420px, 90vw);
}

.introjs-tooltip-title {
    color: var(--color-text);
}

.introjs-tooltiptext {
    color: var(--color-text);
    line-height: 1.5;
    white-space: pre-line;
}

.introjs-tooltipbuttons {
    border-top-color: var(--color-border);
}

.introjs-skipbutton {
    color: var(--color-text-muted);
}

.introjs-skipbutton:hover,
.introjs-skipbutton:focus {
    color: var(--color-text);
    outline: none;
}

.introjs-button {
    box-sizing: border-box;
    display: inline-block;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    text-shadow: none;
    outline: none;
}

.introjs-button:hover {
    background: var(--color-bg);
}

.introjs-button:focus {
    background: var(--color-bg);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.25);
}

.introjs-button.introjs-disabled,
.introjs-button.introjs-disabled:hover,
.introjs-button.introjs-disabled:focus {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
    box-shadow: none;
    opacity: 0.65;
}

.introjs-nextbutton,
.introjs-nextbutton:hover,
.introjs-nextbutton:focus {
    padding: 0.6rem 1.2rem;
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* Für Tour-Schritte, die auf einen echten Klick statt auf "Weiter" warten
   (siehe waitForClick in tour.js) - Zurück/× bleiben nutzbar. */
body.introjs-hide-next .introjs-nextbutton {
    display: none;
}

.introjs-nextbutton:hover,
.introjs-nextbutton:focus {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.25);
}

.introjs-progress {
    background-color: var(--color-bg);
}

.introjs-progressbar {
    background-color: var(--color-primary);
}

.introjs-helperNumberLayer {
    background: var(--color-primary);
    text-shadow: none;
}

/* "floating" zentriert per Default auf die GESAMTE Hoehe des markierten
   Elements (siehe tour.js) - bei einer langen Liste (z. B. Gaeste-/
   Buchungstabelle) landet die Sprechblase dann weit unten und man muss erst
   dorthin scrollen. Diese Zusatzklasse (tooltipClass in tour.js) haelt sie
   stattdessen oben am Element, nur horizontal weiterhin zentriert. */
.introjs-tooltip.tour-align-top {
    top: 20px !important;
    margin-top: 0 !important;
}
