/*
 * Mindset Timesheet clean CSS
 * Stand: 0.2.x
 * Ziel: MindWatch-nahe Optik, saubere Sidebar, kompakte Monatsmatrix.
 */

:root {
    --bg: #f6f8f9;
    --surface: #ffffff;
    --surface-soft: #fbfdfe;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;

    --primary: #8EB52A;
    --primary-strong: #7AA020;
    --primary-soft: #f4f9ea;

    --danger: #b00020;
    --danger-soft: #fff2f2;
    --danger-line: #ffb3b3;
    --success: #166534;
    --success-soft: #f0fdf4;
    --success-line: #bbf7d0;

    --brand-dark: #0f3b44;
    --brand-dark-2: #0b3038;
    --brand-text-soft: #cfe5ea;

    --shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    --sidebar-width: 230px;
    --sidebar-collapsed-width: 64px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

button,
input,
select,
textarea {
    font: inherit;
}

/* ---------- App layout ---------- */

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
    transition: grid-template-columns .18s ease;
}

.app-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

.content {
    min-width: 0;
    padding: 24px;
    background: var(--bg);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    margin: 0;
    font-size: 1.7rem;
    line-height: 1.15;
}

.page-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

.user-panel,
.actions,
.table-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.actions {
    margin-top: 18px;
}

/* ---------- Sidebar ---------- */

.sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    overflow: hidden;
    padding: 22px 18px;
    background: var(--brand-dark);
    color: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 6px 0 18px rgba(0, 0, 0, 0.08);
    transition: padding .18s ease;
}

.brand,
.brand-with-logo {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .45rem;
    padding: .2rem 2.5rem 1.2rem 0;
    margin-bottom: 1.6rem;
    letter-spacing: .2px;
    text-align: left;
}

.sidebar .brand-logo {
    width: 175px !important;
    max-width: 100%;
    max-height: none !important;
    height: auto !important;
    display: block;
}

.brand-title-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.brand-name {
    font-size: 1.12rem;
    font-weight: 850;
    line-height: 1.1;
    color: #ffffff;
    white-space: nowrap;
}

.brand-subline {
    display: block;
    margin-top: 3px;
    color: var(--brand-text-soft);
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.15;
    opacity: .9;
}

.sidebar-toggle {
    position: absolute;
    top: .15rem;
    right: .1rem;
    width: 30px;
    height: 30px;
    margin: 0;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 900;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}

.sidebar-toggle:hover {
    background: rgba(142, 181, 42, 0.24);
    border-color: rgba(142, 181, 42, 0.48);
    transform: translateY(-1px);
}

.nav-section {
    margin-bottom: 20px;
}

.nav-label,
.sidebar-user-label,
.sidebar-user-role {
    color: var(--brand-text-soft);
}

.nav-label,
.sidebar-user-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.nav-label {
    margin-bottom: 10px;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-list li + li {
    margin-top: 8px;
}

.nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    color: #ffffff;
    border: 1px solid transparent;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(142, 181, 42, 0.18);
    border-color: rgba(142, 181, 42, 0.40);
    transform: translateY(-1px);
}

.sidebar-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    padding-top: 18px;
    margin-top: 24px;
}

.sidebar-user-name {
    margin-top: 8px;
    font-size: 1rem;
    font-weight: 800;
}

.sidebar-user-role {
    margin-top: 4px;
    font-size: .85rem;
}

