/* =====================================================================
   TickTackTrace Web – Design-System (Redesign 2026-07)
   Bootstrap bleibt als Basis geladen; alles Eigene trägt das Präfix
   "ttt-", damit es nicht mit Bootstrap-Klassen (.btn, .nav-link, …)
   kollidiert. Farben als Tokens, dunkles Schema über prefers-color-scheme.
   ===================================================================== */

:root {
    --bg: #e9eef5;
    --surface: #ffffff;
    --surface-2: #f4f7fb;
    --border: #d8e1ee;
    --text: #16202e;
    --muted: #5d6a80;
    --accent: #2f6fb0;
    --accent-strong: #235891;
    --accent-contrast: #ffffff;
    --brand-bar: #13304e;
    --brand-bar-text: #d5e2f2;
    --brand-bar-muted: #8ba3c0;
    --good: #268a5f;
    --good-soft: #e3f3ec;
    --warn: #a96f14;
    --warn-soft: #f9eed8;
    --bad: #b33838;
    --bad-soft: #f9e3e3;
    --info-soft: #e7eff9;
    --shadow: 0 1px 2px rgba(19,48,78,.06), 0 6px 18px rgba(19,48,78,.06);
    --shadow-lg: 0 8px 40px rgba(12,26,45,.28);
    --radius: 14px;
    --radius-sm: 9px;
    --tap: 44px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0c131d;
        --surface: #161f2c;
        --surface-2: #1b2534;
        --border: #293546;
        --text: #e7edf5;
        --muted: #94a2b7;
        --accent: #5b9bd8;
        --accent-strong: #78b0e2;
        --accent-contrast: #0c131d;
        --brand-bar: #0a111c;
        --brand-bar-text: #cedbec;
        --brand-bar-muted: #6f83a0;
        --good: #46b184;
        --good-soft: #12352a;
        --warn: #d59b45;
        --warn-soft: #3a2f16;
        --bad: #e07f7f;
        --bad-soft: #3a1c1c;
        --info-soft: #1b2941;
        --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.3);
        --shadow-lg: 0 10px 46px rgba(0,0,0,.6);
    }
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1:focus {
    outline: none;
}

.tnum {
    font-variant-numeric: tabular-nums;
}

.ttt-label {
    font-size: 11px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

/* ---------- App-Shell: Topbar, Sidebar (Desktop), Tab-Bar (Mobil) ---------- */

.ttt-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.ttt-topbar {
    background: var(--brand-bar);
    color: var(--brand-bar-text);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.ttt-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: -.01em;
    font-size: 17px;
    color: inherit;
    text-decoration: none;
}

.ttt-brand:hover {
    color: inherit;
}

/* Firmenzeichen neben dem Schriftzug. Steht seit dem Tippzähler außerhalb des
   Links (siehe MainLayout), deshalb hier eigene Regeln statt Inline-Stil.
   Der negative Abstand gleicht die 12px Lücke der Kopfzeile auf die früheren
   8px aus. Die Tipp-Hervorhebung ist abgeschaltet: sechs Antipper sollen nicht
   sechsmal blau aufblitzen. */
.ttt-brandmark {
    height: 30px;
    width: auto;
    flex: none;
    margin-right: -4px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ttt-brand .mark {
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    border-radius: 7px;
    flex: none;
    background: linear-gradient(135deg, var(--accent) 0%, #7fc0f0 100%);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .01em;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}

/* ---------- Anmelde-/Abmelde-Screen ---------- */

.ttt-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--bg);
}

.ttt-auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 28px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.ttt-auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.ttt-auth-brand .mark {
    min-width: 44px;
    height: 44px;
    padding: 0 10px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent) 0%, #7fc0f0 100%);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .01em;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}

.ttt-auth-brand .name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
}

.ttt-auth-status {
    color: var(--muted);
    font-size: 14.5px;
    margin: 0;
}

.ttt-mascot {
    height: 40px;
    width: auto;
    flex: none;
    margin-right: 6px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35));
    cursor: pointer;
}

.ttt-mascot-wrap {
    display: inline-flex;
}

/* Vollbild-Overlay beim Hover: Berlioz groß + mittig, Hintergrund abgedunkelt.
   pointer-events: none, damit der Hover auf dem kleinen Logo bleibt (kein Flackern).

   Es erscheint erst, wenn der Zeiger 3 Sekunden auf dem Logo BLEIBT – wer nur
   darüberfährt, bekommt nichts zu sehen. Umgesetzt über transition-delay, nicht
   über eine Animation: die Verzögerung wird beim Verlassen sofort verworfen, ein
   zu frühes Weggehen bricht das Einblenden also sauber ab. */
.ttt-mascot-wrap {
    --mascot-delay: 3s;
}

.ttt-mascot-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 12, 22, .6);
    opacity: 0;
    visibility: hidden;
    /* visibility MUSS mitübergeben werden, sonst schaltet sie sofort um und das
       Overlay fängt Klicks ab, bevor überhaupt etwas zu sehen ist. */
    transition: opacity .2s ease, visibility .2s ease;
    /* Beim Verlassen ohne Verzögerung ausblenden. */
    transition-delay: 0s;
    pointer-events: none;
    z-index: 2000;
}

