:root {
    --surface-1: #fcfcfb;
    --page-plane: #f4f4f2;
    --text-primary: #0b0b0b;
    --text-secondary: #52514e;
    --text-muted: #898781;
    --gridline: #e1e0d9;
    --baseline: #c3c2b7;
    --border: rgba(11, 11, 11, 0.09);
    --series-1: #2a78d6;
    --series-1-dark: #184f95;
    --accent: var(--series-1);
    --accent-soft: color-mix(in srgb, var(--series-1) 12%, transparent);
    --accent-grad: linear-gradient(135deg, #3a86e0, #1c5cab);
    --good: #0ca30c;
    --good-text: #006300;
    --critical: #d03b3b;
    --warning: #e8b12b;
    --warning-text: #8a5f10;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --shadow-sm: 0 1px 2px rgba(11, 11, 11, 0.05), 0 1px 1px rgba(11, 11, 11, 0.04);
    --shadow-md: 0 2px 4px rgba(11, 11, 11, 0.05), 0 8px 16px -10px rgba(11, 11, 11, 0.16), 0 20px 38px -18px rgba(11, 11, 11, 0.26);
    --shadow-lg: 0 8px 20px -10px rgba(11, 11, 11, 0.22), 0 30px 70px -24px rgba(11, 11, 11, 0.38);
    --sidebar-w: 244px;

    /* Glasmorphismus: helle, transluzente Flächen mit Weichzeichner-Unterlage. */
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-bg-strong: rgba(255, 255, 255, 0.78);
    --glass-bg-dark: rgba(20, 20, 20, 0.55);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: blur(20px) saturate(180%);
    --glass-blur-sm: blur(10px) saturate(160%);
    /* Mehrschichtiger Schatten für spürbare 3D-Tiefe + heller "Kanten"-Highlight oben und
       ein feiner dunkler Rand unten (Glaskante mit Dicke). */
    --glass-shadow: 0 2px 4px rgba(11, 11, 11, 0.05), 0 10px 20px -12px rgba(11, 11, 11, 0.18),
        0 26px 48px -20px rgba(11, 11, 11, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.75),
        inset 0 -1px 0 rgba(11, 11, 11, 0.05);
    --glass-shadow-sm: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(11, 11, 11, 0.04);
    /* Angehobener Zustand (Hover) für interaktive Glasflächen - deutlich mehr Abstand/Tiefe. */
    --glass-shadow-float: 0 4px 8px rgba(11, 11, 11, 0.07), 0 18px 30px -14px rgba(11, 11, 11, 0.24),
        0 40px 70px -24px rgba(11, 11, 11, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(11, 11, 11, 0.05);
}

@media (prefers-color-scheme: dark) {
    :root {
        --surface-1: #1a1a19;
        --page-plane: #121211;
        --text-primary: #ffffff;
        --text-secondary: #c3c2b7;
        --text-muted: #8f8d87;
        --gridline: #2c2c2a;
        --baseline: #383835;
        --border: rgba(255, 255, 255, 0.09);
        --series-1: #3987e5;
        --series-1-dark: #184f95;
        --accent-grad: linear-gradient(135deg, #4a93ea, #1e5fb0);
        --good: #0ca30c;
        --good-text: #2fd12f;
        --critical: #e66767;
        --warning: #e8b12b;
        --warning-text: #f0c34d;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(0, 0, 0, 0.25);
        --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.35), 0 8px 18px -10px rgba(0, 0, 0, 0.5), 0 22px 42px -18px rgba(0, 0, 0, 0.6);
        --shadow-lg: 0 10px 24px -10px rgba(0, 0, 0, 0.55), 0 34px 76px -24px rgba(0, 0, 0, 0.75);

        --glass-bg: rgba(28, 28, 27, 0.55);
        --glass-bg-strong: rgba(28, 28, 27, 0.8);
        --glass-border: rgba(255, 255, 255, 0.09);
        --glass-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 10px 22px -12px rgba(0, 0, 0, 0.5),
            0 28px 52px -20px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.07),
            inset 0 -1px 0 rgba(0, 0, 0, 0.3);
        --glass-shadow-sm: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -1px 0 rgba(0, 0, 0, 0.25);
        --glass-shadow-float: 0 4px 8px rgba(0, 0, 0, 0.4), 0 20px 34px -14px rgba(0, 0, 0, 0.55),
            0 44px 80px -24px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.09),
            inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    }
}

