:root {
    --bg: #f4f6fb;
    --card-bg: #ffffff;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --success: #16a34a;
    --success-bg: #ecfdf5;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --info-bg: #eff6ff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(17, 24, 39, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

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

/* ---------- Angemeldet-als-Banner (wichtig bei gemeinsam genutzten PCs) ---------- */
.active-user-banner {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(90deg, #b91c1c, #dc2626);
    color: #fff;
    padding: 14px 24px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    border-bottom: 3px solid #7f1d1d;
}
.active-user-banner strong { font-size: 19px; font-weight: 800; }
.active-user-banner .banner-role {
    background: rgba(255,255,255,0.22);
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.active-user-banner a {
    color: #fff;
    font-weight: 700;
    margin-left: 6px;
    text-decoration: underline;
}
.active-user-banner a:hover { color: #fef2f2; }

.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #4f46e5 0%, #3730a3 100%);
    color: #fff;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
}
.sidebar h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px;
}
.sidebar .subtitle { font-size: 13px; opacity: 0.75; margin-bottom: 32px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar nav a {
    color: rgba(255,255,255,0.85);
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 14.5px;
    font-weight: 500;
    transition: background .15s;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: rgba(255,255,255,0.14);
    color: #fff;
}
.sidebar .user-box {
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 16px;
    font-size: 13px;
}
.sidebar .user-box strong { display: block; font-size: 14px; }
.sidebar .logout { display: inline-block; margin-top: 10px; font-size: 13px; color: #fff; opacity: 0.85; }

/* ---------- Main content ---------- */
.main {
    flex: 1;
    padding: 36px 44px;
    max-width: 1200px;
}
.page-header { margin-bottom: 28px; }
.page-header h2 { margin: 0 0 6px; font-size: 26px; font-weight: 700; }
.page-header p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ---------- Cards ---------- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px;
    margin-bottom: 24px;
}
.card h3 { margin-top: 0; font-size: 17px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Stat tiles ---------- */
.stat-tile {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
}
.stat-tile .label { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-tile .value { font-size: 30px; font-weight: 700; margin-top: 6px; }
.stat-tile .value.accent { color: var(--primary); }
.countdown-value { font-size: 26px; font-weight: 800; }
.countdown-minus { color: #b45309; }
.countdown-plus { color: var(--success); }
.progress-bar {
    margin-top: 12px;
    height: 10px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #6366f1);
    border-radius: 6px;
    transition: width .4s;
}

/* ---------- Forms ---------- */
label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: #374151; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 14.5px;
    background: #fff;
    color: var(--text);
    margin-bottom: 16px;
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}
input:disabled, select:disabled, textarea:disabled {
    background: #f3f4f6;
    color: var(--muted);
    cursor: not-allowed;
    border-color: var(--border);
}
.form-row { display: flex; gap: 16px; }
.form-row > * { flex: 1; }

button, .btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 9px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
button:hover, .btn:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: #f3f4f6; color: var(--text); }
.btn-secondary:hover { background: #e5e7eb; color: var(--text); }
.btn-danger { background: var(--error); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Tables ---------- */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafe; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--error-bg); color: var(--error); }
.alert-info { background: var(--info-bg); color: var(--primary-dark); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-employee { background: #dbeafe; color: #1d4ed8; }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: #f3f4f6; color: var(--muted); }
.badge-goal-reached { background: var(--success-bg); color: var(--success); }
.badge-goal-open { background: #fef3c7; color: #b45309; }

/* ---------- Auth pages (login etc.) ---------- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    padding: 20px;
}
.auth-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}
.auth-card h1 { margin: 0 0 6px; font-size: 22px; text-align:center; }
.auth-card p.subtitle { text-align:center; color: var(--muted); margin-bottom: 26px; font-size: 14px; }
.auth-card button { width: 100%; padding: 12px; margin-top: 6px; }
.auth-links { text-align: center; margin-top: 18px; font-size: 13.5px; }

/* ---------- Product picker (employee) ---------- */
.product-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: border-color .15s, transform .1s;
    background: #fff;
}
.product-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.product-card.selected { border-color: var(--primary); background: var(--primary-light); }
.product-card h4 { margin: 0 0 6px; font-size: 16px; }
.product-card .points { font-size: 13px; color: var(--primary-dark); font-weight: 700; }
.product-card p { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* ---------- Gruppierte Warenkorb-Buchungen ---------- */
.booking-group {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.booking-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border);
}
.booking-group-header .time { font-weight: 600; font-size: 14.5px; }
.booking-group-header .total { font-weight: 700; color: var(--primary-dark); }
.booking-group-badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.booking-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
}
.booking-group-item + .booking-group-item { border-top: 1px solid #f3f4f6; }
.booking-group-item .name { display: flex; align-items: center; gap: 8px; }
.booking-group-note {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    font-size: 13px;
    color: var(--muted);
}
.booking-group-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    display: flex;
    justify-content: flex-end;
}

/* ---------- Combobox / Such-Dropdown (Produktauswahl) ---------- */
.combobox-results {
    display: none;
    position: absolute;
    z-index: 20;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: -12px;
    max-height: 340px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(17,24,39,0.14);
}
.combobox-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.combobox-item:last-child { border-bottom: none; }
.combobox-item:hover { background: var(--primary-light); }
.combobox-item-name { font-size: 14px; font-weight: 600; color: var(--text); }
.combobox-item-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.combobox-empty { padding: 12px 14px; font-size: 13.5px; color: var(--muted); }

.text-muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