.ttt-mascot-wrap:hover .ttt-mascot-overlay {
    opacity: 1;
    visibility: visible;
    transition-delay: var(--mascot-delay);
}

.ttt-mascot-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    transform: scale(.92);
    transition: transform .2s ease;
    transition-delay: 0s;
}

.ttt-mascot-wrap:hover .ttt-mascot-figure {
    transform: scale(1);
    transition-delay: var(--mascot-delay);
}

.ttt-mascot-figure img {
    max-width: 82vw;
    max-height: 74vh;
    width: auto;
    height: auto;
    filter: drop-shadow(0 12px 48px rgba(0, 0, 0, .55));
}

.ttt-mascot-caption {
    font-size: clamp(16px, 2.4vw, 26px);
    font-weight: 700;
    color: #fff;
    letter-spacing: .01em;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .55);
}

/* Zweite Zeile bewusst kleiner und zurückgenommen – die Pointe soll die
   Hauptzeile nicht überschreien. Negativer Abstand, weil .ttt-mascot-figure
   die Elemente mit gap: 14px auseinanderzieht. */
.ttt-mascot-subcaption {
    margin-top: -8px;
    font-size: clamp(13px, 1.5vw, 17px);
    font-weight: 500;
    font-style: italic;
    color: rgba(255, 255, 255, .8);
    letter-spacing: .01em;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .55);
}

.ttt-topbar .spacer,
.ttt-toolbar .spacer {
    flex: 1;
}

.ttt-user {
    font-size: 13.5px;
    color: var(--brand-bar-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ttt-user .uname {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ttt-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex: none;
    background: rgba(255,255,255,.12);
    color: var(--brand-bar-text);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
}

.ttt-ghost-btn {
    background: rgba(255,255,255,.08);
    color: var(--brand-bar-text);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.ttt-ghost-btn:hover {
    background: rgba(255,255,255,.16);
    color: var(--brand-bar-text);
}

.ttt-body {
    flex: 1;
    display: flex;
}

.ttt-sidebar {
    display: none;
}

.ttt-navgroup {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ttt-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    font-size: 14.5px;
    padding: 11px 14px;
    border-radius: 10px;
    cursor: pointer;
    min-height: var(--tap);
}

.ttt-nav-link .ico {
    width: 20px;
    height: 20px;
    flex: none;
    opacity: .8;
}

.ttt-nav-link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.ttt-nav-link.active {
    background: var(--info-soft);
    color: var(--accent-strong);
    font-weight: 650;
}

.ttt-nav-link.active .ico {
    opacity: 1;
}

.ttt-content {
    flex: 1;
    padding: 20px 16px 96px;
    max-width: 920px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
}

.ttt-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}

.ttt-tab {
    flex: 1;
    background: none;
    border: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    min-height: var(--tap);
    text-decoration: none;
}

.ttt-tab .ico {
    width: 22px;
    height: 22px;
}

.ttt-tab.active {
    color: var(--accent);
}

.ttt-tab.active .ico {
    transform: translateY(-1px);
}

/* ---------- Seitenkopf ---------- */

.ttt-page-head {
    margin: 4px 0 18px;
}

.ttt-page-head h1 {
    font-size: 24px;
    letter-spacing: -.02em;
    margin: 0 0 3px;
    text-wrap: balance;
    font-weight: 700;
}

.ttt-page-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

/* ---------- Stat-Kacheln (Start) ---------- */

.ttt-tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.ttt-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px 16px;
    box-shadow: var(--shadow);
}

.ttt-tile .ttt-label {
    display: block;
    margin-bottom: 7px;
}

.ttt-tile .val {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.ttt-tile .val.sm {
    font-size: 18px;
}

.ttt-tile.accent {
    position: relative;
    overflow: hidden;
}

.ttt-tile.accent::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent);
}

.ttt-tile .delta {
    font-size: 12.5px;
    font-weight: 600;
    margin-top: 3px;
}

.delta.pos {
    color: var(--good);
}

.delta.neg {
    color: var(--warn);
}

/* ---------- Buttons ---------- */

.ttt-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.ttt-btn {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 11px 18px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    min-height: var(--tap);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.ttt-btn.primary {
    background: var(--accent);
    color: var(--accent-contrast);
}

.ttt-btn.primary:hover {
    background: var(--accent-strong);
    color: var(--accent-contrast);
}

.ttt-btn.ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.ttt-btn.ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.ttt-btn.success {
    background: var(--good);
    color: #fff;
}

.ttt-btn:disabled {
    background: var(--surface-2);
    color: var(--muted);
    border-color: var(--border);
    cursor: not-allowed;
}

/* Kompakte Buttons (z. B. Rollen-Umschalter im Admin-Panel) */
.ttt-btn.sm {
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    min-height: 34px;
    border-radius: 8px;
}

/* Rollen-Aktion auf der Mitarbeiterkarte (mobil) */
.ttt-roleaction {
    margin-top: 10px;
}

.ttt-role-self {
    font-size: 12.5px;
    color: var(--muted);
    font-style: italic;
}

/* Schalter-Zeile (Admin: automatische Erinnerung) */
.ttt-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
}