* { box-sizing: border-box; }

html { background: var(--page-plane); }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--page-plane);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    position: relative;
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    top: -220px;
    right: -160px;
    width: 780px;
    height: 780px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--series-1) 38%, transparent), transparent 70%);
    filter: blur(10px);
    pointer-events: none;
    z-index: 0;
}

/* Zweiter Farbfleck unten links, damit die Glasflächen auch abseits der oberen rechten
   Ecke etwas zum "Durchscheinen" haben - dieselbe Technik, dieselben Bestandsfarben. Beide
   Flecken reichen bewusst bis in die Bildschirmmitte hinein, damit auch die Karten im
   Content-Bereich (nicht nur die äußeren Ränder) den Weichzeichner-Effekt zeigen. */
body::after {
    content: "";
    position: fixed;
    bottom: -260px;
    left: -180px;
    width: 820px;
    height: 820px;
    border-radius: 50%;
    background: radial-gradient(circle at 60% 60%, color-mix(in srgb, var(--good) 30%, transparent), transparent 70%);
    filter: blur(10px);
    pointer-events: none;
    z-index: 0;
}

a { color: var(--accent); }

.icon { display: inline-block; vertical-align: -3px; flex-shrink: 0; }

/* ============ App shell / sidebar ============ */

.app-shell {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 1rem;
    background: var(--surface-1);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.4rem;
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--accent-grad);
    color: #fff;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link svg { color: var(--text-muted); transition: color 0.15s ease; }

.nav-link:hover { background: var(--page-plane); color: var(--text-primary); }
.nav-link:hover svg { color: var(--text-primary); }

.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.nav-link.active svg { color: var(--accent); }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.3rem 0.75rem 0.6rem;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-grad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-form { margin: 0; }
.logout-btn:hover { background: color-mix(in srgb, var(--critical) 10%, transparent); color: var(--critical); }
.logout-btn:hover svg { color: var(--critical); }

.app-main {
    flex: 1;
    min-width: 0;
}

.mobile-topbar, .mobile-nav { display: none; }

.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 2rem 2rem 3rem;
    position: relative;
    z-index: 1;
}

.page-auth { max-width: none; padding: 0; }

