/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --primary-bg: #eef2ff;
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --transition: 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

/* ===== App Layout ===== */
.app {
    display: flex;
    height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform var(--transition);
    z-index: 100;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo .material-icons-round {
    font-size: 28px;
    color: var(--primary-light);
}

.logo h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.sidebar-nav {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--gray-400);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    color: white;
    background: rgba(255,255,255,0.08);
}

.nav-item.active {
    color: white;
    background: var(--primary);
}

.nav-item .material-icons-round {
    font-size: 20px;
}

.nav-item {
    position: relative;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
}

.nav-badge-dot {
    background: var(--success);
    min-width: 10px;
    height: 10px;
    border-radius: 50%;
    padding: 0;
    font-size: 8px;
}

.nav-item.active .nav-badge {
    background: rgba(255,255,255,0.25);
}

.nav-item.active .nav-badge-dot {
    background: #86efac;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.top-bar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-600);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.menu-toggle:hover {
    background: var(--gray-100);
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    flex-shrink: 0;
}

/* ===== Global Search ===== */
.global-search {
    flex: 1;
    max-width: 480px;
    position: relative;
    margin: 0 16px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    font-size: 20px;
    color: var(--gray-400);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 8px 80px 8px 40px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--gray-50);
    color: var(--gray-800);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.search-input::placeholder {
    color: var(--gray-400);
}

.search-kbd {
    position: absolute;
    right: 10px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    color: var(--gray-400);
    font-family: inherit;
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
}

.search-group-title {
    padding: 10px 16px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
    background: var(--gray-50);
    position: sticky;
    top: 0;
    z-index: 1;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--gray-50);
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--primary-bg);
}