.ttt-switch-row .t {
    display: block;
    font-weight: 600;
    color: var(--text);
}

.ttt-switch-row .s {
    display: block;
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
}

.ttt-switch-row input[type="checkbox"] {
    flex: none;
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Mehrere Schalter in einem Block (Outlook-Synchronisierung): getrennt, sonst
   kleben die Erklärtexte aneinander und man liest sie als einen. */
.ttt-switch-row + .ttt-switch-row {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.ttt-mailactions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* ---------- Outlook-Synchronisierung (Admin) ---------- */

.ttt-syncstats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--muted);
}

.ttt-syncstats strong {
    color: var(--text);
    margin-left: 4px;
}

.ttt-syncstats .bad,
.ttt-syncstats .bad strong {
    color: var(--bad);
}

.ttt-syncfails {
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.ttt-syncfail {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}

.ttt-syncfail .h {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

.ttt-syncfail .who {
    font-weight: 600;
    color: var(--text);
}

.ttt-syncfail .when,
.ttt-syncfail .kind {
    font-size: 12.5px;
    color: var(--muted);
}

.ttt-syncfail .m {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
}

/* Der Fehlertext kommt von Graph und kann sehr lang sein oder eine einzelne lange
   Zeichenkette enthalten (Termin-Id, Nachverfolgungs-Id). Ohne Umbruch im Wort
   sprengt so ein Eintrag auf dem Telefon das Layout. */
.ttt-syncfail .e {
    margin-top: 6px;
    font-size: 12px;
    color: var(--bad);
    overflow-wrap: anywhere;
}

/* Mitarbeiter-Suche + Aufklapp-Zeile im Admin-Panel */
.ttt-empsearch {
    margin-bottom: 12px;
    max-width: 360px;
}

.ttt-empsearch input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
}

.ttt-expandrow {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

/* ---------- Toolbar mit Stepper (Kalender/Monatsübersicht) ---------- */

.ttt-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ttt-stepper {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
}

.ttt-stepper button {
    width: 34px;
    height: 34px;
    border: 0;
    background: none;
    border-radius: 7px;
    cursor: pointer;
    color: var(--text);
    font-size: 16px;
}

.ttt-stepper button:hover:not(:disabled) {
    background: var(--surface-2);
}

.ttt-stepper button:disabled {
    color: var(--muted);
    opacity: .4;
    cursor: not-allowed;
}

.ttt-stepper .cur {
    padding: 0 12px;
    font-weight: 650;
    font-size: 15px;
    min-width: 118px;
    text-align: center;
}

/* ---------- Meldungen ---------- */

.ttt-alert {
    border-radius: 10px;
    padding: 10px 13px;
    font-size: 14px;
    margin-bottom: 14px;
}

.ttt-alert.success {
    background: var(--good-soft);
    color: var(--good);
}

.ttt-alert.error {
    background: var(--bad-soft);
    color: var(--bad);
}

.ttt-alert.warn {
    background: var(--warn-soft);
    color: var(--warn);
}

/* ---------- Tages-Karten (Kalender, mobil) ---------- */

.ttt-daylist {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.ttt-daycard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 46px 1fr auto;
    align-items: center;
    gap: 13px;
    padding: 13px 14px;
    position: relative;
    overflow: hidden;
}

.ttt-daycard .stripe {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: transparent;
}

.ttt-daycard.open .stripe {
    background: var(--warn);
}

.ttt-daycard.locked,
.ttt-daycard.weekend {
    background: var(--surface-2);
    box-shadow: none;
}

.ttt-daycard .date {
    text-align: center;
}

.ttt-daycard .date .d {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1;
}

.ttt-daycard .date .wd {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: 3px;
}

.ttt-daycard .dcenter {
    min-width: 0;
}

.ttt-daycard .dtimes {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

.ttt-daycard .dtimes.none {
    font-style: italic;
    opacity: .8;
}

.ttt-daycard .dright {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.ttt-worked {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -.01em;
}

.ttt-worked.dash {
    color: var(--muted);
    font-weight: 500;
}

.ttt-worked.over {
    color: var(--bad);
}

/* ---------- Chips (Arbeitsart / Status) ---------- */

.ttt-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

.ttt-chip::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .9;
}

.ttt-chip.work {
    color: var(--accent-strong);
    background: var(--info-soft);
}

.ttt-chip.vac {
    color: #7a5cc0;
    background: color-mix(in srgb, #7a5cc0 14%, transparent);
}

.ttt-chip.sick {
    color: #c05c5c;
    background: color-mix(in srgb, #c05c5c 14%, transparent);
}

.ttt-chip.holi {
    color: var(--muted);
    background: var(--surface-2);
}

.ttt-chip.school {
    color: #3a8f8f;
    background: color-mix(in srgb, #3a8f8f 15%, transparent);
}

.ttt-chip.badge-warn {
    color: var(--warn);
    background: var(--warn-soft);
}

.ttt-chip.badge-done {
    color: var(--good);
    background: var(--good-soft);
}

.ttt-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    display: grid;
    place-items: center;
    color: var(--accent);
}

.ttt-icon-btn:hover {
    background: var(--info-soft);
}

.ttt-lockmark {
    color: var(--muted);
    font-size: 15px;
}

/* ---------- Jahresübersicht (Start, mobil + Desktop) ---------- */

.ttt-yearview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.ttt-yearview table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.ttt-yearview thead th {
    text-align: left;
    font-size: 11px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.ttt-yearview th.num,
.ttt-yearview td.num {
    text-align: right;
}

.ttt-yearview tbody td {
    padding: 9px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
}

.ttt-yearview .mname {
    font-weight: 600;
}

/* Offene (noch nicht abgegebene) Monate zählen nicht zur Summe – ausgegraut. */
.ttt-yearview tbody tr.unclosed td {
    color: var(--muted);
}

.ttt-yearview tfoot td {
    padding: 11px 16px;
    font-size: 14px;
    border-top: 2px solid var(--border);
}

.ttt-yearview tfoot tr.total td {
    font-weight: 700;
    color: var(--text);
    background: var(--surface-2);
}

.ttt-yearview tfoot tr.rest td {
    font-weight: 600;
    color: var(--accent-strong);
    background: var(--info-soft);
}

.ttt-legend {
    margin: 8px 2px 0;
    font-size: 12px;
    color: var(--muted);
}

/* ---------- Tabellen (Desktop) ---------- */

.ttt-table-wrap {
    display: none;
}

/* ---------- Monatskarten (Monatsübersicht, mobil) ---------- */

.ttt-monthlist {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.ttt-monthcard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 13px 15px;
}

.ttt-monthcard .mtop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.ttt-monthcard .mname {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -.01em;
}

.ttt-mgrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 8px;
}

.ttt-mgrid .cell .ttt-label {
    display: block;
    margin-bottom: 2px;
}

.ttt-mgrid .cell .v {
    font-weight: 650;
    font-size: 14.5px;
}

/* Abschnittsüberschriften (Admin-Panel) */
.ttt-section-head {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 26px 0 12px;
}

/* Kartenliste, die auf allen Breakpoints sichtbar bleibt (z. B. offene Monate) */
.ttt-cardlist {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.ttt-openmonths {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Klickbare Monatskarte: springt in den Kalender des Monats. */
.ttt-monthcard.link {
    cursor: pointer;
}

.ttt-monthcard.link:hover,
.ttt-monthcard.link:focus-visible {
    border-color: var(--accent);
}

.ttt-monthcard .golink {
    color: var(--muted);
    flex: none;
}

.ttt-monthcard.link:hover .golink {
    color: var(--accent);
}

.ttt-monthcard.selected {
    border-color: var(--accent);
    background: var(--info-soft);
}

.ttt-bar {
    height: 5px;
    border-radius: 3px;
    background: var(--surface-2);
    overflow: hidden;
    margin-top: 11px;
}

.ttt-bar > i {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
}

/* ---------- Bottom-Sheet (Tag bearbeiten) ---------- */

.ttt-scrim {
    position: fixed;
    inset: 0;
    background: rgba(10,20,35,.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 50;
}

.ttt-sheet {
    background: var(--surface);
    width: 100%;
    max-width: 460px;
    border-radius: 18px 18px 0 0;
    box-shadow: var(--shadow-lg);
    padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
    max-height: 92vh;
    overflow-y: auto;
    animation: ttt-rise .22s cubic-bezier(.2,.8,.2,1);
}

@keyframes ttt-rise {
    from { transform: translateY(24px); opacity: .6; }
    to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .ttt-sheet {
        animation: none;
    }
}

.ttt-sheet .grabber {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin: 6px auto 12px;
}

.ttt-sheet h3 {
    margin: 0 0 3px;
    font-size: 18px;
    letter-spacing: -.01em;
    font-weight: 700;
}

.ttt-sheet .sub {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 16px;
}

.ttt-field {
    margin-bottom: 14px;
}

.ttt-field > .ttt-label {
    display: block;
    margin-bottom: 6px;
}

/* Kleiner erläuternder Hinweis unter einem Eingabefeld (normale Schreibweise). */
.ttt-field-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--muted);
}

/* Eingabefeld mit "i"-Info-Button am Ende. */
.ttt-input-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ttt-input-info > input {
    flex: 1;
    min-width: 0;
}

.ttt-infobtn {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--accent-strong);
    font-style: italic;
    font-weight: 700;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.ttt-infobtn:hover {
    background: var(--info-soft);
    border-color: var(--accent);
}

/* Info-Popup (nutzt ttt-scrim/ttt-sheet). */
.ttt-infosheet h3 {
    margin: 4px 0 10px;
}

.ttt-infosheet p {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--text);
}

.ttt-info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 4px 0 12px;
    font-size: 14px;
}

.ttt-info-table th,
.ttt-info-table td {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}

.ttt-info-table th.num,
.ttt-info-table td.num {
    text-align: right;
    font-weight: 650;
}

.ttt-info-table thead th {
    font-size: 11px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

.ttt-info-list {
    margin: 0 0 12px;
    padding-left: 18px;
    font-size: 14px;
}

.ttt-info-list li {
    margin-bottom: 4px;
}

.ttt-field select,
.ttt-field input,
.ttt-field textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 15px;
    min-height: var(--tap);
    color-scheme: light dark;
}

/* Mehrzeilige Eingabe (Änderungsantrag): gleiche Optik wie die einzeiligen Felder,
   aber in der Höhe verstellbar und mit der Schrift des Formulars statt der
   Browser-Vorgabe (monospace). */
.ttt-field textarea {
    resize: vertical;
    line-height: 1.45;
    font-family: inherit;
}

.ttt-field select:focus,
.ttt-field input:focus,
.ttt-field textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 0;
    border-color: var(--accent);
}

.ttt-field-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.ttt-field.summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 13px;
}

.ttt-field.summary .ttt-label {
    margin: 0;
}

.ttt-sheet-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.ttt-sheet-actions .ttt-btn {
    flex: 1;
    justify-content: center;
}

.ttt-hint {
    background: var(--info-soft);
    color: var(--accent-strong);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.45;
}

.ttt-hint.bridge {
    background: var(--warn-soft);
    color: var(--warn);
}

.ttt-hint.over {
    background: var(--bad-soft);
    color: var(--bad);
}

.ttt-hint.good {
    background: var(--good-soft);
    color: var(--good);
}

/* ---------- Registrierungs-Wizard ---------- */

.ttt-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    max-width: 560px;
}

.ttt-panel .ttt-bar {
    margin: 0 0 18px;
}

.ttt-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.ttt-choice {
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px 16px;
    cursor: pointer;
    color: var(--text);
    font: inherit;
}

.ttt-choice:hover {
    border-color: var(--accent);
    background: var(--info-soft);
}

.ttt-choice .t {
    font-weight: 700;
    font-size: 15.5px;
}

.ttt-choice .s {
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.ttt-wizard-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.ttt-wizard-actions .spacer {
    flex: 1;
}

.ttt-summary-list {
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ttt-summary-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.ttt-summary-list li:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.ttt-summary-list .k {
    color: var(--muted);
}

.ttt-summary-list .v {
    font-weight: 650;
    text-align: right;
}

/* ---------- Desktop (ab 768px) ---------- */

@media (min-width: 768px) {
    .ttt-body {
        max-width: 1160px;
        margin: 0 auto;
        width: 100%;
    }

    .ttt-sidebar {
        display: block;
        width: 232px;
        flex: none;
        padding: 18px 12px;
        border-right: 1px solid var(--border);
        background: var(--surface);
        position: sticky;
        top: 56px;
        height: calc(100vh - 56px);
    }

    .ttt-tabbar {
        display: none;
    }

    .ttt-content {
        padding: 26px 30px 40px;
    }

    .ttt-tiles {
        grid-template-columns: repeat(4, 1fr);
    }

    .ttt-page-head h1 {
        font-size: 27px;
    }

    /* Kalender/Monat: Tabelle statt Karten */
    .ttt-daylist,
    .ttt-monthlist {
        display: none;
    }

    .ttt-table-wrap {
        display: block;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        overflow: hidden;
    }

    .ttt-table-wrap table {
        width: 100%;
        border-collapse: collapse;
        margin: 0;
        font-variant-numeric: tabular-nums;
    }

    .ttt-table-wrap thead th {
        text-align: left;
        font-size: 11px;
        letter-spacing: .06em;
        text-transform: uppercase;
        color: var(--muted);
        font-weight: 600;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
    }

    .ttt-table-wrap thead th.num,
    .ttt-table-wrap tbody td.num {
        text-align: right;
    }

    .ttt-table-wrap tbody td {
        padding: 9px 16px;
        border-bottom: 1px solid var(--border);
        font-size: 14px;
        color: var(--text);
    }

    .ttt-table-wrap tbody tr:last-child td {
        border-bottom: 0;
    }

    .ttt-table-wrap tbody tr.open td:first-child {
        box-shadow: inset 3px 0 0 var(--warn);
    }

    .ttt-table-wrap tbody tr.locked,
    .ttt-table-wrap tbody tr.weekend {
        background: var(--surface-2);
        color: var(--muted);
    }

    .ttt-table-wrap tbody tr:hover:not(.locked):not(.weekend) {
        background: var(--surface-2);
    }

    /* Klickbare Zeile (Monatsübersicht → Kalender, Admin → Auswertung) */
    .ttt-table-wrap tbody tr.link {
        cursor: pointer;
    }

    .ttt-table-wrap tbody tr.selected,
    .ttt-table-wrap tbody tr.selected:hover {
        background: var(--info-soft);
    }

    .ttt-table-wrap .td-day .d {
        font-weight: 650;
    }

    .ttt-table-wrap .td-day .wd {
        color: var(--muted);
        font-size: 12px;
        margin-left: 6px;
    }

    /* Sheet auf großen Screens mittig als Dialog */
    .ttt-scrim {
        align-items: center;
        padding: 24px;
    }

    .ttt-sheet {
        border-radius: 18px;
        padding-bottom: 20px;
    }

    .ttt-sheet .grabber {
        display: none;
    }
}

/* =====================================================================
   Blazor-Pflichtteile (Fehlerleiste, Ladeanzeige, Validierung)
   ===================================================================== */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: var(--radius-sm);
}

    .blazor-error-boundary::after {
        content: "Es ist ein Fehler aufgetreten."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: var(--border);
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--accent);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: var(--muted);
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Lade…");
    }

/* ---------- Jahreskacheln + Übertragszeile (Start) ---------- */

/* Zweite Kachelreihe unter den Monatskacheln: Urlaub, Überstunden, Krankheitstage. */
.ttt-tiles.ttt-tiles-year {
    margin-top: 12px;
}

/* Erklärender Hinweis in einer Kachel – gedämpft, damit die Kennzahl darüber
   die Hauptaussage bleibt. */
.ttt-tile .ttt-note {
    margin-top: 5px;
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--muted);
    white-space: normal;
}