@media (max-width: 900px) {
    .sidebar { display: none; }

    .mobile-topbar {
        display: flex;
        align-items: center;
        padding: 0.9rem 1.1rem;
        background: var(--surface-1);
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 5;
    }

    .mobile-nav {
        display: flex;
        gap: 0.3rem;
        overflow-x: auto;
        padding: 0.6rem 1rem;
        background: var(--surface-1);
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 57px;
        z-index: 5;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-nav-link {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        padding: 0.45rem 0.75rem;
        border-radius: 999px;
        white-space: nowrap;
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 0.82rem;
        font-weight: 600;
        background: var(--page-plane);
        border: 1px solid var(--border);
    }

    .mobile-nav-link.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

    .page { padding: 1.25rem 1.1rem 2.5rem; }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

h1 { font-size: 1.5rem; margin: 0; letter-spacing: -0.015em; }
h2 { font-size: 1.05rem; margin: 0 0 1rem; letter-spacing: -0.01em; }

.card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.6rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    min-height: 40px;
}

.card-header-row h2 {
    margin-bottom: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

@media (max-width: 780px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ============ Seiten-Widgets (Dashboard): Ampel + Mini-Kalender ============ */
/* Sitzen im freien Bereich links neben der Karte, in der Lücke zwischen Sidebar und
   Seiteninhalt. Brauchen genug Platz dafür, daher erst ab recht breiten Fenstern sichtbar. */

.dashboard-side-widgets {
    display: none;
    position: absolute;
    right: calc(100% + 20px);
    top: 90px;
    flex-direction: column;
    gap: 16px;
    width: 230px;
    z-index: 2;
}

@media (min-width: 901px) {
    .dashboard-page-header { margin-left: -2rem; }
}

/* Die Lücke zwischen Sidebar und der auf max-width:1080px zentrierten Seite ist erst ab
   ca. 1900px Fensterbreite zuverlässig breit genug für das 230px-Widget, ohne die Sidebar
   zu überlappen (Sidebar-Breite + Seiten-Padding + Auto-Margin der zentrierten Seite).
   Unterhalb dessen bleibt es unsichtbar (display:none per Default oben), statt überlappend
   angezeigt zu werden. */
@media (min-width: 1900px) {
    .dashboard-side-widgets { display: flex; }
}

.ampel-widget {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #232323;
    border: 1px solid #000;
    border-radius: 26px;
    padding: 16px 20px;
    box-shadow: var(--shadow-md);
}

.ampel-light {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #111;
    border: 1px solid #000;
    opacity: 0.35;
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
}

.ampel-light-red.on { background: var(--critical); opacity: 1; box-shadow: 0 0 22px 3px color-mix(in srgb, var(--critical) 80%, transparent); }
.ampel-light-yellow.on { background: #e8b12b; opacity: 1; box-shadow: 0 0 22px 3px rgba(232, 177, 43, 0.75); }
.ampel-light-green.on { background: var(--good); opacity: 1; box-shadow: 0 0 22px 3px color-mix(in srgb, var(--good) 80%, transparent); }

.dashboard-mini-calendar {
    background: #232323;
    border: 1px solid #000;
    border-radius: 20px;
    padding: 16px;
    box-shadow: var(--shadow-md);
}

.dashboard-mini-calendar h3 {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: #fff;
}

.dashboard-mini-calendar .month-target-weekdays span {
    font-size: 0.6rem;
    color: #a3a19c;
}

.dashboard-mini-calendar .month-target-days {
    gap: 3px;
}

.dashboard-side-widgets .dashboard-mini-calendar .cal-day {
    font-size: 0.62rem;
    border-radius: 5px;
    background: #333331;
    color: #d8d6d1;
}

.dashboard-side-widgets .dashboard-mini-calendar .cal-day.is-weekend {
    color: #7d7b76;
}

.dashboard-mini-calendar .calendar-legend {
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.66rem;
    color: #b7b5b0;
    margin: 0.75rem 0 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.1rem;
}

.stat-tile {
    background: var(--page-plane);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    container-type: inline-size;
    min-width: 0;
}

.stat-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

@container (max-width: 180px) {
    .stat-value { font-size: 1.15rem; }
}

@container (max-width: 145px) {
    .stat-value { font-size: 1rem; }
}

@container (max-width: 125px) {
    .stat-value { font-size: 0.88rem; }
}

.stat-tile-wide { grid-column: 1 / -1; }

.stat-tile.positive { background: color-mix(in srgb, var(--good) 8%, var(--page-plane)); border-color: color-mix(in srgb, var(--good) 30%, var(--border)); }
.stat-tile.positive .stat-value, .stat-tile.positive .stat-label { color: var(--good-text); }
.stat-tile.negative { background: color-mix(in srgb, var(--critical) 8%, var(--page-plane)); border-color: color-mix(in srgb, var(--critical) 30%, var(--border)); }
.stat-tile.negative .stat-value, .stat-tile.negative .stat-label { color: var(--critical); }

.chart-wrapper {
    position: relative;
    height: 260px;
}

/* ============ Analoge Uhr (Dashboard, "läuft…") ============ */

.clock-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: 0.5rem 0 1.1rem;
    flex-wrap: wrap;
}

.analog-clock-wrapper {
    display: flex;
    justify-content: center;
}

.clock-legend {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.clock-legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.clock-legend-swatch {
    width: 14px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.clock-legend-swatch-punch {
    background: var(--series-1);
}

.clock-legend-swatch-workday {
    background: var(--good);
}

.clock-legend-swatch-break {
    background: var(--text-muted);
}

.analog-clock {
    width: 168px;
    height: 168px;
}

.clock-face {
    fill: var(--surface-1);
    stroke: var(--border);
    stroke-width: 1;
}

.clock-ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 9;
}

.clock-ring-progress {
    fill: none;
    stroke: var(--good);
    stroke-width: 9;
    stroke-linecap: round;
}

.clock-break-arc {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 11;
    stroke-linecap: round;
    opacity: 0.85;
}

.clock-number {
    font-size: 12px;
    font-weight: 600;
    fill: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.clock-hand {
    stroke: var(--text-primary);
    stroke-linecap: round;
}

.clock-hand-hour {
    stroke-width: 4;
}

.clock-hand-minute {
    stroke-width: 2.5;
}

.clock-hand-second {
    stroke: var(--critical);
    stroke-width: 1.25;
    animation: clock-second-tick 60s linear infinite;
}

@keyframes clock-second-tick {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .clock-hand-second {
        animation: none;
    }
}

.clock-center-dot {
    fill: var(--text-primary);
}

.clock-tick {
    stroke-width: 3;
    stroke-linecap: round;
}

.clock-tick-punch {
    stroke: var(--series-1);
}

.clock-tick-workday {
    stroke: var(--good);
}

.badge {
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.tag {
    display: inline-block;
    font-size: 0.68rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ============ Forms ============ */

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.83rem;
    color: var(--text-secondary);
    font-weight: 500;
    flex: 1;
}

.checkbox-label {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
}

input[type="text"], input[type="date"], input[type="time"], input[type="number"], input[type="password"] {
    font: inherit;
    color: var(--text-primary);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.time-input, .date-input, .duration-input {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.form-row[hidden] {
    display: none;
}

.entry-form label { margin-bottom: 0; }
.entry-form > label { margin-bottom: 1rem; }

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.85rem;
}

.early-start-hint {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
}

.early-start-hint svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.stale-entry-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--warning-text);
    background: color-mix(in srgb, var(--warning) 14%, var(--surface-1));
    border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
}

.stale-entry-hint svg {
    color: var(--warning-text);
    flex-shrink: 0;
}

.stale-entry-hint a {
    color: inherit;
    text-decoration: underline;
}

.target-reached-hint {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--good-text);
    background: color-mix(in srgb, var(--good) 14%, var(--surface-1));
    border: 1px solid color-mix(in srgb, var(--good) 40%, transparent);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.1rem;
    font-weight: 600;
    font-size: 1.05rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.target-reached-hint svg {
    color: var(--good-text);
    flex-shrink: 0;
}

.lunch-break-hint {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--series-1) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--series-1) 55%, transparent);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 1.05rem;
    box-shadow: 0 0 18px 2px color-mix(in srgb, var(--series-1) 55%, transparent);
    animation: lunch-glow-pulse 2.2s ease-in-out infinite;
}

.lunch-break-hint svg {
    color: var(--series-1);
    flex-shrink: 0;
}

@keyframes lunch-glow-pulse {
    0%, 100% {
        box-shadow: 0 0 14px 1px color-mix(in srgb, var(--series-1) 45%, transparent);
    }
    50% {
        box-shadow: 0 0 26px 5px color-mix(in srgb, var(--series-1) 75%, transparent);
    }
}

@media (prefers-reduced-motion: reduce) {
    .lunch-break-hint {
        animation: none;
    }
}

.page-punch .hint {
    margin: 0.3rem 0 0.4rem;
    font-size: 0.72rem;
    line-height: 1.3;
}

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

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* ============ Buttons ============ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.15rem;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, filter 0.12s ease;
}

.btn-primary {
    background: var(--accent-grad);
    color: #ffffff;
    box-shadow: var(--shadow-sm), 0 8px 20px -10px color-mix(in srgb, var(--series-1) 65%, transparent);
}

.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); filter: brightness(0.98); }