.sidebar-actions {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.full-width-form,
.btn-block {
    width: 100%;
}

/* Collapsed sidebar */

.sidebar.collapsed {
    padding: 18px 10px;
}

.sidebar.collapsed .brand,
.sidebar.collapsed .brand-with-logo {
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: 0;
    margin-bottom: 18px;
}

.sidebar.collapsed .brand-logo {
    width: 36px !important;
}

.sidebar.collapsed .brand-title-wrap,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-footer {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    position: static;
    width: 32px;
    height: 32px;
    margin: .1rem auto 0;
    background: rgba(142, 181, 42, 0.20);
}

/* ---------- Cards, grids, stats ---------- */

.card,
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.card {
    padding: 20px;
    margin-bottom: 20px;
}

.card-narrow {
    max-width: 760px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.card-title {
    margin: 0;
    font-size: 1.05rem;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.single-column {
    grid-template-columns: 1fr;
}

.stat {
    padding: 18px;
}

.stat-label,
.detail-label,
.small-text {
    color: var(--muted);
    font-size: .85rem;
}

.stat-value {
    margin-top: 6px;
    color: var(--brand-dark);
    font-size: 1.8rem;
    font-weight: 800;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.detail-item {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: var(--surface-soft);
}

.detail-label {
    margin-bottom: 6px;
}

.detail-value {
    font-weight: 700;
}

/* ---------- Forms ---------- */

.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-row-full {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

.inline-label {
    margin: 0;
    font-weight: 500;
}

.input,
.select,
.textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
}

.time-range {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.readonly-box {
    min-height: 42px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    border-radius: 10px;
    padding: 10px 12px;
}

/* ---------- Buttons, badges, flash ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 10px 14px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
    transition: .15s transform ease, .15s background-color ease, .15s border-color ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #111827;
}

.btn-primary:hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
    color: #ffffff;
}

.btn-secondary {
    background: #ffffff;
    color: var(--brand-dark);
    border-color: var(--line);
}

.btn-danger {
    background: var(--danger-soft);
    border-color: var(--danger-line);
    color: var(--danger);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 800;
}

.badge-success {
    background: #dcfce7;
    color: var(--success);
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger);
}

.flash {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.flash-success {
    border-color: var(--success-line);
    background: var(--success-soft);
    color: var(--success);
}

.flash-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: var(--danger);
}

/* ---------- Standard tables ---------- */

.table-wrap {
    overflow: auto;
}

.table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.table th,
.table td {
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.table thead th {
    background: var(--surface-soft);
    font-size: .85rem;
}

/* ---------- Timesheet matrix ---------- */

.month-nav {
    margin-top: 0;
}

.timesheet-table {
    width: 100%;
    min-width: 1420px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

.timesheet-table th,
.timesheet-table td {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-top: 0;
    border-left: 0;
    padding: 4px 3px;
    text-align: center;
    vertical-align: middle;
}

.timesheet-table thead th {
    background: #eef1f5;
    color: var(--brand-dark);
    font-weight: 850;
}

.timesheet-table tfoot td {
    background: var(--primary-soft);
    color: var(--brand-dark);
    font-weight: 850;
}

.timesheet-table th:first-child,
.timesheet-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    background: #ffffff;
    text-align: left;
    box-shadow: 2px 0 0 rgba(15, 59, 68, 0.05);
}

.timesheet-table tfoot td:first-child {
    background: var(--primary-soft);
}

.timesheet-table thead th:first-child {
    z-index: 8;
}

.timesheet-table thead th:last-child {
    z-index: 60 !important;
    background: var(--brand-dark) !important;
    font-size: .82rem;
    letter-spacing: .02em;
}

.timesheet-table tfoot td:last-child {
    z-index: 7;
    background: var(--primary-soft);
}

/* Projektcode in der Monatsmatrix ausblenden, spart Zeilenhöhe. */
.timesheet-table tbody td:first-child .small-text,
.timesheet-table tbody td:first-child .project-code,
.timesheet-table tbody td:first-child .project-key,
.timesheet-table tbody td:first-child .project-number {
    display: none !important;
}

.timesheet-table tbody td:first-child {
    line-height: 1.15;
}

.timesheet-table tbody td:first-child strong,
.timesheet-table tbody td:first-child b {
    display: block;
    margin-top: 1px;
    line-height: 1.15;
}


.timesheet-table th:last-child,
.timesheet-table td:last-child {
    position: sticky;
    right: 0;
    z-index: 4;
    width: 82px;
    min-width: 82px;
    max-width: 82px;
    background: #ffffff;
    box-shadow: -2px 0 0 rgba(15, 59, 68, 0.05);
}

.timesheet-table thead th:not(:first-child):not(:last-child),
.timesheet-table tbody td:not(:first-child):not(:last-child),
.timesheet-table tfoot td:not(:first-child):not(:last-child) {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
}

.timesheet-cell-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 31px;
    padding: 3px 2px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: #ffffff;
    color: var(--text);
}

.timesheet-cell-link:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.timesheet-empty {
    color: #94a3b8;
}

.cell-hours {
    display: block;
    line-height: 1.1;
    white-space: nowrap;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.cell-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 15px;
    height: 13px;
    padding: 0 4px;
    margin-top: 1px;
    border-radius: 999px;
    background: var(--primary-soft);
    border: 1px solid rgba(142, 181, 42, 0.35);
    color: var(--brand-dark);
    font-size: .56rem;
    font-weight: 850;
    line-height: 13px;
}

.day-number,
.day-label {
    display: block;
    text-align: center;
    line-height: 1.05;
}

.day-number {
    font-size: .78rem;
    font-weight: 900;
}

.day-label {
    margin-top: 3px;
    color: var(--muted);
    font-size: .58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.day-weekend {
    background: #e8edf1 !important;
}

.day-weekend .timesheet-cell-link {
    background: #edf2f5;
}

.timesheet-table thead th.day-weekend,
.timesheet-table tfoot td.day-weekend {
    background: #d7e0e6 !important;
    color: var(--brand-dark);
}

.timesheet-table thead th.day-weekend .day-label {
    color: var(--brand-dark);
}

.day-holiday {
    background: #fff0d6 !important;
}

.day-holiday .timesheet-cell-link {
    background: #fff7ed;
}

.timesheet-table thead th.day-holiday,
.timesheet-table tfoot td.day-holiday {
    background: #f8d79b !important;
    color: #7c3d00;
}

.timesheet-table thead th.day-holiday .day-label {
    color: #7c3d00;
}

.day-total-row td {
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.day-total-row td:first-child {
    z-index: 3;
}

/* ---------- Entry edit ---------- */

.entry-edit-cell {
    background: var(--surface);
}

.entry-edit-grid {
    display: grid;
    grid-template-columns: 180px minmax(280px, 1.5fr) 190px 120px 100px 150px auto;
    gap: 12px;
    align-items: end;
}

/* ---------- Login ---------- */

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.login-logo {
    display: block;
    width: min(260px, 82%);
    height: auto;
}

.login-title {
    margin-top: 0;
    margin-bottom: 22px;
    text-align: center;
}

.login-subtitle {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--muted);
}

/* ---------- Responsive ---------- */

@media (max-width: 1300px) {
    .entry-edit-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .app-shell,
    .app-shell.sidebar-collapsed {
        grid-template-columns: 1fr;
    }

    .sidebar {
        min-height: auto;
        padding-bottom: 8px;
    }

    .sidebar.collapsed {
        min-height: 72px;
    }

    .grid-2,
    .grid-4,
    .details-grid,
    .form-grid,
    .time-range,
    .entry-edit-grid {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 16px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ---------- Sticky Fix Monatsmatrix, Desktop + Tablet ---------- */
/*
 * Wichtig:
 * Dieser Block MUSS außerhalb von @media stehen.
 * Sonst greift Sticky nur auf kleinen Viewports. CSS, du kleine Falle mit Semikolon.
 */

.table-wrap {
    overflow: auto !important;
}

.card:has(.timesheet-table) {
    overflow: visible !important;
}

.timesheet-table {
    overflow: visible !important;
    min-width: 1380px;
}

/* Linke Projektspalte sticky */
.timesheet-table th:first-child,
.timesheet-table td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 30 !important;

    width: 210px !important;
    min-width: 210px !important;
    max-width: 210px !important;

    background: var(--brand-dark) !important;
    color: #ffffff !important;
    text-align: left !important;

    box-shadow: 3px 0 0 rgba(15, 59, 68, .18) !important;
    overflow: hidden;
}

/* Kopf links über Tageszellen legen */
.timesheet-table thead th:first-child {
    z-index: 60 !important;
    background: var(--brand-dark) !important;
}

/* Tagessumme links */
.timesheet-table tfoot td:first-child,
.timesheet-table .day-total-row td:first-child {
    z-index: 55 !important;
    background: var(--primary-strong) !important;
    color: #ffffff !important;
}

/* Rechte Summenspalte sticky */
.timesheet-table th:last-child,
.timesheet-table td:last-child {
    position: sticky !important;
    right: 0 !important;
    z-index: 30 !important;

    width: 86px !important;
    min-width: 86px !important;
    max-width: 86px !important;

    background: var(--brand-dark) !important;
    color: #ffffff !important;

    box-shadow: -3px 0 0 rgba(15, 59, 68, .18) !important;
}

/* Kopf rechts über Tageszellen legen */
.timesheet-table thead th:last-child {
    z-index: 60 !important;
    background: var(--brand-dark) !important;
}

/* Tagessumme rechts */
.timesheet-table tfoot td:last-child,
.timesheet-table .day-total-row td:last-child {
    z-index: 55 !important;
    background: var(--primary-strong) !important;
    color: #ffffff !important;
}

/* Projektcode in der Matrix ausblenden */
.timesheet-table tbody td:first-child .small-text,
.timesheet-table tbody td:first-child small,
.timesheet-table tbody td:first-child .project-code,
.timesheet-table tbody td:first-child .project-key,
.timesheet-table tbody td:first-child .project-number {
    display: none !important;
}

/* Projektzelle kompakter */
.timesheet-table tbody td:first-child {
    line-height: 1.15;
    font-weight: 400;
}

.timesheet-table tbody td:first-child {
    font-size: .82rem;
    font-weight: 500 !important;
}

.timesheet-table tbody td:first-child strong,
.timesheet-table tbody td:first-child b {
    font-size: .84rem;
    font-weight: 650 !important;
    letter-spacing: -0.01em;
}

.timesheet-table tbody td:first-child strong,
.timesheet-table tbody td:first-child b {
    display: block !important;
    margin: 0 !important;
    line-height: 1.12 !important;
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}


.timesheet-table td:last-child strong {
    font-size: .82rem;
    font-weight: 650;
    letter-spacing: -.01em;
}
/* Tageszellen weiter kompakt halten */
.timesheet-table thead th:not(:first-child):not(:last-child),
.timesheet-table tbody td:not(:first-child):not(:last-child),
.timesheet-table tfoot td:not(:first-child):not(:last-child) {
    width: 35px !important;
    min-width: 35px !important;
    max-width: 35px !important;
}

.timesheet-cell-link {
    min-height: 30px !important;
    padding: 3px 1px !important;
}

.cell-hours {
    font-size: .72rem !important;
}

/* iPad / kleine Breiten */
@media (max-width: 960px) {
    .timesheet-table th:first-child,
    .timesheet-table td:first-child {
        width: 180px !important;
        min-width: 180px !important;
        max-width: 180px !important;
    }

    .timesheet-table th:last-child,
    .timesheet-table td:last-child {
        width: 76px !important;
        min-width: 76px !important;
        max-width: 76px !important;
    }
}

/* ---------- Timesheet filter ---------- */

.timesheet-filter {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid rgba(229, 231, 235, .18);
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
}

.timesheet-filter label {
    min-width: 220px;
    margin: 0;
    color: #ffffff;
    font-weight: 700;
}

.timesheet-filter .input,
.timesheet-filter .select {
    margin-top: 6px;
}

.timesheet-filter .btn {
    min-height: 42px;
}

.timesheet-table tbody td:first-child {
    font-weight: 400 !important;
}

.timesheet-table tbody td:first-child strong,
.timesheet-table tbody td:first-child b {
    font-weight: 800 !important;
}
/* Tagessummen in engen Tages-Spalten entschärfen */
.timesheet-table tfoot td:not(:first-child):not(:last-child) strong {
    font-size: .68rem !important;
    font-weight: 750 !important;
    letter-spacing: -0.04em !important;
    white-space: nowrap !important;
}
/* Aktiver Timer in der Monatsmatrix */
.timesheet-table tbody td.timer-running {
    background: #fee2e2 !important;
}

.timesheet-table tbody td.timer-running .timesheet-cell-link {
    background: #fee2e2 !important;
    border-color: #ef4444 !important;
    color: #7f1d1d !important;
}

.timesheet-table tbody td.timer-running .cell-hours::after {
    content: " ●";
    color: #dc2626;
    font-weight: 900;
}
/* ---------- Admin project assignment checklist ---------- */
.compact-card-header {
    margin-bottom: 10px;
}

.assignment-check-panel {
    margin-top: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.assignment-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.assignment-check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    font-weight: 600;
}

.assignment-check-item input {
    flex: 0 0 auto;
}

.assignment-check-item span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.assignment-check-item small {
    color: var(--muted);
    font-weight: 500;
}

/* ---------- Admin filters + compact day editor ---------- */
.admin-filter {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.admin-filter label {
    min-width: 190px;
    margin: 0;
    color: var(--text);
    font-weight: 700;
}

.admin-filter .input,
.admin-filter .select {
    margin-top: 6px;
}

.admin-filter .btn {
    min-height: 42px;
}

.day-editor .card {
    max-width: 1120px;
}

.day-project-switch {
    padding: 14px 16px;
}

.day-project-switch-form {
    display: grid;
    grid-template-columns: 90px minmax(260px, 560px);
    gap: 12px;
    align-items: center;
}

.day-project-switch-form label {
    margin: 0;
}

.day-entry-form {
    grid-template-columns: minmax(220px, 1.2fr) 260px 230px 170px;
    align-items: start;
}

.day-entry-form .form-row-full {
    grid-column: 1 / -1;
}

.day-editor .textarea {
    min-height: 74px;
}

.day-editor .input,
.day-editor .select,
.day-editor .textarea,
.day-editor .readonly-box {
    padding: 8px 10px;
}

.day-editor .entry-edit-grid {
    grid-template-columns: 150px minmax(260px, 1.4fr) 180px 105px 95px 120px 120px auto;
    gap: 8px;
    align-items: end;
}

.day-editor .entry-edit-grid label {
    font-size: .82rem;
    margin-bottom: 4px;
}

.day-editor .entry-edit-cell {
    padding: 8px 6px;
}

@media (max-width: 960px) {
    .day-project-switch-form,
    .day-entry-form,
    .day-editor .entry-edit-grid {
        grid-template-columns: 1fr;
    }

    .day-editor .card {
        max-width: none;
    }
}
/* Monatsmatrix: Projektspalte ruhiger */
.timesheet-table tbody td:first-child {
    font-size: .80rem !important;
    font-weight: 400 !important;
    line-height: 1.18 !important;
    padding-top: 7px !important;
    padding-bottom: 7px !important;
}

.timesheet-table tbody td:first-child .project-customer {
    color: rgba(255,255,255,.76) !important;
    font-size: .78rem !important;
    font-weight: 400 !important;
    line-height: 1.15 !important;
}

.timesheet-table tbody td:first-child .project-name {
    color: #ffffff !important;
    font-size: .82rem !important;
    font-weight: 560 !important;
    line-height: 1.15 !important;
    margin-top: 2px !important;
    letter-spacing: 0 !important;
}
.timesheet-table tfoot td:first-child strong {
    font-size: .90rem !important;
    font-weight: 650 !important;
}

.timesheet-table tfoot td:first-child .small-text {
    color: rgba(255,255,255,.68) !important;
    font-size: .76rem !important;
    font-weight: 400 !important;
}
/* Tagespflege: bestehende Einträge kompakter */
.day-entry-table {
    min-width: 980px;
}

.day-entry-table td,
.day-entry-table th {
    padding: 6px 8px !important;
    vertical-align: middle !important;
}

.day-entry-table textarea.textarea {
    min-height: 54px !important;
    height: 54px !important;
    resize: vertical;
}

.day-entry-table .input,
.day-entry-table .select {
    min-height: 38px !important;
    padding: 7px 10px !important;
}

.day-entry-table .btn {
    min-height: 36px !important;
    padding: 7px 10px !important;
    font-size: .82rem !important;
    border-radius: 8px !important;
}

.day-entry-table .entry-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.day-entry-table .entry-actions form {
    margin: 0;
}

.day-entry-table .entry-actions .btn {
    white-space: nowrap;
}
/* Tagespflege: vorhandene Einträge als kompakte Karten */
.day-entry-list {
    display: grid;
    gap: 12px;
}

.day-entry-list-header {
    align-items: flex-start;
    gap: 16px;
}

.day-entry-list-header .small-text {
    margin: 4px 0 0;
}

.day-entry-list-header .btn {
    flex: 0 0 auto;
}

.day-entry-bulk-warning {
    margin: 0 0 14px;
}

.day-entry-action-form {
    display: none;
}

.day-entry-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.day-entry-main {
    display: grid;
    grid-template-columns: minmax(260px, 1.2fr) 170px 200px 110px 110px 120px 140px;
    gap: 10px;
    align-items: end;
}

.day-entry-field label {
    margin-bottom: 4px;
    font-size: .78rem;
}

.day-entry-text textarea {
    min-height: 58px !important;
    height: 58px !important;
    resize: vertical;
}

.day-entry-card .input,
.day-entry-card .select,
.day-entry-card .readonly-box {
    min-height: 38px !important;
    padding: 7px 10px !important;
}

.day-entry-time {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.day-entry-actions {
    display:flex;
    justify-content:flex-start;
    gap:10px;
    margin-left:0px;
}

.day-entry-actions .btn {
    min-height: 36px !important;
    padding: 7px 10px !important;
    font-size: .82rem !important;
    border-radius: 8px !important;
    white-space: nowrap;
}



@media (max-width: 1100px) {
    .day-entry-main {
        grid-template-columns: 1fr 1fr;
    }

    .day-entry-text {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .day-entry-main {
        grid-template-columns: 1fr;
    }

    .day-entry-actions {
        justify-content: stretch;
    }

    .day-entry-actions .btn {
        flex: 1 1 100%;
    }
}
.day-entry-billable {
    white-space: nowrap;
}
.day-entry-main {
    grid-template-columns:
        minmax(220px, 1fr)
        135px
        155px
        200px
        95px
        95px
        120px
        120px;
}
/* ---------- Monatsstatistik ---------- */

.month-statistics {
    display: grid;
    grid-template-columns: minmax(190px, 1.35fr) repeat(4, minmax(125px, 1fr));
    margin: 0 0 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.month-statistics-scope,
.month-statistic {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    padding: 10px 14px;
}

.month-statistics-scope {
    background: var(--brand-dark);
    color: #ffffff;
}

.month-statistic {
    border-left: 1px solid var(--line);
}

.month-statistics strong {
    font-size: .98rem;
    line-height: 1.25;
    white-space: nowrap;
}

.statistics-label {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .06em;
    line-height: 1.1;
    text-transform: uppercase;
}

.month-statistics-scope .statistics-label {
    color: var(--brand-text-soft);
}

.statistics-period,
.statistics-detail {
    margin-top: 2px;
    color: var(--muted);
    font-size: .74rem;
    line-height: 1.2;
    white-space: nowrap;
}

.month-statistics-scope .statistics-period {
    color: var(--brand-text-soft);
}

.month-statistic-billable strong {
    color: var(--primary-strong);
}

.month-statistic-non-billable strong {
    color: #9a6700;
}

@media (max-width: 1100px) {
    .month-statistics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .month-statistics-scope {
        grid-column: 1 / -1;
    }

    .month-statistic {
        border-top: 1px solid var(--line);
    }
}

@media (max-width: 640px) {
    .month-statistics {
        grid-template-columns: 1fr;
    }

    .month-statistic {
        border-left: 0;
    }
}

/* ---------- Monatsabschluss ---------- */

.btn:disabled,
.btn[disabled] {
    cursor: not-allowed;
    opacity: .55;
    transform: none;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-neutral {
    background: #e5e7eb;
    color: #374151;
}

.month-closure-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--primary);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.month-closure-card > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.month-closure-submitted {
    border-left-color: var(--success);
    background: var(--success-soft);
}

.month-closure-kicker {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 850;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.month-closure-detail {
    color: var(--muted);
    font-size: .84rem;
}

.month-closure-dialog {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 0;
    border-radius: 16px;
    padding: 24px;
    color: var(--text);
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

.month-closure-dialog::backdrop {
    background: rgba(15, 59, 68, .55);
    backdrop-filter: blur(2px);
}

.dialog-close-form {
    position: absolute;
    top: 12px;
    right: 12px;
    margin: 0;
}

.dialog-close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--brand-dark);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

.dialog-heading h2 {
    margin: 4px 42px 6px 0;
}

.dialog-heading p {
    margin: 0 42px 18px 0;
    color: var(--muted);
}

.closure-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.closure-summary-grid > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}

.closure-summary-grid span {
    color: var(--muted);
    font-size: .76rem;
}

.closure-summary-grid strong {
    color: var(--brand-dark);
    font-size: 1rem;
}

.closure-warning {
    margin: 10px 0;
    padding: 10px 12px;
    border: 1px solid #fde68a;
    border-radius: 10px;
    background: #fffbeb;
    color: #92400e;
    font-size: .86rem;
}

.closure-confirm-form {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.closure-confirmation {
    align-items: flex-start;
    font-weight: 600;
    line-height: 1.4;
}

.closure-confirmation input {
    margin-top: 4px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.month-closure-admin-card {
    margin-bottom: 18px;
}

.month-closure-admin-card .card-header .small-text {
    margin: 5px 0 0;
}

.month-closure-admin-table {
    min-width: 1050px;
}

.closure-reopen-form {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 330px;
}

.closure-reopen-form .input {
    min-width: 190px;
    padding: 8px 10px;
}

.closure-reopen-form .btn {
    white-space: nowrap;
    padding: 8px 10px;
}

.closure-reopen-note {
    max-width: 260px;
    margin-top: 5px;
    line-height: 1.25;
}

@media (max-width: 800px) {
    .month-closure-card {
        align-items: stretch;
        flex-direction: column;
    }

    .month-closure-card .btn {
        width: 100%;
    }

    .closure-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .closure-summary-grid {
        grid-template-columns: 1fr;
    }

    .dialog-actions {
        flex-direction: column-reverse;
    }

    .dialog-actions .btn {
        width: 100%;
    }
}

/* ---------- Kompakte Monatskopfleiste: Statistik + Abschluss ---------- */

.month-overview-row {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(320px, .8fr);
    gap: 14px;
    align-items: stretch;
    margin-bottom: 16px;
}

.month-overview-row .month-statistics,
.month-overview-row .month-closure-card {
    margin: 0;
    min-height: 78px;
}

.month-statistics-compact {
    grid-template-columns: minmax(150px, 1.25fr) repeat(4, minmax(92px, .75fr));
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .035);
}

.month-statistics-compact .month-statistics-scope,
.month-statistics-compact .month-statistic {
    padding: 8px 10px;
}

.month-statistics-compact strong {
    font-size: .9rem;
}

.month-statistics-compact .statistics-label {
    font-size: .62rem;
}

.month-statistics-compact .statistics-period,
.month-statistics-compact .statistics-detail {
    font-size: .68rem;
}

.month-closure-compact {
    padding: 10px 12px;
    gap: 12px;
    border-left-width: 4px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .035);
}

.month-closure-compact > div {
    gap: 2px;
}

.month-closure-compact strong {
    font-size: .94rem;
    line-height: 1.2;
}

.month-closure-compact .month-closure-detail {
    overflow: hidden;
    font-size: .76rem;
    line-height: 1.25;
    text-overflow: ellipsis;
}

.month-closure-compact .btn {
    flex: 0 0 auto;
    padding: 8px 11px;
    white-space: nowrap;
}

@media (max-width: 1250px) {
    .month-overview-row {
        grid-template-columns: 1fr;
    }

    .month-overview-row .month-closure-card {
        min-height: 0;
    }
}

@media (max-width: 800px) {
    .month-statistics-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .month-statistics-compact .month-statistics-scope {
        grid-column: 1 / -1;
    }
}

/* ---------- Timer pausieren / fortsetzen ---------- */

.timer-card {
    border-left: 4px solid var(--primary);
}

.timer-card-paused {
    border-left-color: #d97706;
    background: #fffdf7;
}

.timer-card .card-header {
    align-items: center;
}

.timer-status-line {
    margin: 0;
}

.timer-active-duration {
    margin: 10px 0 0;
    font-size: 1rem;
}

.timer-active-duration strong {
    color: var(--brand-dark);
}

.timer-card-paused .timer-active-duration strong {
    color: #92400e;
}

.timer-actions {
    margin-top: 14px;
}

.timer-entry-duration {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: .72rem;
}

.mobile-timer-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

@media (max-width: 520px) {
    .mobile-timer-actions {
        grid-template-columns: 1fr;
    }
}

/* Datumsfeld in der Tagespflege: responsive Anordnung der acht Editierfelder. */
@media (max-width: 1450px) {
    .day-entry-main {
        grid-template-columns: minmax(220px, 1fr) 135px 155px 200px;
    }

    .day-entry-text {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1100px) {
    .day-entry-main {
        grid-template-columns: 1fr 1fr;
    }

    .day-entry-text {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .day-entry-main {
        grid-template-columns: 1fr;
    }

    .day-entry-text {
        grid-column: auto;
    }
}

/* ---------- Tagespflege: vorhandene Einträge ohne Überstand ---------- */

.day-editor .card {
    width: 100%;
    max-width: 1360px;
}

@media (min-width: 1451px) {
    .day-editor .day-entry-main {
        grid-template-columns:
            minmax(260px, 1.6fr)
            145px
            170px
            minmax(190px, .95fr)
            100px
            100px
            130px
            max-content;
        width: 100%;
    }
}


/* ---------- Globaler Timer in Sidebar und Modal ---------- */

.global-timer-panel {
    margin: -2px 0 20px;
}

.global-timer-open {
    position: relative;
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 12px;
    background: rgba(255, 255, 255, .07);
    color: #ffffff;
    cursor: pointer;
    text-align: left;
    transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}

.global-timer-open:hover,
.global-timer-open:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(142, 181, 42, .62);
    background: rgba(142, 181, 42, .16);
    outline: none;
}

.global-timer-open.global-timer-active {
    border-color: rgba(239, 68, 68, .62);
    background: rgba(127, 29, 29, .24);
}

.global-timer-open.global-timer-paused {
    border-color: rgba(245, 158, 11, .65);
    background: rgba(146, 64, 14, .25);
}

.global-timer-icon {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    font-size: 1.1rem;
    font-weight: 900;
}

.global-timer-summary-text {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
}

.global-timer-summary-text strong,
.global-timer-summary-text small,
.global-timer-caption {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-timer-caption {
    color: var(--brand-text-soft);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.global-timer-summary-text strong {
    color: #ffffff;
    font-size: .86rem;
}

.global-timer-summary-text small {
    color: var(--brand-text-soft);
    font-size: .72rem;
}

.global-timer-state-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, .65);
    animation: globalTimerPulse 1.8s ease-in-out infinite;
}

.global-timer-paused .global-timer-state-dot {
    background: #f59e0b;
    box-shadow: none;
    animation: none;
}

@keyframes globalTimerPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .55); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.sidebar.collapsed .global-timer-panel {
    margin: 2px 0 18px;
}

.sidebar.collapsed .global-timer-open {
    width: 42px;
    height: 42px;
    justify-content: center;
    margin: 0 auto;
    padding: 5px;
    border-radius: 12px;
}

.sidebar.collapsed .global-timer-summary-text,
.sidebar.collapsed .global-timer-state-dot {
    display: none;
}

.sidebar.collapsed .global-timer-icon {
    width: 30px;
    height: 30px;
}

.global-timer-dialog {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100dvh - 48px);
    overflow: auto;
    border: 0;
    border-radius: 16px;
    padding: 24px;
    color: var(--text);
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .30);
}

.global-timer-dialog::backdrop {
    background: rgba(15, 59, 68, .60);
    backdrop-filter: blur(2px);
}

.global-timer-dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
}

.global-timer-dialog-heading h2 {
    margin-right: 44px;
}

.global-timer-start-form > label,
.global-timer-form-row > label:not(.checkbox-row) {
    display: block;
    margin: 12px 0 6px;
    font-weight: 750;
}

.global-timer-search {
    width: 100%;
}

.global-timer-assignment-list {
    display: grid;
    max-height: 250px;
    gap: 7px;
    margin: 10px 0 14px;
    overflow: auto;
    padding: 2px 5px 2px 2px;
}

.global-timer-assignment {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}

.global-timer-assignment:hover {
    transform: translateY(-1px);
    border-color: rgba(142, 181, 42, .65);
}

.global-timer-assignment:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: inset 3px 0 0 var(--primary);
}

.global-timer-assignment > .global-timer-assignment-text {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(150px, .72fr) minmax(220px, 1.28fr);
    gap: 18px;
    align-items: center;
}

.global-timer-assignment-text > strong,
.global-timer-assignment-text > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-timer-assignment-text > strong {
    color: var(--text);
}

.global-timer-assignment-text > span {
    color: var(--text);
}

.global-timer-empty {
    padding: 14px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    color: var(--muted);
    text-align: center;
}

.global-timer-start-form .textarea {
    width: 100%;
    min-height: 92px;
}

.global-timer-form-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) max-content;
    gap: 18px;
    align-items: end;
}

.global-timer-billable {
    min-height: 42px;
    margin: 12px 0 0;
    padding: 0 6px;
}

.global-timer-running-card {
    margin-top: 10px;
    padding: 16px;
    border: 1px solid var(--line);
    border-left: 4px solid #ef4444;
    border-radius: 12px;
    background: var(--surface-soft);
}

.global-timer-running-card.is-paused {
    border-left-color: #f59e0b;
    background: #fffdf7;
}

.global-timer-running-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.global-timer-running-head > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.global-timer-running-head strong {
    color: var(--brand-dark);
    font-size: 1rem;
}

.global-timer-running-head span:not(.global-timer-running-indicator) {
    color: var(--muted);
}

.global-timer-running-indicator {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #ef4444;
    animation: globalTimerPulse 1.8s ease-in-out infinite;
}

.global-timer-running-card.is-paused .global-timer-running-indicator {
    border-radius: 2px;
    background: #f59e0b;
    animation: none;
}

.global-timer-booking-text {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--surface);
    line-height: 1.4;
}

.global-timer-running-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    color: var(--muted);
    font-size: .84rem;
}

.global-timer-running-meta strong {
    color: var(--brand-dark);
}

.global-timer-actions {
    margin-top: 16px;
}

@media (max-width: 700px) {
    .global-timer-assignment > .global-timer-assignment-text {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .global-timer-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .global-timer-running-meta {
        flex-direction: column;
        gap: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .global-timer-state-dot,
    .global-timer-running-indicator {
        animation: none !important;
    }
}

/* ---------- Globaler Timer: Suchtreffer wirklich ausblenden ---------- */

/*
 * Das HTML-hidden-Attribut wurde durch display:grid der Projektoptionen
 * überschrieben. Dadurch arbeitete die Suche intern korrekt, optisch blieb
 * aber alles sichtbar. Diese Regel gibt hidden wieder das letzte Wort.
 */
.global-timer-assignment-row[hidden],
.global-timer-assignment[hidden],
.global-timer-empty[hidden] {
    display: none !important;
}


/* ---------- Timerdialog: Start, aktuelles Ende und aktive Dauer ---------- */
.global-timer-running-meta > span {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.global-timer-running-meta > span > strong {
    font-size: .95rem;
}

/* ---------- Timer-Produktivität: Tagesstatus, Favoriten und Unterbrechungs-Stack ---------- */
.global-timer-day-status {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 14px;
}

.global-timer-day-status > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
}

.global-timer-day-status span {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.global-timer-day-status strong {
    color: var(--brand-dark);
    font-size: .92rem;
}

.global-timer-new-panel {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    overflow: hidden;
}

.global-timer-new-panel > summary {
    padding: 11px 13px;
    background: var(--surface-soft);
    color: var(--brand-dark);
    font-weight: 800;
    cursor: pointer;
    list-style-position: inside;
}

.global-timer-new-panel[open] > summary {
    border-bottom: 1px solid var(--line);
}

.global-timer-new-panel .global-timer-start-form {
    padding: 13px;
}

.global-timer-assignment-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.global-timer-assignment-row + .global-timer-assignment-row {
    margin-top: 6px;
}

.global-timer-assignment-row.is-favorite {
    border-color: rgba(142, 181, 42, .75);
    box-shadow: inset 3px 0 0 var(--primary);
}

.global-timer-assignment-row.is-recent:not(.is-favorite) {
    box-shadow: inset 3px 0 0 rgba(15, 72, 82, .35);
}

.global-timer-assignment-row .global-timer-assignment {
    border: 0 !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.global-timer-favorite-toggle {
    border: 0;
    border-left: 1px solid var(--line);
    background: var(--surface-soft);
    color: #7f8b8e;
    font-size: 1.15rem;
    cursor: pointer;
}

.global-timer-favorite-toggle:hover,
.global-timer-favorite-toggle.is-favorite {
    background: #f2f7e6;
    color: #6e8e19;
}

.global-timer-stack {
    display: grid;
    gap: 7px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid #e4c977;
    border-radius: 10px;
    background: #fff9e8;
}

.global-timer-stack-heading,
.global-timer-stack-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.global-timer-stack-heading span {
    color: #7a621e;
    font-size: .7rem;
    font-weight: 700;
}

.global-timer-stack-item {
    padding-top: 7px;
    border-top: 1px solid rgba(180, 143, 45, .24);
}

.global-timer-stack-item > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.global-timer-stack-item span,
.global-timer-stack-item small {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-timer-stack-actions {
    display: flex;
    gap: 5px;
}

.global-timer-stack-count {
    position: absolute;
    top: 5px;
    right: 7px;
    display: inline-flex;
    min-width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border-radius: 999px;
    background: #f0b429;
    color: #173f47;
    font-size: .65rem;
    font-weight: 900;
}

.global-timer-open {
    position: relative;
}

/* ---------- Plausibilitätsprüfung ---------- */
.plausibility-warning {
    padding: 11px 13px;
    border: 1px solid #e0b84c;
    border-radius: 9px;
    background: #fff8df;
    color: #5c4a16;
}

.plausibility-warning strong {
    display: block;
    margin-bottom: 5px;
}

.plausibility-warning ul {
    margin: 0 0 5px 18px;
    padding: 0;
}

.plausibility-warning span {
    font-size: .78rem;
}

/* ---------- Schnellbuchung ---------- */
.quick-booking-dialog {
    width: min(560px, calc(100vw - 28px));
    max-height: calc(100dvh - 32px);
    padding: 22px;
    border: 0;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .25);
}

.quick-booking-dialog::backdrop {
    background: rgba(11, 42, 48, .52);
    backdrop-filter: blur(2px);
}

.quick-booking-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.quick-booking-presets button {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--brand-dark);
    font-weight: 800;
    cursor: pointer;
}

.quick-booking-presets button:hover {
    border-color: var(--primary);
    background: #f1f7e5;
}

.quick-booking-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.quick-booking-billable {
    margin-top: 9px;
}

@media (max-width: 640px) {
    .global-timer-day-status,
    .quick-booking-grid {
        grid-template-columns: 1fr;
    }

    .quick-booking-presets {
        grid-template-columns: repeat(2, 1fr);
    }

    .global-timer-stack-item {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ---------- Projektkontingente und Textbausteine ---------- */

.project-quota-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 10px;
    background: var(--surface-soft);
}

.project-quota-banner .project-quota-label {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.project-quota-banner strong {
    text-align: right;
}

.project-quota-banner.quota-ok,
.project-quota-indicator.quota-ok,
.global-timer-assignment-quota.quota-ok {
    border-color: rgba(142, 181, 42, .75);
    color: #6f9418;
}

.project-quota-banner.quota-warning,
.project-quota-indicator.quota-warning,
.global-timer-assignment-quota.quota-warning {
    border-color: #d4a017;
    color: #b07b00;
}

.project-quota-banner.quota-exceeded,
.project-quota-indicator.quota-exceeded,
.global-timer-assignment-quota.quota-exceeded {
    border-color: #dc2626;
    color: #dc2626;
}

.project-cell-content {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-areas:
        "customer quota"
        "project project";
    column-gap: 6px;
    row-gap: 2px;
    align-items: baseline;
}

.project-cell-content .project-customer {
    grid-area: customer;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-cell-content .project-name {
    grid-area: project;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-quota-indicator {
    grid-area: quota;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-align: right;
    font-size: .78rem;
    line-height: 1.15;
    white-space: nowrap;
}

.project-quota-indicator strong {
    display: block;
    overflow: hidden;
    font-size: inherit;
    font-weight: 700;
    line-height: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/*
 * Ist Kunde + Kontingent für die erste Zeile zu breit, bleibt die Projektzelle
 * trotzdem zweizeilig: Kunde oben, Projekt links und Kontingent rechts unten.
 */
.project-cell-content.quota-on-second-line {
    grid-template-areas:
        "customer customer"
        "project quota";
}

.global-timer-assignment-text > .global-timer-assignment-quota {
    grid-column: 1 / -1;
    overflow: hidden;
    margin-top: 2px;
    font-size: .62rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-entry-snippet-select {
    margin-bottom: 6px;
    font-size: .75rem;
}

@media (max-width: 760px) {
    .project-quota-banner {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .project-quota-banner strong {
        text-align: left;
    }
}

/* ---------- Mobile Zeiterfassung: bewusst eigenständige, robuste Ansicht ---------- */
.mobile-timesheet-body {
    min-width: 0;
    background: #f3f6f7;
    -webkit-text-size-adjust: 100%;
}

.mobile-appbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--brand-dark);
    color: #fff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .14);
}

.mobile-appbar-main {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(100%, 760px);
    min-height: 58px;
    margin: 0 auto;
    padding: 8px 12px;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-right: auto;
    color: #fff;
    font-weight: 800;
}

.mobile-brand img {
    display: block;
    width: 92px;
    max-height: 34px;
    object-fit: contain;
    object-position: left center;
}

.mobile-brand span {
    white-space: nowrap;
}

.mobile-timer-jump,
.mobile-menu > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 10px;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: .88rem;
    font-weight: 750;
    cursor: pointer;
}

.mobile-timer-jump.is-active {
    background: rgba(142, 181, 42, .24);
    border-color: rgba(177, 216, 79, .6);
}

.mobile-menu {
    position: relative;
}

.mobile-menu > summary {
    list-style: none;
}

.mobile-menu > summary::-webkit-details-marker {
    display: none;
}

.mobile-menu[open] nav {
    display: grid;
}

.mobile-menu nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    min-width: 210px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(0,0,0,.18);
}

.mobile-menu nav a,
.mobile-menu nav button {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.mobile-menu nav a:last-child,
.mobile-menu nav form:last-child button {
    border-bottom: 0;
}

.mobile-menu nav form {
    margin: 0;
}

.mobile-page {
    display: grid;
    gap: 14px;
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 14px 12px calc(24px + env(safe-area-inset-bottom));
}

.mobile-day-nav {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    gap: 8px;
    align-items: stretch;
}

.mobile-day-arrow,
.mobile-day-current {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.mobile-day-arrow {
    font-size: 1.35rem;
    font-weight: 800;
}

.mobile-day-current {
    flex-direction: column;
    gap: 2px;
}

.mobile-day-current strong {
    font-size: .96rem;
}

.mobile-day-current span {
    color: var(--muted);
    font-size: .82rem;
}

.mobile-card {
    overflow: hidden;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,.05);
}

.mobile-timer-section {
    border-left: 5px solid var(--primary);
}

.mobile-timer-section.is-paused {
    border-left-color: #d97706;
}

.mobile-card-head,
.mobile-entry-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.mobile-card-head {
    margin-bottom: 14px;
}

.mobile-card-head h1,
.mobile-card-head h2 {
    margin: 2px 0 0;
    font-size: 1.18rem;
    line-height: 1.25;
}

.mobile-kicker {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mobile-status {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 800;
}

.mobile-status.is-running {
    background: var(--success-soft);
    color: var(--success);
}

.mobile-status.is-paused {
    background: #fff7ed;
    color: #9a3412;
}

.mobile-running-timer {
    display: grid;
    gap: 10px;
}

.mobile-running-project {
    font-size: 1.05rem;
}

.mobile-running-timer > span {
    margin-top: -8px;
    color: var(--muted);
}

.mobile-running-text {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface-soft);
    line-height: 1.4;
}

.mobile-timer-clock {
    display: grid;
    gap: 3px;
    padding: 12px;
    border-radius: 12px;
    background: var(--primary-soft);
}

.mobile-timer-clock > span,
.mobile-timer-clock small {
    color: var(--muted);
    font-size: .78rem;
}

.mobile-timer-clock > strong {
    color: var(--brand-dark);
    font-size: 1.5rem;
    line-height: 1.2;
}

.mobile-simple-form {
    display: grid;
    gap: 13px;
}

.mobile-simple-form > label,
.mobile-time-grid > label,
.mobile-duration-grid > label {
    display: grid;
    gap: 6px;
    color: var(--text);
    font-size: .85rem;
    font-weight: 700;
}

.mobile-simple-form .input,
.mobile-simple-form .select,
.mobile-simple-form .textarea {
    width: 100%;
    min-height: 46px;
    font-size: 16px; /* verhindert Browser-Zoom beim Fokussieren */
}

.mobile-simple-form .textarea {
    min-height: 76px;
    resize: vertical;
}

.mobile-checkbox {
    display: flex !important;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 9px !important;
    min-height: 42px;
}

.mobile-checkbox input {
    width: 20px;
    height: 20px;
}

.mobile-primary-action {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
}

.mobile-button-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.mobile-button-row .btn {
    min-height: 46px;
}

.mobile-duration-grid {
    display: grid;
    gap: 8px;
}

.mobile-or {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

.mobile-time-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.mobile-entry-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--brand-dark);
    font-size: .8rem;
    font-weight: 800;
}

.mobile-entry-list {
    display: grid;
    gap: 10px;
}

.mobile-entry-card {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.mobile-entry-head > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.mobile-entry-head span {
    overflow: hidden;
    color: var(--muted);
    font-size: .82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-entry-duration {
    flex: 0 0 auto;
    color: var(--brand-dark);
    white-space: nowrap;
}

.mobile-entry-text {
    margin: 0;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.mobile-entry-card small {
    color: var(--muted);
}

.mobile-empty {
    padding: 12px;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--muted);
    line-height: 1.45;
}

@media (max-width: 430px) {
    .mobile-brand span {
        display: none;
    }

    .mobile-brand img {
        width: 82px;
    }

    .mobile-appbar-main {
        gap: 7px;
        padding-inline: 9px;
    }

    .mobile-timer-jump,
    .mobile-menu > summary {
        padding-inline: 8px;
        font-size: .8rem;
    }

    .mobile-page {
        padding-inline: 9px;
    }

    .mobile-card {
        padding: 14px;
        border-radius: 14px;
    }
}