/* Übertrag aus der Registrierung – Fußzeile direkt über der Summe. */
.ttt-yearview tfoot tr.carry td {
    font-weight: 600;
    color: var(--muted);
}

/* Zwei Fußzeilen hintereinander: nur die erste trägt die dicke Trennlinie. */
.ttt-yearview tfoot tr.carry + tr.total td {
    border-top-width: 1px;
}

@media (min-width: 768px) {
    /* Drei Kacheln nutzen die volle Breite statt 3 von 4 Spalten. */
    .ttt-tiles.ttt-tiles-year {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* =====================================================================
   Mitarbeiterpflege im Admin-Panel + Sperrseite (2026-08)
   Nur Ergänzungen – die Regeln oben bleiben unverändert.
   ===================================================================== */

/* Werkzeugzeile über der Mitarbeiterliste: Suchfeld + Filter nebeneinander.
   Die Breitenbegrenzung des Suchfelds bleibt erhalten, es teilt sich die
   Zeile nur mit dem Schalter. */
.ttt-emptools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    margin-bottom: 12px;
}

.ttt-emptools .ttt-empsearch {
    flex: 1 1 240px;
    margin-bottom: 0;
}

/* Kontrollkästchen mit Beschriftung in einer Zeile (Filter "Deaktivierte anzeigen") */
.ttt-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    min-height: 34px;
}