.btn-ghost {
    background: var(--surface-1);
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-ghost:hover { background: var(--page-plane); }

.btn-icon { padding: 0.55rem 0.65rem; }
.btn-block { width: 100%; }

.day-type-form { margin-top: 0.75rem; }

.link-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
}

.link-button.danger { color: var(--critical); }

.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
}

.icon-action:hover { background: var(--page-plane); color: var(--text-primary); }
.icon-action.danger:hover { background: color-mix(in srgb, var(--critical) 12%, transparent); color: var(--critical); }

.segmented {
    display: inline-flex;
    background: var(--page-plane);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}

.segmented a {
    padding: 0.45rem 0.95rem;
    border-radius: 7px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.segmented a:hover { color: var(--text-primary); }

.segmented a.active {
    background: var(--surface-1);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ============ Table ============ */

.table-wrapper { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.89rem;
}

.data-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--gridline);
    padding: 0.5rem 0.6rem;
}

.data-table td {
    padding: 0.65rem 0.6rem;
    border-bottom: 1px solid var(--gridline);
    font-variant-numeric: tabular-nums;
}

.data-table tbody tr { transition: background 0.12s ease; }
.data-table tbody tr:hover { background: var(--page-plane); }

.row-actions {
    display: flex;
    gap: 0.25rem;
    white-space: nowrap;
}

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