.search-result-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.search-result-icon.kunde { background: #ede9fe; color: #7c3aed; }
.search-result-icon.projekt { background: #dbeafe; color: #2563eb; }
.search-result-icon.aufgabe { background: #d1fae5; color: #059669; }
.search-result-icon.termin { background: #fef3c7; color: #d97706; }
.search-result-icon.rechnung { background: #fee2e2; color: #dc2626; }

.search-result-body {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-title mark {
    background: #fef08a;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.search-result-sub {
    font-size: 12px;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-empty {
    padding: 24px;
    text-align: center;
    color: var(--gray-400);
    font-size: 14px;
}

.search-empty .material-icons-round {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
    color: var(--gray-300);
}

@media (max-width: 768px) {
    .global-search {
        max-width: 200px;
        margin: 0 8px;
    }
    .search-kbd { display: none; }
    .search-results { left: -60px; right: -60px; }
}

.top-bar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn .material-icons-round {
    font-size: 18px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-icon.danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ===== Cards ===== */
.card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* ===== Stat Cards (Dashboard) ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

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

.stat-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.purple {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-icon.green {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.yellow {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.blue {
    background: #dbeafe;
    color: #3b82f6;
}

.stat-info h4 {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-info .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

/* ===== Tables ===== */
.table-wrapper {
    overflow-x: auto;
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
}

th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

td {
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

tr:hover td {
    background: var(--gray-50);
}

.table-actions {
    display: flex;
    gap: 4px;
    overflow: hidden;
}

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: var(--success-bg);
    color: #065f46;
}

.badge-warning {
    background: var(--warning-bg);
    color: #92400e;
}

.badge-danger {
    background: var(--danger-bg);
    color: #991b1b;
}

.badge-primary {
    background: var(--primary-bg);
    color: var(--primary-dark);
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-paid {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-800);
    background: white;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.97);
    transition: transform var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-footer .btn {
    white-space: nowrap;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state .material-icons-round {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--gray-300);
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* ===== Timer ===== */
.timer-section {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    padding: 32px;
    color: white;
    margin-bottom: 24px;
}

.timer-display {
    font-size: 48px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
    margin: 16px 0;
}

.timer-controls {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.timer-selects {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.timer-selects select {
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.15);
    color: white;
    font-family: inherit;
    font-size: 14px;
    appearance: none;
    cursor: pointer;
}

.timer-selects select option {
    color: var(--gray-800);
    background: white;
}

.timer-selects label {
    font-size: 12px;
    opacity: 0.8;
    display: block;
    margin-bottom: 4px;
}

.btn-timer {
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-timer-start {
    background: white;
    color: var(--primary);
}

.btn-timer-start:hover {
    background: var(--gray-100);
}

.btn-timer-stop {
    background: var(--danger);
    color: white;
}

.btn-timer-stop:hover {
    background: #dc2626;
}

/* ===== Kunde Detail ===== */
.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-header .back-btn {
    cursor: pointer;
}

.detail-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0;
}

.detail-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.detail-tab:hover {
    color: var(--gray-700);
}

.detail-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ===== Auswertung ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-bar .form-group {
    margin-bottom: 0;
    min-width: 160px;
}

.summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-item {
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    padding: 16px;
    text-align: center;
}

.summary-item .label {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.summary-item .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

/* ===== Wide Modal ===== */
.modal.modal-wide {
    max-width: 720px;
}

/* ===== Sortable Table Headers ===== */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background 0.15s;
}

th.sortable:hover {
    background: var(--gray-100);
}

.sort-icon {
    font-size: 16px;
    vertical-align: middle;
    margin-left: 4px;
    color: var(--gray-300);
    transition: color 0.15s;
}

.sort-icon.active {
    color: var(--primary);
}

table.fixed-cols {
    table-layout: fixed;
    width: 100%;
}

/* ===== Nav Separator & Labels ===== */
.nav-separator {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 12px;
}
.nav-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.3);
    padding: 14px 20px 4px;
    user-select: none;
}

/* ===== Invoice Status Badges ===== */
.badge-default {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ===== Invoice Actions Bar ===== */
.invoice-actions {
    margin-bottom: 24px;
}

/* ===== Invoice Document ===== */
.invoice-document {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 48px;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: var(--shadow-md);
}

/* inv-page inherits invoice-document look on screen */
.inv-page {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 48px;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: var(--shadow-md);
}

.invoice-header-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    gap: 24px;
}

.invoice-sender {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.6;
}

.invoice-sender-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.invoice-meta {
    text-align: right;
}

.invoice-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.invoice-meta-table {
    font-size: 13px;
    border-collapse: collapse;
}

.invoice-meta-table td {
    padding: 2px 0 2px 16px;
    border: none;
    white-space: nowrap;
}

.invoice-meta-table tr:hover td {
    background: transparent;
}

.invoice-recipient {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 32px;
}

.invoice-recipient-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    margin-bottom: 8px;
    font-weight: 600;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.invoice-table th {
    background: var(--gray-800);
    color: white;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    border: none;
}

.invoice-table td {
    padding: 10px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--gray-200);
}

.invoice-table tr:hover td {
    background: var(--gray-50);
}

.invoice-totals {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 32px;
}

.invoice-totals table {
    width: auto;
    min-width: 300px;
}

.invoice-totals td {
    padding: 6px 12px;
    font-size: 14px;
    border: none;
}

.invoice-totals tr:hover td {
    background: transparent;
}

.invoice-total-row td {
    padding-top: 10px;
    border-top: 2px solid var(--gray-800);
    font-size: 16px;
}

.invoice-notes {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 24px;
    line-height: 1.6;
}

.invoice-payment {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.8;
    margin-bottom: 32px;
    page-break-inside: avoid;
    break-inside: avoid;
}
.inv-page:first-child .inv-page-header { display: none; }

.invoice-footer-section {
    border-top: 1px solid var(--gray-200);
    padding-top: 16px;
    font-size: 12px;
    color: var(--gray-400);
    text-align: center;
}

/* ===== Invoice Page Layout ===== */
.inv-page {
    position: relative;
}

.inv-page-header,
.inv-page-footer,
.inv-draft-watermark {
    display: none; /* hidden on screen, shown in print */
}

/* On screen: pages flow continuously, no visible separation */
.inv-page + .inv-page {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px dashed var(--gray-300);
}

.inv-page + .inv-page::before {
    content: '— Neue Seite —';
    display: block;
    text-align: center;
    color: var(--gray-400);
    font-size: 12px;
    margin: -12px 0 16px 0;
    background: var(--gray-50);
    padding: 2px 12px;
    border-radius: 4px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Invoice Preview Table (in modal) ===== */
.invoice-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.invoice-preview-table th {
    background: var(--gray-100);
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
}

.invoice-preview-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--gray-100);
}

.invoice-preview-table tfoot td {
    border-bottom: none;
    padding: 4px 10px;
}

/* ===== Settings Form ===== */
.settings-form {
    max-width: 700px;
}

.settings-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin: 28px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.settings-section-title:first-child {
    margin-top: 0;
}

/* ===== Completeness Bar ===== */
.completeness-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.completeness-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    /* Globaler Overflow-Schutz auf Mobile */
    html, body {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: clip !important;
    }

    .app, .main-content, .content {
        max-width: 100vw !important;
        overflow-x: clip !important;
    }

    /* Alle Cards und Inhalte: Breite auf Container beschränken */
    .card, .card-body, .card-header, .detail-header {
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* Projekt-Header: Umbruch erzwingen, Icons kleiner */
    .card-header {
        flex-wrap: wrap !important;
        gap: 6px;
    }

    /* Flex-Container im Projekt-Header (Badges + Actions) */
    .card-header > div {
        max-width: 100% !important;
        flex-wrap: wrap !important;
        overflow: hidden;
    }

    .card-header .table-actions {
        flex-shrink: 0;
        gap: 2px;
    }

    .card-header .table-actions .btn-icon {
        padding: 4px;
    }

    .card-header .table-actions .btn-icon .material-icons-round {
        font-size: 18px;
    }

    /* Sicherheitsnetz: KEIN Element darf breiter als Viewport sein */
    .content * {
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Ausnahmen für Elemente die absolute/fixed sind */
    .content .mobile-actions-dropdown {
        max-width: none !important;
    }

    .content .modal-overlay, .content .modal {
        max-width: none !important;
    }

    .sidebar {
        position: fixed;
        height: 100vh;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: block;
    }

    .timer-selects {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .dashboard-quick-grid {
        grid-template-columns: 1fr !important;
    }

    .stat-card {
        padding: 12px;
        gap: 10px;
    }

    .stat-card .stat-value {
        font-size: 20px;
        white-space: nowrap;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
    }

    .stat-icon .material-icons-round {
        font-size: 20px;
    }

    .content {
        padding: 16px;
    }

    /* Tabellen horizontal scrollbar auf Mobile - nur data-table */
    .card-body:has(.data-table) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Aufgaben-Tabelle: overflow hidden, kein Scroll */
    .card-body:has(.fixed-cols) {
        overflow: hidden;
    }

    /* Projekt-Header: Actions kompakt */
    .card-header .table-actions {
        flex-shrink: 0;
    }

    .table-actions .btn-icon {
        padding: 4px;
    }

    .invoice-document,
    .inv-page {
        padding: 20px;
    }

    .invoice-header-section {
        flex-direction: column;
    }

    .invoice-meta {
        text-align: left;
    }

    /* Rechnungstabelle: auf Mobile kompakter */
    .invoice-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 8px 8px;
        font-size: 12px;
        white-space: nowrap;
    }

    .invoice-table td:nth-child(2) {
        white-space: normal;
        min-width: 100px;
    }

    .invoice-totals table {
        min-width: auto;
        width: 100%;
    }

    .invoice-totals {
        justify-content: stretch;
    }

    .invoice-document .invoice-table-wrapper,
    .inv-page .invoice-table-wrapper {
        overflow-x: auto;
        margin: 0 -20px;
        padding: 0 20px;
    }

    /* Top-Bar: Buttons und Suche auf Mobile */
    .top-bar {
        padding: 0 12px;
        gap: 6px;
    }

    .top-bar-actions {
        overflow: hidden;
    }

    .top-bar-actions .btn {
        padding: 6px 10px;
        font-size: 0;
        gap: 0;
    }

    .top-bar-actions .btn .material-icons-round {
        font-size: 20px;
    }

    .page-title {
        font-size: 16px;
        white-space: nowrap;
    }

    .global-search {
        min-width: 0;
    }

    /* Kalender-Sidebar Reihenfolge auf Mobile */
    .kalender-sidebar {
        order: -1;
    }

    /* Export/Import Boxen untereinander */
    .data-transfer-grid {
        grid-template-columns: 1fr !important;
    }

    /* Aufgaben-Tabelle: Status-Spalte auf 0 Breite (nicht display:none, da table-layout:fixed sonst Lücke erzeugt!) */
    .fixed-cols th:nth-child(3),
    .fixed-cols td:nth-child(3) {
        width: 0 !important;
        max-width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        border: 0;
        font-size: 0;
        line-height: 0;
        visibility: hidden;
    }

    /* Checkbox-Spalte kompakter */
    .fixed-cols th:first-child,
    .fixed-cols td:first-child {
        width: 30px;
        padding: 4px;
    }

    .fixed-cols {
        width: 100%;
        table-layout: fixed;
    }

    .fixed-cols td,
    .fixed-cols th {
        padding: 8px 6px;
        font-size: 13px;
    }

    /* Zeiteinträge-Panel: Breite auf Container beschränken */
    .zeiteintraege-row {
        display: table-row;
    }

    .zeiteintraege-row td[colspan] {
        display: table-cell !important;
        padding: 0 !important;
        width: 100%;
    }

    .zeiteintraege-panel,
    .zeiteintraege-panel > div {
        width: 100%;
        max-width: calc(100vw - 34px);
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Aufgaben: Actions-Spalte Overflow clippen */
    .fixed-cols td:last-child {
        overflow: hidden;
    }

    .fixed-cols .table-actions {
        gap: 1px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .fixed-cols .table-actions .btn-icon {
        padding: 2px;
    }

    .fixed-cols .table-actions .btn-icon .material-icons-round {
        font-size: 17px;
    }

    /* Status-Badge unter Aufgabenname auf Mobile anzeigen */
    .mobile-status-badge {
        display: inline-block !important;
        margin-top: 3px;
    }

    /* Mobile: Reguläre Actions in fixed-cols verstecken, Menü-Button zeigen */
    .fixed-cols .table-actions {
        display: none !important;
    }

    .fixed-cols .mobile-actions-trigger {
        display: flex !important;
    }

    /* Aktions-Spalte nur so breit wie der ⋮-Button */
    .fixed-cols th:last-child,
    .fixed-cols td:last-child {
        width: 36px !important;
        padding: 4px 2px !important;
        overflow: hidden;
    }

    /* Namens-Spalte bekommt mehr Platz */
    .fixed-cols th:nth-child(2),
    .fixed-cols td:nth-child(2) {
        width: auto !important;
    }

    /* Stunden-Spalte kompakter */
    .fixed-cols th:nth-child(4),
    .fixed-cols td:nth-child(4) {
        width: 70px !important;
    }

    /* Selection-Bar (Aufgaben-Auswahl) auf Mobile */
    .selection-bar {
        bottom: 12px;
        width: calc(100% - 16px);
    }

    .selection-bar-inner {
        padding: 8px 10px;
        gap: 6px;
        font-size: 12px;
    }

    .selection-bar-inner .btn {
        font-size: 11px;
        padding: 5px 8px;
        white-space: nowrap;
    }

    .selection-bar-inner .btn .material-icons-round {
        font-size: 14px;
    }
}

/* ===== Mobile Actions Dropdown (Aufgaben-Tabelle) ===== */
.mobile-actions-trigger {
    display: none; /* Nur auf Mobile sichtbar via media query */
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    color: var(--gray-500);
    font-size: 20px;
}

.mobile-actions-trigger:hover,
.mobile-actions-trigger:active {
    background: var(--gray-100);
    color: var(--gray-700);
}

.mobile-actions-dropdown {
    display: none;
    position: fixed;
    z-index: 200;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    min-width: 180px;
    padding: 4px 0;
    overflow: hidden;
}

.mobile-actions-dropdown.show {
    display: block;
}

.mobile-actions-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    color: var(--gray-700);
    text-align: left;
}

.mobile-actions-dropdown button:hover,
.mobile-actions-dropdown button:active {
    background: var(--gray-50);
}

.mobile-actions-dropdown button .material-icons-round {
    font-size: 18px;
}

.mobile-actions-dropdown button.danger-action {
    color: var(--danger);
}

/* ===== Unbilled List (Dashboard) ===== */
.unbilled-list {
    padding: 0;
}

.unbilled-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.15s;
}

.unbilled-item:hover {
    background: var(--gray-50);
}

.unbilled-item:last-child {
    border-bottom: none;
}

/* ===== Scrollbar ===== */
.content::-webkit-scrollbar {
    width: 6px;
}

.content::-webkit-scrollbar-track {
    background: transparent;
}

.content::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.content::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===== Beschreibung Input in Timer ===== */
.timer-description {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.15);
    color: white;
    font-family: inherit;
    font-size: 14px;
    margin-top: 12px;
}

.timer-description::placeholder {
    color: rgba(255,255,255,0.6);
}

.timer-description:focus {
    outline: none;
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.2);
}

/* ===== Kunde Card in List ===== */
.kunden-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.kunde-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
}

.kunde-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

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

.kunde-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.kunde-card-info {
    font-size: 13px;
    color: var(--gray-500);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kunde-card-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.kunde-card-info .material-icons-round {
    font-size: 16px;
}

.kunde-card-stats {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}

.kunde-card-stat {
    font-size: 13px;
}

.kunde-card-stat .label {
    color: var(--gray-500);
}

.kunde-card-stat .value {
    font-weight: 600;
    color: var(--gray-800);
}

/* ===== Entries list ===== */
.entry-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    gap: 16px;
}

.entry-item:last-child {
    border-bottom: none;
}

.entry-date {
    font-size: 13px;
    color: var(--gray-500);
    min-width: 80px;
}

.entry-details {
    flex: 1;
    min-width: 0;
}

.entry-details .entry-path {
    font-size: 12px;
    color: var(--gray-400);
}

.entry-details .entry-desc {
    font-size: 14px;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-duration {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ===== Manual time entry ===== */
.manual-time-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

/* ===== Print Styles ===== */
@media print {
    body {
        overflow: visible;
        height: auto;
        background: white;
    }

    .app {
        display: block;
        height: auto;
    }

    .sidebar,
    .top-bar,
    .invoice-actions,
    .no-print,
    .modal-overlay {
        display: none !important;
    }

    .main-content {
        overflow: visible;
    }

    .content {
        overflow: visible;
        padding: 0;
    }

    @page {
        margin: 12mm 15mm 12mm 15mm;
    }

    /* ---- Invoice page structure ---- */
    .inv-page {
        page-break-after: always;
        min-height: calc(100vh - 24mm);
        display: flex;
        flex-direction: column;
        position: relative;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        background: white !important;
        max-width: 100% !important;
    }

    .inv-page:last-child {
        page-break-after: auto;
    }

    /* Remove screen-only separators */
    .inv-page + .inv-page {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }
    .inv-page + .inv-page::before {
        display: none;
    }

    .inv-page-content {
        flex: 1;
    }

    /* ---- Page header (shown on print) ---- */
    .inv-page-header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 0 0 6px 0;
        margin-bottom: 12px;
        border-bottom: 1.5px solid #444;
        font-size: 8pt;
        color: #555;
    }
    .inv-ph-left { flex: 1; }
    .inv-ph-right { text-align: right; white-space: nowrap; }

    /* ---- Page footer (shown on print) ---- */
    .inv-page-footer {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0 0 0;
        margin-top: 16px;
        border-top: 1px solid #ccc;
        font-size: 7.5pt;
        color: #999;
    }
    .inv-pf-left { flex: 1; }
    .inv-pf-right { text-align: right; white-space: nowrap; font-weight: 600; }

    /* ---- Draft watermark ---- */
    .inv-draft-watermark {
        display: block !important;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(-35deg);
        font-size: 80pt;
        font-weight: 900;
        color: rgba(229, 62, 62, 0.08);
        letter-spacing: 12px;
        pointer-events: none;
        z-index: 0;
        white-space: nowrap;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* ---- Standard print fixes ---- */
    .invoice-table th {
        background: var(--gray-200) !important;
        color: var(--gray-800) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .invoice-group-header td {
        background: #f3f4f6 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .receipt-card {
        break-inside: avoid;
        page-break-inside: avoid;
        page-break-before: auto;
    }

    .receipt-card img {
        max-width: 100% !important;
        max-height: 85vh !important;
        width: auto !important;
        object-fit: contain !important;
        display: block !important;
        visibility: visible !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .badge {
        border: 1px solid var(--gray-300);
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== Selection Bar (Floating) ===== */
.selection-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    animation: slideUp 0.25s ease-out;
    width: calc(100% - 32px);
    max-width: 700px;
}

.selection-bar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4), 0 2px 8px rgba(0,0,0,0.15);
    flex-wrap: wrap;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.aufgabe-checkbox:checked {
    accent-color: var(--primary);
}

tr:has(.aufgabe-checkbox:checked) {
    background: var(--primary-bg) !important;
}

.aufgabe-checkbox:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ===== Projekt Tabs ===== */
.projekt-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    padding: 0 16px;
    background: var(--gray-50);
    overflow-x: auto;
}

.projekt-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.projekt-tab .material-icons-round {
    font-size: 17px;
}

.projekt-tab:hover {
    color: var(--gray-700);
    background: rgba(99, 102, 241, 0.04);
}

.projekt-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-count {
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.projekt-tab.active .tab-count {
    background: var(--primary-bg);
    color: var(--primary);
}

.notiz-card:hover {
    border-color: var(--primary);
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.1);
}

.todo-item:hover {
    background: var(--gray-50);
}

.todo-item:last-child {
    border-bottom: none;
}

.dokument-card {
    transition: transform 0.15s, box-shadow 0.15s;
}

.dokument-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ===== Invoice Group Headers ===== */
.invoice-group-header td {
    background: var(--gray-50);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    padding: 10px 12px;
    border-bottom: 2px solid var(--gray-200);
}

.invoice-subtotal-row td {
    border-top: 1px dashed var(--gray-300);
}

/* ===== Kalender ===== */
.kalender-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 1200px) {
    .kalender-layout {
        grid-template-columns: 1fr 320px;
    }
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--gray-200);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}

.cal-header {
    background: var(--gray-50);
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
}

.cal-weekend-header {
    color: var(--gray-400);
}

.cal-cell {
    background: white;
    min-height: 90px;
    padding: 6px;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.cal-cell:hover {
    background: var(--gray-50);
}

.cal-empty {
    background: var(--gray-50);
    cursor: default;
}

.cal-today {
    background: #eff6ff !important;
}

.cal-today .cal-day-num {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-weekend {
    background: #fafafa;
}

.cal-day-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-event {
    padding: 2px 6px;
    margin-bottom: 2px;
    border-radius: 3px;
    font-size: 11px;
    line-height: 1.4;
    background: var(--gray-50);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    white-space: nowrap;
}

.cal-event:hover {
    background: var(--gray-100);
}

.cal-event-time {
    color: var(--gray-500);
    font-size: 10px;
    flex-shrink: 0;
}

.cal-event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.cal-event-highlight {
    animation: calHighlight 3s ease-out;
}

@keyframes calHighlight {
    0%, 30% {
        background: var(--primary-light, rgba(99, 102, 241, 0.2));
        box-shadow: 0 0 0 3px var(--primary);
        transform: scale(1.05);
    }
    100% {
        background: transparent;
        box-shadow: none;
        transform: scale(1);
    }
}

.cal-more {
    font-size: 10px;
    color: var(--primary);
    font-weight: 600;
    padding: 2px 6px;
    cursor: pointer;
}

.termin-list-item:hover {
    background: var(--gray-50);
}

@media (max-width: 900px) {
    .cal-cell {
        min-height: 60px;
        padding: 4px;
    }
    .cal-event {
        font-size: 10px;
    }
    .cal-day-num {
        font-size: 11px;
    }
}

/* ===== Calendar View Toggle ===== */
.cal-view-toggle {
    display: flex;
    gap: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}
.cal-view-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    background: white;
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.15s;
}
.cal-view-btn:hover {
    background: var(--gray-50);
}
.cal-view-btn.active {
    background: var(--primary);
    color: white;
}

/* ===== Drag & Drop ===== */
.cal-day.drag-over {
    background: var(--primary-bg, #eef2ff) !important;
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
}
.cal-event[draggable="true"] {
    cursor: grab;
}
.cal-event[draggable="true"]:active {
    cursor: grabbing;
    opacity: 0.7;
}

/* ===== Week View ===== */
.cal-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--gray-200);
    min-height: 400px;
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
}
.cal-week-day {
    background: white;
    padding: 8px;
    min-height: 200px;
}
.cal-week-day-header {
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.cal-week-day-num {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}
.cal-week-day.cal-today .cal-week-day-num {
    color: var(--primary);
}
.cal-week-day.cal-weekend {
    background: var(--gray-50);
}
.cal-week-day.drag-over {
    background: var(--primary-bg, #eef2ff) !important;
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
}

@media (max-width: 768px) {
    .cal-week-grid {
        grid-template-columns: 1fr;
    }
    .cal-week-day {
        min-height: auto;
        border-bottom: 1px solid var(--gray-200);
    }
}

/* ===== Day View ===== */
.cal-day-view {
    position: relative;
}
.cal-day-allday {
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.cal-day-timeline {
    position: relative;
}
.cal-day-hour {
    display: flex;
    min-height: 48px;
    border-bottom: 1px solid var(--gray-100);
}
.cal-day-hour-label {
    width: 50px;
    flex-shrink: 0;
    font-size: 11px;
    color: var(--gray-400);
    padding-top: 2px;
    text-align: right;
    padding-right: 8px;
}
.cal-day-hour-content {
    flex: 1;
    padding: 2px 8px;
    position: relative;
    cursor: pointer;
}
.cal-day-hour-content:hover {
    background: var(--gray-50);
}
.cal-day-hour-content.drag-over {
    background: var(--primary-bg, #eef2ff) !important;
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
}
.cal-day-event {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    font-size: 12px;
    cursor: pointer;
}
.cal-day-event:hover {
    filter: brightness(0.95);
}

/* ===== Expandable Time Entries ===== */
.aufgabe-row:hover {
    background: var(--gray-50);
}

.zeiteintraege-panel {
    overflow-x: hidden;
    overflow-y: auto;
    max-width: 100%;
}

.zeiteintraege-panel > div {
    max-width: 100%;
    overflow-x: hidden;
}

.zeiteintraege-row > td {
    max-width: 100%;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.zeiteintraege-panel table tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.zeiteintraege-panel table tr:last-child {
    border-bottom: none;
}

.zeiteintraege-panel .btn-icon {
    width: 28px;
    height: 28px;
}

.zeiteintraege-panel .btn-icon .material-icons-round {
    font-size: 16px;
}

.expand-icon {
    transition: transform 0.2s ease;
}

/* Blur-Modus fuer Geldbetraege */
.blur-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--gray-400);
    transition: all 0.2s;
    flex-shrink: 0;
}

.blur-toggle:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.blur-toggle.active {
    color: var(--danger);
    background: #fef2f2;
}

body.blur-money .money-amount {
    filter: blur(8px);
    user-select: none;
    transition: filter 0.2s;
}

body.blur-money .money-amount:hover {
    filter: blur(8px);
}

body.blur-money .stat-value {
    filter: blur(10px);
    user-select: none;
}

/* Login Screen */
.login-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s, visibility 0.3s;
}

.login-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    margin: 16px;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}

.login-logo .material-icons-round {
    font-size: 36px;
    color: var(--primary);
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.login-card .form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 10px;
}

.login-card .btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border-radius: 10px;
    margin-top: 8px;
}

.login-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.login-error.visible {
    display: block;
}

@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px;
    }
}

/* ===== Auswertung responsive ===== */
@media (max-width: 900px) {
    #auswertungContent > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}