.ttt-inline-check input[type="checkbox"] {
    flex: none;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Chip für ausgeschiedene Mitarbeiter – gedämpft, aber deutlich abgesetzt. */
.ttt-chip.inactive {
    color: var(--bad);
    background: var(--bad-soft);
}

/* Mehrere Aktionen in einer Zeile (Rolle, Bearbeiten, Deaktivieren).
   Bricht auf schmalen Karten um, statt die Karte zu sprengen. */
.ttt-rowactions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* "…"-Menü je Zeile: Trigger-Button + Popover, rechtsbündig zur Zeile. */
.ttt-rowmenu {
    position: relative;
    display: inline-flex;
}

.ttt-rowmenu-trigger {
    padding: 7px 12px;
    font-weight: 700;
    letter-spacing: .04em;
}

/* Unsichtbarer Vollbild-Scrim NUR zum Schließen bei Klick außerhalb (kein JS-Interop). */
.ttt-rowmenu-scrim {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 45;
}

.ttt-rowmenu-pop {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 46;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-width: 210px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.ttt-rowmenu-pop .ttt-btn {
    width: 100%;
    justify-content: center;
}

/* Tabellen-Wrapper clippt sonst jedes Popover, das über den Rand hinausragt. */
.ttt-table-wrap:has(.ttt-rowmenu-pop) {
    overflow: visible;
}

/* Karte eines deaktivierten Mitarbeiters: sichtbar, aber zurückgenommen. */
.ttt-monthcard.inactive {
    background: var(--surface-2);
}

.ttt-monthcard.inactive .mname {
    color: var(--muted);
}

/* Wartungsblock (Neuberechnung der Jahreswerte) – gleiche Typografie wie die
   Schalter-Zeile darüber, nur ohne Schalter. */
.ttt-maint .t {
    display: block;
    font-weight: 600;
    color: var(--text);
}

.ttt-maint .s {
    display: block;
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
    max-width: 70ch;
}

/* ---------- Bearbeiten-Formular (Bottom-Sheet) ---------- */

/* Gruppen im Formular: Name/E-Mail, Vertrag, Jahreswerte. Jede Gruppe wird
   einzeln gespeichert, deshalb auch optisch als eigener Block. */
.ttt-editgroup {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: 4px;
    margin-bottom: 18px;
}

.ttt-editgroup-head {
    display: block;
    font-size: 11px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--accent-strong);
    font-weight: 700;
    margin-bottom: 12px;
}

.ttt-editgroup .ttt-hint {
    margin-bottom: 14px;
}

.ttt-editgroup .ttt-sheet-actions {
    margin-top: 12px;
}

/* ---------- Sperrseite für deaktivierte Mitarbeiter ---------- */

.ttt-locked {
    display: flex;
    justify-content: center;
    padding: 12px 0 40px;
}

.ttt-locked-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px 22px;
    max-width: 520px;
    text-align: center;
}