/* ============ Alerts ============ */

.alert {
    border-radius: var(--radius);
    padding: 0.7rem 1rem;
    margin-bottom: 1.1rem;
    font-size: 0.87rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: color-mix(in srgb, var(--good) 12%, var(--surface-1));
    color: var(--good-text);
    border: 1px solid color-mix(in srgb, var(--good) 35%, transparent);
}

.alert-error {
    background: color-mix(in srgb, var(--critical) 12%, var(--surface-1));
    color: var(--critical);
    border: 1px solid color-mix(in srgb, var(--critical) 35%, transparent);
}

/* ============ Auth pages ============ */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    position: relative;
    z-index: 1;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface-1);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.auth-banner {
    background: var(--accent-grad);
    color: #ffffff;
    padding: 2.1rem 1.75rem 1.6rem;
    text-align: center;
}

.auth-banner-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.16);
    margin-bottom: 0.85rem;
}

.auth-banner h1 { font-size: 1.25rem; margin: 0 0 0.35rem; color: #ffffff; }
.auth-banner p { margin: 0; font-size: 0.85rem; opacity: 0.85; }

.auth-body { padding: 1.75rem; }
.auth-body form { display: flex; flex-direction: column; gap: 1rem; }

/* ============ Period nav ============ */

.month-nav, .report-nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.report-nav {
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

/* ============ Jahreskalender (Urlaub) ============ */

.year-calendar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .year-calendar { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .year-calendar { grid-template-columns: 1fr; }
}

.year-calendar-month {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
}

.year-calendar-month h3 {
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
}

.year-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 0.3rem;
}

.year-calendar-weekdays span {
    text-align: center;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
}

.year-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-day {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 6px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.cal-day:hover {
    background: var(--accent-soft);
}

.cal-day-empty {
    visibility: hidden;
}

.cal-day.is-weekend {
    color: var(--text-muted);
}

.cal-day.is-today {
    box-shadow: inset 0 0 0 1.5px var(--accent);
    font-weight: 700;
}

.cal-day.is-selected {
    box-shadow: inset 0 0 0 1.5px var(--text-primary);
}

.cal-day.cal-day-vacation {
    background: var(--good);
    color: #fff;
}

.cal-day.cal-day-vacation-hours {
    background: color-mix(in srgb, var(--good) 45%, transparent);
    color: var(--text-primary);
}

.cal-day.cal-day-comp-day {
    background: color-mix(in srgb, var(--series-1) 35%, transparent);
    color: var(--text-primary);
}

.cal-day.cal-day-work {
    background: var(--border);
}

.cal-day.cal-day-holiday {
    background: rgba(100, 181, 246, 0.35);
    color: var(--text-primary);
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.cal-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
}

.cal-legend-swatch.cal-day-vacation { background: var(--good); }
.cal-legend-swatch.cal-day-vacation-hours { background: color-mix(in srgb, var(--good) 45%, transparent); }
.cal-legend-swatch.cal-day-work { background: var(--border); }
.cal-legend-swatch.cal-day-comp-day { background: color-mix(in srgb, var(--series-1) 35%, transparent); }
.cal-legend-swatch.cal-day-holiday { background: rgba(100, 181, 246, 0.35); }

.vacation-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 40;
    cursor: default;
}

.vacation-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 41;
    width: min(440px, calc(100vw - 2.5rem));
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    margin-bottom: 0;
}

