*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a2e;
    background: #f5f6fa;
    min-height: 100vh;
}

/* Navigation */
nav {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
}

nav .logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
nav .logo img { height: 22px; display: block; }
nav .logo .logo-sub { font-weight: 600; color: #94a3b8; font-size: 13px; border-left: 1px solid #e2e8f0; padding-left: 9px; }

nav .nav-links { display: flex; gap: 2px; }

nav a {
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #64748b;
    font-weight: 500;
    transition: background .15s, color .15s;
}
nav a:hover  { background: #f1f5f9; color: #1a1a2e; }
nav a.active { background: #eff6ff; color: #2563eb; }

nav .user-info { color: #64748b; font-size: 13px; display: flex; align-items: center; gap: 12px; }
nav .user-info a { color: #94a3b8; padding: 0; background: none; font-weight: 400; }
nav .user-info a:hover { color: #64748b; background: none; }

/* Layout */
main { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* Cards */
.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

.card h2 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1a1a2e;
}

/* Formulare */
.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 12px;
}

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.grow { flex: 1; min-width: 140px; }
.form-group.small { width: 130px; }

label {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .03em;
}

input[type=text], input[type=email], input[type=password],
input[type=date], input[type=number], select, textarea {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 14px;
    font-family: inherit;
    color: #1a1a2e;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

/* Buttons */
.btn {
    padding: 7px 16px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background .15s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.5;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #f1f5f9; color: #374151; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: none; border: 1px solid #dde1e7; border-radius: 4px; color: #94a3b8; font-size: 15px; cursor: pointer; width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-danger:hover { border-color: #ef4444; color: #ef4444; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 0 8px 10px 0;
    border-bottom: 1px solid #e2e8f0;
}
td {
    padding: 9px 8px 9px 0;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
    vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
.td-right { text-align: right; padding-right: 0; }
.td-actions { text-align: right; white-space: nowrap; padding-right: 0; vertical-align: middle; }
.td-actions form { display: inline-flex; }
.text-muted { color: #94a3b8; }
.text-strong { font-weight: 600; color: #1a1a2e; }
.text-right { text-align: right; }

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: 13px;
}
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #16a34a; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid #e2e8f0; margin-bottom: 20px; }
.tab {
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: inherit;
    transition: color .15s;
}
.tab:hover  { color: #1a1a2e; }
.tab.active { color: #2563eb; border-bottom-color: #2563eb; }
.tab-panel  { display: none; }
.tab-panel.active { display: block; }

/* Heute-Zusammenfassung */
.summary-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 14px;
    margin-bottom: 4px;
    border-bottom: 1px solid #e2e8f0;
}
.summary-total { font-weight: 700; font-size: 16px; color: #2563eb; }

/* Login */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f6fa;
}
.login-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 36px 32px;
    width: 100%;
    max-width: 360px;
}
.login-box h1 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-box .sub { color: #64748b; margin-bottom: 24px; font-size: 13px; }
.login-box .form-group { margin-bottom: 14px; }

/* Auswertung Druckkopf */
.print-header { display: none; }

/* Gruppen-Header in Auswertung */
.group-customer {
    background: #1e293b;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}
.group-project {
    background: #f8fafc;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    border-left: 3px solid #3b82f6;
    border-bottom: 1px solid #e2e8f0;
}
.group-task-header {
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #f1f5f9;
}
.group-entries table { margin: 0; }
.group-entries td { padding-left: 16px; }
.group-wrap { border: 1px solid #e2e8f0; border-radius: 6px; overflow: hidden; margin-bottom: 20px; }

/* Gesamtsumme */
.total-bar {
    background: #1e293b;
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 15px;
    margin-top: 8px;
}

/* Stats-Karten */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
}
.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.1;
}
.stat-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

/* Übersicht-Karte im Filterergebnis */
.summary-stats {
    display: flex;
    gap: 0;
}
.summary-stat {
    flex: 1;
    padding: 4px 20px 4px 0;
    border-right: 1px solid #e2e8f0;
    margin-right: 20px;
}
.summary-stat:last-child {
    border-right: none;
    margin-right: 0;
}
.summary-stat--wide {
    flex: 2;
}

/* Diagramme */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
}
.chart-card h3 {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 14px;
}

/* Print */
@media print {
    nav, .no-print { display: none !important; }
    body { background: #fff; font-size: 12px; }
    main { padding: 0; max-width: 100%; }
    .card { border: none; padding: 0; }
    .print-header { display: block; margin-bottom: 20px; }
    .print-header h1 { font-size: 18px; }
    .group-customer { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; }
    .total-bar { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; }
}

/* Stempeluhr */
.stamp-wrap { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; background: #f3f4f6; }
.stamp-box { background: #fff; border-radius: 20px; box-shadow: 0 10px 30px rgba(15,23,42,.07), 0 1px 3px rgba(15,23,42,.06); padding: 36px 32px; width: 100%; max-width: 440px; }
.stamp-head { text-align: center; margin-bottom: 22px; }
.stamp-hi { display: block; font-size: 19px; font-weight: 700; color: #111827; }
.stamp-state { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 14px; font-weight: 600; padding: 6px 14px; border-radius: 999px; }
.stamp-state svg { width: 13px; height: 13px; flex-shrink: 0; }
.stamp-state.in  { background: #f0fdf4; color: #16a34a; }
.stamp-state.out { background: #f1f5f9; color: #64748b; }
.stamp-btn { width: 100%; border: none; border-radius: 16px; padding: 22px; font-size: 22px; font-weight: 800; letter-spacing: -.2px; color: #fff; cursor: pointer; transition: background .15s, transform .15s, box-shadow .15s; }
.stamp-in  { background: #16a34a; box-shadow: 0 8px 20px rgba(22,163,74,.28); } .stamp-in:hover  { background: #15803d; transform: translateY(-1px); }
.stamp-out { background: #dc2626; box-shadow: 0 8px 20px rgba(220,38,38,.28); } .stamp-out:hover { background: #b91c1c; transform: translateY(-1px); }

.stamp-qr { text-align: center; margin-top: 30px; padding-top: 26px; border-top: 1px solid #eef2f6; }
.stamp-qr-label { font-weight: 700; color: #111827; font-size: 15px; margin: 0 0 16px; }
.stamp-qr-label span { display: block; font-weight: 400; color: #9ca3af; font-size: 13px; margin-top: 4px; }
.stamp-qr-frame { display: inline-flex; padding: 16px; background: #fff; border: 1px solid #e8edf3; border-radius: 18px; box-shadow: 0 6px 18px rgba(15,23,42,.06); }
#qrcode { display: flex; align-items: center; justify-content: center; }
#qrcode img, #qrcode canvas { display: block; border-radius: 8px; }
.stamp-print { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; }
.stamp-print svg { width: 17px; height: 17px; }

/* Anwesenheits-Board */
.att-live { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 26px; }
.att-chip { display: inline-flex; align-items: center; gap: 8px; background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; }
.att-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: #16a34a; }
.att-none { color: #94a3b8; }

@media print {
    .stamp-wrap { padding: 0; } .stamp-box { box-shadow: none; max-width: none; }
    .stamp-btn, .alert, .stamp-qr button, .stamp-qr-label span, .stamp-box > p, .stamp-state { display: none !important; }
    .stamp-qr { border: none; margin-top: 8px; }
}