.ttt-locked-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--warn-soft);
    color: var(--warn);
}

.ttt-locked-card h1 {
    margin: 0 0 10px;
    font-size: 22px;
    letter-spacing: -.02em;
    font-weight: 700;
}

.ttt-locked-card p {
    margin: 0 0 10px;
    font-size: 14.5px;
    line-height: 1.5;
}

.ttt-locked-card p.sub {
    color: var(--muted);
    font-size: 13.5px;
    margin-bottom: 20px;
}

/* ---------- Desktop-Ergänzungen (ab 768px) ---------- */

@media (min-width: 768px) {
    /* Zeile eines deaktivierten Mitarbeiters in der Tabelle. */
    .ttt-table-wrap tbody tr.inactive td {
        background: var(--surface-2);
    }

    .ttt-table-wrap tbody tr.inactive td:first-child {
        box-shadow: inset 3px 0 0 var(--bad);
    }

    /* Das Bearbeiten-Formular trägt drei Gruppen – etwas mehr Breite als ein
       gewöhnliches Sheet, damit die Hinweistexte nicht zu Türmen werden. */
    .ttt-editsheet {
        max-width: 560px;
    }

    .ttt-locked {
        padding-top: 30px;
    }
}

/* ---------- Info-Sprechblase in Kacheln (InfoTip) ---------- */