.vacation-modal .card-header-row {
    align-items: flex-start;
    gap: 0.75rem;
}

.vacation-modal-close {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

/* ============ Dashboard: Monats-Zielerreichung ============ */

.month-target-calendar {
    margin-bottom: 1rem;
}

.month-target-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 0.4rem;
}

.month-target-weekdays span {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.month-target-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.month-target-days .cal-day {
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    background: var(--border);
    color: var(--text-secondary);
}

.month-target-days .cal-day.month-target-day-reached {
    background: var(--good);
    color: #fff;
}

.month-target-days .cal-day.month-target-day-missed {
    background: var(--critical);
    color: #fff;
}

.month-target-days .cal-day.month-target-day-special {
    background: color-mix(in srgb, var(--series-1) 35%, transparent);
    color: var(--text-primary);
}

.month-target-days .cal-day.month-target-day-open {
    box-shadow: inset 0 0 0 1.5px var(--accent);
}

.month-target-days .cal-day.month-target-day-holiday {
    background: rgba(100, 181, 246, 0.35);
    color: var(--text-primary);
}

.cal-legend-swatch.month-target-day-reached {
    background: var(--good);
}

.cal-legend-swatch.month-target-day-missed {
    background: var(--critical);
}

.cal-legend-swatch.month-target-day-special {
    background: color-mix(in srgb, var(--series-1) 35%, transparent);
}

.cal-legend-swatch.month-target-day-holiday {
    background: rgba(100, 181, 246, 0.35);
}

/* ============ Punch page (Schnellerfassung) ============ */
/* Mobil: randlos über die volle Höhe, kein Menü (siehe $hideMobileChrome).
   Auch auf Desktop keine Sidebar – die Seite nimmt die volle Fensterbreite ein und
   zentriert ihren Inhalt darin (siehe .page-punch), statt im Menü-Layout zu sitzen. */

body.page-punch .sidebar {
    display: none;
}

@media (max-width: 899px) {
    /* Scrollen auf Mobile hart unterbinden statt nur auf exakte Passgenauigkeit zu hoffen:
       html UND body, da iOS Safari je nach Zustand mal das eine, mal das andere scrollt. */
    html.page-punch,
    body.page-punch {
        overflow: hidden;
        height: 100vh;
        height: 100dvh;
    }
}

.page-punch {
    max-width: none;
    padding: 0;
}

@media (min-width: 900px) {
    .page-punch {
        max-width: 1080px;
        min-height: 100vh;
        padding: 2rem 2rem 3rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .page-punch .alert {
        width: 100%;
        max-width: 420px;
    }
}

.punch-page {
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding: max(1.1rem, env(safe-area-inset-top) + 0.4rem) 1.25rem max(1.5rem, env(safe-area-inset-bottom));
}

@media (min-width: 900px) {
    .punch-page {
        min-height: auto;
        width: 100%;
        background: var(--surface-1);
        border: 1px solid var(--border);
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-md);
        padding: 1.5rem 1.75rem 1.75rem;
    }

    .punch-hint {
        margin-top: 1.5rem;
    }
}

.punch-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.15rem 0 0.7rem;
    position: relative;
    z-index: 2;
}

