/* ============================================================
   DESIGN TOKENS — einzige Stelle zum Anpassen
   ============================================================ */
:root {
    --accent:        #E8602C;
    --accent-soft:   #FDF0EB;
    --accent-hover:  #D4521F;
    --bg:            #F4F3F1;
    --surface:       #FAFAF9;
    --surface-2:     #EFEEED;
    --border:        #E5E3E0;
    --text:          #1A1917;
    --text-muted:    #7A7672;
    --text-light:    #B8B3AE;
    --sidebar-bg:    #1C1B19;
    --sidebar-w:     240px;
    --radius:        10px;
    --radius-sm:     7px;
    --transition:    140ms ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Outfit', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 0; }

.sidebar__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    margin-bottom: 6px;
}
.sidebar__logo-icon {
    width: 28px; height: 28px;
    background: var(--accent);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar__logo-text { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: -.01em; }

.nav-section { padding: 8px 10px 4px; }
.nav-section__label {
    font-size: 10px; font-weight: 600;
    color: rgba(255,255,255,.22);
    text-transform: uppercase; letter-spacing: .07em;
    padding: 0 8px 5px;
}
.nav-item {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px; border-radius: 7px;
    font-size: 13.5px; color: rgba(255,255,255,.42);
    transition: background var(--transition), color var(--transition);
    cursor: pointer; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.82); }
.nav-item.active { background: rgba(255,255,255,.1); color: #fff; font-weight: 500; }
.nav-item svg { flex-shrink: 0; }

.sidebar__spacer { flex: 1; }
.sidebar__footer { padding: 10px 10px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar__user {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px; border-radius: 7px;
    cursor: pointer; transition: background var(--transition);
}
.sidebar__user:hover { background: rgba(255,255,255,.05); }
.sidebar__avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar__user-name { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.82); }
.sidebar__user-role { font-size: 11px; color: rgba(255,255,255,.28); }

/* ---- Hauptbereich ---- */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
    height: 54px; background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 26px; gap: 12px; flex-shrink: 0;
}
.topbar__title { font-size: 15px; font-weight: 600; flex: 1; }
.topbar__search {
    display: flex; align-items: center; gap: 7px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 6px 12px;
    transition: border-color var(--transition);
}
.topbar__search:focus-within { border-color: var(--text-light); }
.topbar__search input { border: none; background: transparent; outline: none; font-size: 13px; color: var(--text); width: 160px; }
.topbar__search input::placeholder { color: var(--text-muted); }

.content { flex: 1; overflow-y: auto; padding: 26px; }
.content::-webkit-scrollbar { width: 5px; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============================================================
   KOMPONENTEN
   ============================================================ */

/* Page-Header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 14px; flex-wrap: wrap; }
.page-header__left h1 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.page-header__left p { color: var(--text-muted); font-size: 13.5px; margin-top: 3px; }
.page-header__actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.stat-card:hover { border-color: var(--text-light); box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.stat-card__label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .055em; margin-bottom: 6px; }
.stat-card__value { font-size: 27px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.stat-card__sub { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; display: flex; align-items: center; gap: 6px; }

.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; padding: 2px 6px; border-radius: 20px; }
.delta.up   { background: #EDFAF4; color: #079455; }
.delta.down { background: #FEF3F2; color: #D92D20; }
.delta.neutral { background: var(--surface-2); color: var(--text-muted); }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.card:last-child { margin-bottom: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); gap: 10px; }
.card__head h2 { font-size: 14px; font-weight: 600; }
.card__head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Tabelle */
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 11px 16px; font-size: 13.5px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
.empty-state { padding: 18px 16px; color: var(--text-muted); font-size: 13.5px; }

/* Badges */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.badge--green   { background: #EDFAF4; color: #079455; }
.badge--yellow  { background: #FFFAEB; color: #B54708; }
.badge--red     { background: #FEF3F2; color: #D92D20; }
.badge--blue    { background: #EFF8FF; color: #1570EF; }
.badge--gray    { background: var(--surface-2); color: var(--text-muted); }
.badge--accent  { background: var(--accent-soft); color: var(--accent); }
.badge--purple  { background: #F4F3FF; color: #6938EF; }
.badge--dark    { background: rgba(26,25,23,.08); color: var(--text-muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; transition: all var(--transition); white-space: nowrap; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--secondary:hover { background: var(--surface-2); }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--ghost { color: var(--text-muted); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--block { width: 100%; justify-content: center; }

/* Forms */
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.input, .select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    outline: none;
    font-size: 13.5px;
    color: var(--text);
    transition: border-color var(--transition), background var(--transition);
}
.input:focus, .select:focus { border-color: var(--text-light); background: var(--surface); }
.helper { font-size: 12.5px; color: var(--text-muted); text-align: center; }

/* Alerts */
.alert { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 13px; }
.alert--error { background: #FEF3F2; border-color: rgba(217,45,32,.25); color: #7A271A; }

/* Login */
.login-shell { height: calc(100vh - 54px - 46px); display: grid; place-items: center; padding: 26px; }
.login-card {
    width: min(420px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,.06);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.login-brand__icon { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.login-brand__title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.login-brand__sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); padding: 0 18px; background: var(--surface); overflow-x: auto; }
.tabs::-webkit-scrollbar { height: 0; }
.tab { font-size: 13px; font-weight: 500; color: var(--text-muted); padding: 10px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--transition), border-color var(--transition); white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab__count { display: inline-block; font-size: 10.5px; font-weight: 600; background: var(--surface-2); color: var(--text-muted); padding: 1px 5px; border-radius: 10px; margin-left: 5px; }
.tab.active .tab__count { background: var(--accent-soft); color: var(--accent); }

/* Checkbox */
.check { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border); appearance: none; -webkit-appearance: none; cursor: pointer; transition: all var(--transition); position: relative; flex-shrink: 0; }
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after { content: ''; position: absolute; left: 3px; top: 1px; width: 5px; height: 8px; border: 2px solid #fff; border-top: none; border-left: none; transform: rotate(45deg); }

/* Mitarbeiter-Sub-Tabelle */
.sub-table { background: var(--surface-2); }
.sub-table td { padding: 8px 16px 8px 32px; font-size: 13px; color: var(--text-muted); }

/* Produkt-Tags */
.tag-list { display: flex; gap: 4px; flex-wrap: wrap; }

/* Footer */
footer { padding: 12px 26px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-light); background: var(--surface); flex-shrink: 0; }

/* ============================================================
   RESPONSIV
   ============================================================ */
@media (max-width: 860px) { .sidebar { display: none; } }
@media (max-width: 520px) { .content { padding: 16px; } .stats-grid { grid-template-columns: 1fr 1fr; } }

/* ============================================================
   ANIMATION
   ============================================================ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.content > * { animation: fadeUp 180ms ease forwards; }