/* Anker der Blase. inline-flex, damit das "i" auf der Grundlinie der
   Kachel-Beschriftung sitzt und nicht darüber hinausragt. */
.ttt-tip {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
    margin-left: 6px;
}

/* Kleiner als die ttt-infobtn der Formularfelder: in der Kachel steht das "i"
   neben einer Beschriftung, nicht neben einem Eingabefeld. */
.ttt-tipbtn {
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    font-style: italic;
    line-height: 1;
    cursor: help;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.ttt-tipbtn:hover,
.ttt-tipbtn:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
}

/* Die Blase selbst. visibility statt display, damit der Übergang greift und der
   Text für Screenreader über aria-describedby erreichbar bleibt. */
.ttt-tipbox {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    width: max-content;
    max-width: 240px;
    padding: 9px 11px;
    border-radius: 10px;
    background: var(--tip-bg, #13304e);
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    font-style: normal;
    line-height: 1.45;
    letter-spacing: normal;
    text-transform: none;
    text-align: left;
    white-space: normal;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s ease, visibility .12s ease;
    pointer-events: none;
}

.ttt-tipbox.wide {
    max-width: 300px;
}

/* Sprechblasen-Spitze. */
.ttt-tipbox::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--tip-bg, #13304e);
}

/* :focus-within deckt Touch und Tastatur ab – auf Touchgeräten gibt es kein
   Hover, ein Tippen setzt aber den Fokus auf den Button. */
.ttt-tip:hover .ttt-tipbox,
.ttt-tip:focus-within .ttt-tipbox {
    opacity: 1;
    visibility: visible;
}

/* Die äußeren Kacheln einer Reihe: Blase am Rand ausrichten, damit sie nicht
   aus dem Bild läuft. */
.ttt-tiles > .ttt-tile:first-child .ttt-tipbox {
    left: 0;
    transform: none;
}

.ttt-tiles > .ttt-tile:first-child .ttt-tipbox::after {
    left: 14px;
}

.ttt-tiles > .ttt-tile:last-child .ttt-tipbox {
    left: auto;
    right: 0;
    transform: none;
}

.ttt-tiles > .ttt-tile:last-child .ttt-tipbox::after {
    left: auto;
    right: 14px;
    transform: none;
}

/* Auf schmalen Geräten passt eine breite Blase nicht neben die Kachel –
   Breite an den Viewport binden. */
@media (max-width: 520px) {
    .ttt-tipbox,
    .ttt-tipbox.wide {
        max-width: min(260px, calc(100vw - 48px));
    }
}

/* ============================================================
   Versionsnummer (Startseite) + Changelog-Seite
   ============================================================ */

/* Kleine, dezente Versionszeile unter der Begrüßung; führt zum Changelog. */
.ttt-version {
    display: inline-block;
    margin-top: 6px;
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px dotted transparent;
}

.ttt-version:hover {
    color: var(--accent);
    border-bottom-color: currentColor;
}

/* Beta-Kennzeichnung (Dev-Tunnel): auffälliger als die Versionszahl selbst. */
.ttt-version.beta {
    color: var(--accent-strong);
    font-weight: 600;
}

/* Beta-Plakette neben der Changelog-Überschrift. */
.ttt-beta-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    vertical-align: middle;
    color: var(--accent-contrast);
    background: var(--accent);
}

/* Changelog: eine Karte je Version, neueste zuerst. */
.ttt-changelog {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ttt-release {
    padding: 16px 18px;
}

/* Der aktuelle Stand wird mit einem farbigen Streifen hervorgehoben. */
.ttt-release.current {
    border-left: 3px solid var(--accent);
}

.ttt-release-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.ttt-release-version {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent-strong);
}