.punch-back {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.75rem 0.75rem 0.75rem 0;
    margin: -0.75rem 0 -0.75rem -0.25rem;
}

.punch-top-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
}

.punch-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.punch-heading {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 0 0 0.9rem;
    color: var(--text-primary);
}

.punch-live-clock {
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.punch-status {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 0.9rem 1.1rem;
    margin-bottom: 1.1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.punch-remove-special-form {
    margin: 0 0 1.1rem;
}

.punch-status-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 500;
}

.punch-status-value {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.punch-status-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.punch-pulse {
    color: var(--good-text);
    font-weight: 600;
    animation: punch-pulse 1.6s ease-in-out infinite;
}

@keyframes punch-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.punch-form {
    margin: 0 0 0.9rem;
}

.punch-custom-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 500;
}

.punch-custom-toggle input[type="checkbox"]:disabled {
    opacity: 0.4;
}

.time-select-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 0.55rem;
}

.time-select-row[hidden] {
    display: none;
}

.time-select {
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--text-primary);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.5rem;
}

.time-select:disabled {
    opacity: 0.4;
}

.time-select-sep {
    color: var(--text-muted);
    font-weight: 600;
}

.punch-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 1.05rem 1rem;
    border-radius: var(--radius-xl);
    border: none;
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.punch-btn:active {
    transform: scale(0.98);
}

.punch-btn-start {
    background: var(--accent-grad);
    color: #ffffff;
    box-shadow: var(--shadow-sm), 0 10px 24px -10px color-mix(in srgb, var(--series-1) 65%, transparent);
}

.punch-btn-end {
    background: var(--text-primary);
    color: var(--surface-1);
    box-shadow: var(--shadow-sm);
}

