/* Seiten Benutzer, Geräte, Einstellungen, Protokoll, Hinweise, Anmeldung, Fehler (D11a). Nur Tokens, Desktop kompakt, Tablet und Phone mit großen Zielen. */
@layer pages {
    .tp-page-title--spaced { margin-bottom: var(--tp-space-4); }
    .tp-page-title--danger { color: var(--tp-color-error); }
    .tp-section__title--spaced { margin-top: var(--tp-space-4); }
    /* Externe Kalender (ES5): Schloss, Hilfelink, Hinweis zur geheimen Adresse */
    .tp-external-lock { flex: 0 0 auto; margin-left: var(--tp-space-1); vertical-align: -0.125em; color: var(--tp-color-text-muted, currentColor); }
    .tp-external-help { margin: calc(var(--tp-space-2) * -1) 0 var(--tp-space-3); }
    .tp-external-help__link { display: inline-flex; align-items: center; min-height: var(--tp-touch-min); }
    /* Hilfe zu externen Kalendern (ES9) */
    .tp-help__panel { display: grid; gap: var(--tp-space-3); max-width: 46rem; }
    .tp-help__panel:focus-visible { outline: none; box-shadow: var(--tp-focus-ring); }
    .tp-help__sub { margin: var(--tp-space-3) 0 0; }
    .tp-help__steps, .tp-help__list { margin: 0; padding-left: var(--tp-space-5); display: grid; gap: var(--tp-space-2); }
    .tp-help__source { color: var(--tp-color-text-muted); margin: 0; overflow-wrap: anywhere; }
    .tp-help__link { display: inline-flex; align-items: center; min-height: var(--tp-touch-min); }
    .tp-external-secret { margin-top: var(--tp-space-3); }
    .tp-nowrap { white-space: nowrap; }
    .tp-table__end { text-align: right; }
    .tp-table th.tp-table__end { text-align: right; }
    .tp-table .tp-table__row--danger td { background: var(--tp-color-error-tint); }
    .tp-table .tp-table__row--warn td { background: var(--tp-color-attention-tint); }
    .tp-input--auto { width: auto; }
    .tp-input--lg { min-height: calc(var(--tp-touch-min) * 1.15); font-size: var(--tp-font-size-lg); }
    .tp-btn--block { width: 100%; }

    /* Zeile aus Feldern und Knöpfen */
    .tp-inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0 var(--tp-space-4); align-items: end; }
    .tp-inline-form__actions { display: flex; flex-wrap: wrap; gap: var(--tp-space-2); align-items: center; margin-bottom: var(--tp-space-3); }

    .tp-pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tp-space-3); margin-top: var(--tp-space-3); }

    /* Hinweise */
    .tp-hint-list { display: flex; flex-direction: column; gap: var(--tp-space-2); }
    .tp-hint-list__item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--tp-space-2); padding: var(--tp-space-3) var(--tp-space-4); background: var(--tp-color-surface); border: 1px solid var(--tp-color-border); border-radius: var(--tp-radius); }
    .tp-hint-list__item--unread { background: var(--tp-color-attention-tint); border-color: var(--tp-color-attention); }

    /* Geräte */
    .tp-code { font-size: var(--tp-font-size-xl); font-family: monospace; letter-spacing: .15rem; }
    .tp-code__remaining { margin-left: var(--tp-space-2); }
    .tp-status--ok { color: var(--tp-color-success); font-weight: 600; }
    .tp-status--off { color: var(--tp-color-error); font-weight: 600; }
    .tp-check__row--compact { min-height: var(--tp-touch-min); }

    .tp-pairing__actions { margin-top: var(--tp-space-3); }

    /* Gerätekarten (Geräteseite und Kalender-Reiter): am Desktop zwei Spalten, am Smartphone eine Karte je Gerät untereinander. */
    .tp-device-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); gap: var(--tp-space-4); margin-bottom: var(--tp-space-4); align-items: start; }
    .tp-device-card { padding: var(--tp-space-4); }
    .tp-device-card__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--tp-space-3); align-items: flex-start; }
    .tp-device-card__name { margin: 0; font-size: var(--tp-font-size-lg); font-weight: 600; overflow-wrap: anywhere; }
    .tp-device-card__status { display: flex; flex-direction: column; align-items: flex-end; gap: var(--tp-space-1); text-align: right; }
    .tp-device-card__meta { margin-top: var(--tp-space-1); }
    .tp-device-card__actions { display: flex; flex-wrap: wrap; gap: var(--tp-space-2); margin-top: var(--tp-space-3); }
    .tp-device-cals { list-style: none; margin: 0 0 var(--tp-space-2); padding: 0; display: flex; flex-direction: column; }
    .tp-device-cals__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tp-space-2) var(--tp-space-4); padding: var(--tp-space-2) 0; border-top: 1px solid var(--tp-color-border); }
    .tp-device-cals__name { flex: 1 1 10rem; overflow-wrap: anywhere; }
    :where([data-profile="phone"]) .tp-device-card__status { align-items: flex-start; text-align: left; }
    :where([data-profile="phone"]) .tp-device-card__actions .tp-btn { min-height: var(--tp-touch-min); }

    /* Anmeldung */
    .tp-login__title { margin-bottom: var(--tp-space-4); }

    :where([data-profile="phone"]) .tp-table__actions .tp-btn { min-height: var(--tp-touch-min); }

    /* Startseite "Heute": vier Karten, am Desktop zweispaltig, am Smartphone gestapelt (Termine zuerst, so steht es im Markup). */
    .tp-today { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--tp-space-4); align-items: start; }
    .tp-today__card--entries { grid-row: span 3; }
    .tp-today__card .tp-card__header { display: flex; justify-content: space-between; align-items: baseline; gap: var(--tp-space-3); }
    .tp-today__more { display: inline-flex; align-items: center; min-height: var(--tp-touch-min); font-size: var(--tp-font-size-sm); }
    .tp-today__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--tp-space-2); }
    .tp-today__day + .tp-today__day { margin-top: var(--tp-space-4); }
    .tp-today__day-title { margin: 0 0 var(--tp-space-2); font-size: var(--tp-font-size-md); }
    .tp-today__row { display: flex; justify-content: space-between; align-items: center; gap: var(--tp-space-3); min-width: 0; }
    .tp-today__text { display: flex; flex-direction: column; min-width: 0; }
    .tp-today__title { font-weight: 600; }
    .tp-today__clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tp-today__time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3.2rem; }
    .tp-today__entry-button { display: flex; align-items: center; gap: var(--tp-space-3); width: 100%; min-height: var(--tp-touch-min); padding: var(--tp-space-2) var(--tp-space-3); text-align: left; color: inherit; font: inherit; cursor: pointer; background: color-mix(in srgb, var(--tp-cal-soft) 55%, var(--tp-layer-2-bg)); border: 1px solid var(--tp-layer-2-border); border-left: 4px solid var(--tp-cal-strong); border-radius: var(--tp-radius); box-shadow: var(--tp-layer-2-shadow); }
    /* V3: die Schatten-Regel des Bausteins (Ebene pages) hob sonst den Fokusring der Basis auf. */
    .tp-today__entry-button:focus-visible { box-shadow: var(--tp-focus-ring); }
    :where(:root[data-input="mouse"]) .tp-today__entry-button:hover { background: var(--tp-cal-soft); }
    /* Mit Abhaken-Kästchen daneben: Knopf füllt den Rest (stand in calendar.css; hier, damit die Ebene pages ihn nicht überstimmt). */
    .tp-today__entry .tp-today__entry-button { flex: 1 1 auto; width: auto; min-width: 0; }

    /* V4: am Smartphone steht die Zeit über dem Titel (Zeitspannen brechen sonst um und der Titel schiebt sich unter den "…"-Knopf). */
    :where([data-profile="phone"]) .tp-today__entry-button { display: grid; grid-template-columns: auto auto minmax(0, 1fr); column-gap: var(--tp-space-2); row-gap: 0; align-items: center; }
    :where([data-profile="phone"]) .tp-today__entry-button > :first-child { grid-column: 1; grid-row: 1 / span 3; }
    :where([data-profile="phone"]) .tp-today__entry-button > .tp-today__icon { grid-column: 2; grid-row: 1 / span 3; }
    :where([data-profile="phone"]) .tp-today__entry-button > .tp-today__time { grid-column: 3; grid-row: 1; white-space: nowrap; min-width: 0; }
    :where([data-profile="phone"]) .tp-today__entry-button > .tp-today__text { grid-column: 3; grid-row: 2; overflow-wrap: anywhere; }
    :where([data-profile="phone"]) .tp-today__entry-button > .tp-moved-mark { grid-column: 3; grid-row: 3; justify-self: start; }
    :where([data-profile="phone"]) .tp-today { grid-template-columns: minmax(0, 1fr); }
    :where([data-profile="phone"]) .tp-today__card--entries { grid-row: auto; }

    /* Mein Konto: Angaben als Beschriftung/Wert-Paare */
    .tp-account { display: grid; grid-template-columns: max-content 1fr; gap: var(--tp-space-2) var(--tp-space-4); margin: 0 0 var(--tp-space-3); }
    .tp-account dt { color: var(--tp-color-text-muted); }
    .tp-account dd { margin: 0; font-weight: 600; word-break: break-word; }

    /* V5: die Kopfzeile "Zeitraum und Neu" doppelt die Leiste des Rasters (Blättern, Zeitraum, "Neuer Termin"); wo beide stehen, entfällt sie. */
    :where([data-profile="tablet"]) .tp-tabhead:has(~ .tp-grid .tp-grid__add) { display: none; }
    /* Übersicht der Tastaturkürzel (DV8) */
    .tp-shortcuts { display: grid; gap: var(--tp-space-2); margin: 0; }
    .tp-shortcuts__row { display: grid; grid-template-columns: minmax(7rem, max-content) 1fr; gap: var(--tp-space-4); align-items: baseline; }
    .tp-shortcuts__row dt, .tp-shortcuts__row dd { margin: 0; }
    .tp-kbd { display: inline-block; min-width: 1.8em; padding: 2px var(--tp-space-2); text-align: center; font: inherit; font-weight: 600; white-space: nowrap;
              border: 1px solid var(--tp-color-border); border-bottom-width: 2px; border-radius: var(--tp-radius-sm); background: var(--tp-color-surface); color: var(--tp-color-text); }

    /* Mein Konto: Profilbild (P2). Rund, Initialen als Leerzustand; Phone stapelt, Touch bekommt große Ziele über die Standard-Bausteine. */
    .tp-avatar-editor__body { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--tp-space-4); align-items: start; }
    .tp-avatar-editor__preview .tp-avatar { --tp-avatar-size: 8rem; } /* große Vorschau über die Größe des Bausteins TpAvatar */
    .tp-avatar-editor__controls { display: grid; gap: var(--tp-space-3); min-width: 0; }
    .tp-avatar-editor__actions { display: flex; flex-wrap: wrap; gap: var(--tp-space-2); }
    :where([data-profile="phone"]) .tp-avatar-editor__body { grid-template-columns: minmax(0, 1fr); justify-items: center; }
    :where([data-profile="phone"]) .tp-avatar-editor__controls { justify-items: stretch; width: 100%; }
}