.ttt-release-date {
    margin-left: auto;
    font-size: .8rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.ttt-release-list {
    margin: 0;
    padding-left: 20px;
}

.ttt-release-list li {
    margin: 4px 0;
    line-height: 1.45;
}

/* Klickbare Tabellenzeile (Admin-Auswertung: Tag bearbeiten). */
.ttt-rowlink {
    cursor: pointer;
}

.ttt-rowlink:hover {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* ============================================================
   Toast – Kurzmeldung, die den Inhalt nicht verschiebt
   ============================================================
   Ersetzt die frühere Erfolgsmeldung im Textfluss: die schob nach dem Speichern
   die ganze Tabelle um eine Zeilenhöhe nach unten, wodurch der Mauszeiger über
   einem anderen Tag landete. Fest positioniert löst das Problem an der Wurzel. */
.ttt-toast {
    position: fixed;
    /* Unter der 56px hohen, klebenden Topbar. */
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    /* Über Inhalt und mobiler Tab-Leiste (30), aber unter dem Dialog-Scrim (50). */
    z-index: 40;

    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(560px, calc(100vw - 24px));
    padding: 10px 12px 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.35;
    box-shadow: 0 10px 28px rgba(10, 20, 35, .22);
    animation: ttt-toast-in .16s ease-out;
}

.ttt-toast.success {
    background: var(--good-soft);
    color: var(--good);
    border: 1px solid color-mix(in srgb, var(--good) 30%, transparent);
}

.ttt-toast.error {
    background: var(--bad-soft);
    color: var(--bad);
    border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent);
}

.ttt-toast .txt {
    flex: 1 1 auto;
}

.ttt-toast .close {
    flex: 0 0 auto;
    background: none;
    border: 0;
    color: inherit;
    opacity: .65;
    font-size: 20px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
}

.ttt-toast .close:hover {
    opacity: 1;
}

@keyframes ttt-toast-in {
    from { opacity: 0; transform: translate(-50%, -6px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Wer Bewegung reduziert haben will, bekommt die Meldung ohne Einblendung. */
@media (prefers-reduced-motion: reduce) {
    .ttt-toast { animation: none; }
}

/* Sprachumschalter in der Kopfzeile. Zeigt die Sprache, in die er wechselt
   (steht die App auf Deutsch, steht "EN" darauf). */
.ttt-langswitch {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, .08);
    color: var(--brand-bar-text);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    cursor: pointer;
    min-height: 32px;
}

.ttt-langswitch:hover {
    background: rgba(255, 255, 255, .16);
}

/* Profilbild in der Kopfzeile. Gleiche Maße wie die Initialen-Kachel, damit die
   Kopfzeile beim Nachladen des Bildes nicht springt. */
.ttt-avatar-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex: none;
    object-fit: cover;
    background: rgba(255, 255, 255, .12);
}

/* ============================================================
   Mobile Feinschliff
   ============================================================ */

/* Nur am Desktop zeigen. Auf dem Handy sitzen Sprache und Abmelden im
   "Mehr"-Blatt – in der 56px hohen Kopfzeile ist neben Marke, Maskottchen
   und Konto sonst kein Platz. */
.ttt-only-desktop {
    display: none;
}

@media (min-width: 768px) {
    .ttt-only-desktop {
        display: inline-flex;
    }
}

/* Reiter-Beschriftungen dürfen nicht umbrechen – sonst wird die Leiste
   unterschiedlich hoch und springt. */
.ttt-tab {
    white-space: nowrap;
    overflow: hidden;
}

/* Der "Mehr"-Reiter ist ein <button> und erbt die Schrift nicht automatisch. */
.ttt-tab {
    font-family: inherit;
}

.ttt-tab.active {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ---------- "Mehr"-Blatt ---------- */

.ttt-morelist {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}

.ttt-morelink {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 12px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    /* Fingerfreundlich: dieselbe Mindesthöhe wie alle anderen Tippziele. */
    min-height: var(--tap);
}

.ttt-morelink:hover,
.ttt-morelink:focus-visible {
    background: var(--surface-2);
    color: var(--text);
}

.ttt-morelink .ico {
    width: 20px;
    height: 20px;
    flex: none;
    color: var(--muted);
}

/* Aktueller Wert rechtsbündig, z. B. die eingestellte Sprache. */
.ttt-morelink .val {
    margin-left: auto;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--muted);
}

.ttt-morelink.danger {
    color: var(--bad);
}

.ttt-morelink.danger .ico {
    color: var(--bad);
}

/* ---------- Sehr schmale Geräte ---------- */

@media (max-width: 380px) {
    /* Marke kürzen, damit Maskottchen und Konto nicht aus der Zeile fallen. */
    .ttt-brand {
        font-size: 15px;
    }

    .ttt-brandmark {
        height: 26px;
    }

    .ttt-mascot {
        height: 32px;
    }

    .ttt-tab {
        font-size: 10px;
        padding: 7px 2px;
    }

    /* Kacheln einspaltig statt zweispaltig – zwei nebeneinander lassen die
       Zahlen sonst umbrechen. */
    .ttt-tiles {
        grid-template-columns: 1fr;
    }
}