.punch-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.punch-hint {
    margin-top: 1.2rem;
    text-align: center;
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.punch-hint a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

/* ============ Glasmorphismus-Überzug ============
   Statt jede Fläche einzeln umzuschreiben, überschreibt dieser Block am Ende der Datei
   (gleiche Spezifität, spätere Reihenfolge gewinnt) Hintergrund/Rahmen/Schatten der
   bestehenden Flächen mit einer transluzenten, weichgezeichneten Variante. Akzent- und
   Textfarben bleiben unverändert - nur die Flächen selbst wirken jetzt wie Glas. */

.sidebar,
.mobile-topbar,
.mobile-nav,
.card,
.auth-card,
.year-calendar-month,
.btn-ghost {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.card,
.auth-card {
    box-shadow: var(--glass-shadow);
}

.sidebar {
    box-shadow: var(--shadow-sm), var(--glass-shadow-sm);
}

.btn-ghost:hover {
    background: var(--glass-bg-strong);
}

@media (min-width: 900px) {
    .punch-page {
        background: var(--glass-bg);
        border-color: var(--glass-border);
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
        box-shadow: var(--glass-shadow);
    }
}

/* Innenliegende Flächen (Statuskacheln, Punch-Status): etwas dichteres Glas, damit sie
   sich weiterhin von der Karte darunter abheben. */
.stat-tile,
.punch-status {
    background: var(--glass-bg-strong);
    border-color: var(--glass-border);
    backdrop-filter: var(--glass-blur-sm);
    -webkit-backdrop-filter: var(--glass-blur-sm);
}

.punch-status {
    box-shadow: var(--glass-shadow);
}

/* Ampel + Mini-Kalender: bleiben bewusst dunkel (wie ein reales Gerät), bekommen aber
   ebenfalls Transluzenz + Weichzeichner statt eines vollständig blickdichten Hintergrunds. */
.ampel-widget,
.dashboard-mini-calendar {
    background: var(--glass-bg-dark);
    border-color: rgba(255, 255, 255, 0.08);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

/* Modal: Hintergrund-Abdunkelung bekommt zusätzlich einen Weichzeichner, damit die
   Karte darüber wie eine Glasscheibe über der unscharfen Seite wirkt. */
.vacation-modal-backdrop {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ============ 3D-Tiefe ============
   Baut auf dem Glas-Überzug oben auf: mehrschichtige Schatten (schon in --glass-shadow /
   --shadow-md hinterlegt) plus spürbares Anheben beim Hover, glänzende Bevel-Kanten an
   Icon-Badges/Buttons und ein "eingelassenes" Lämpchen-Design für die Ampel. Gilt seiten-
   übergreifend, da alle Seiten dieselben Karten-/Button-/Badge-Klassen nutzen. */

/* Icon-Badges (Logo, Avatar): glänzendes, gewölbtes Abzeichen statt flacher Fläche. */
.brand-mark,
.avatar {
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -3px 6px rgba(11, 11, 11, 0.18);
}

/* Buttons: oben ein heller Glanzrand, beim Drücken sinkt die Fläche sichtbar ein. */
.btn-primary {
    box-shadow: var(--shadow-sm), 0 10px 22px -10px color-mix(in srgb, var(--series-1) 65%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, filter 0.12s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 14px 28px -10px color-mix(in srgb, var(--series-1) 70%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 5px rgba(11, 11, 11, 0.3);
}

.btn-ghost {
    box-shadow: var(--shadow-sm), var(--glass-shadow-sm);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn-ghost:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--glass-shadow-sm);
}

.btn-ghost:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(11, 11, 11, 0.15);
}

/* :not(:active) verhindert, dass dieser später in der Datei stehende Hover-Lift beim
   tatsächlichen Klick (Hover + Active gleichzeitig) die bestehende Drück-Animation
   (transform: scale(0.98)) der Buttons überschreibt. */
.punch-btn:hover:not(:active) {
    transform: translateY(-2px);
}

/* Ampel: aus (dunkel) wirkt eingelassen (konkav), an (leuchtend) wirkt wie eine gewölbte
   Glühbirne (konvex) statt einer flachen, eingefärbten Kreisfläche. */
.ampel-light {
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.7), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}

.ampel-light-red.on {
    background: radial-gradient(circle at 35% 30%, #ff8a7a, var(--critical) 55%, #8a2323 100%);
    box-shadow: 0 0 22px 3px color-mix(in srgb, var(--critical) 80%, transparent),
        inset 0 -3px 5px rgba(0, 0, 0, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.5);
}

.ampel-light-yellow.on {
    background: radial-gradient(circle at 35% 30%, #ffe08a, #e8b12b 55%, #8a5f10 100%);
    box-shadow: 0 0 22px 3px rgba(232, 177, 43, 0.75), inset 0 -3px 5px rgba(0, 0, 0, 0.3),
        inset 0 2px 3px rgba(255, 255, 255, 0.5);
}

.ampel-light-green.on {
    background: radial-gradient(circle at 35% 30%, #8bf08b, var(--good) 55%, #0a4d0a 100%);
    box-shadow: 0 0 22px 3px color-mix(in srgb, var(--good) 80%, transparent),
        inset 0 -3px 5px rgba(0, 0, 0, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.5);
}

.ampel-widget {
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -6px 14px rgba(0, 0, 0, 0.4);
}

.dashboard-mini-calendar {
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

@media (prefers-reduced-motion: reduce) {
    .btn-primary,
    .btn-ghost,
    .punch-btn {
        transition: none;
    }

    .btn-primary:hover,
    .btn-ghost:hover,
    .punch-btn:hover:not(:active) {
        transform: none;
    }
}
