:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #17202a;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #1f6feb;
    --primary-dark: #1859bd;
    --sidebar: #111827;
    --sidebar-text: #d1d5db;
    --danger: #b42318;
    --success: #087443;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }

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

.sidebar {
    width: 245px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    color: #fff;
}

.brand small {
    display: block;
    color: #9ca3af;
    margin-top: 3px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--primary);
    font-weight: 800;
}

.sidebar nav {
    padding: 8px 12px;
}

.sidebar nav a,
.sidebar-bottom a {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 11px 12px;
    border-radius: 8px;
    margin-bottom: 3px;
    color: var(--sidebar-text);
}

.sidebar nav a:hover,
.sidebar-bottom a:hover {
    background: #1f2937;
    color: #fff;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 12px;
}

.main {
    width: calc(100% - 245px);
    margin-left: 245px;
    min-width: 0;
    max-width: calc(100% - 245px);
}

.topbar {
    height: 68px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
}

.search-placeholder {
    color: var(--muted);
}

.user-menu {
    font-weight: 600;
}

.content {
    padding: 28px;
    width: 100%;
    max-width: none;
    min-width: 0;
}

.page-head {
    margin-bottom: 24px;
}

h1 {
    margin: 0 0 6px;
    font-size: 28px;
}

h2 {
    margin: 0;
    font-size: 19px;
}

.muted {
    color: var(--muted);
    margin: 0;
}

.cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: transform .12s ease, box-shadow .12s ease;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgba(0,0,0,.06);
}

.stat-card span {
    color: var(--muted);
    display: block;
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 30px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.panel-head {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.panel-head a {
    color: var(--primary);
    font-weight: 600;
}

.activity {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.activity:last-child {
    border-bottom: 0;
}

.activity small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.activity time {
    color: var(--muted);
    white-space: nowrap;
}

.empty {
    padding: 25px 20px;
    color: var(--muted);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #eef2f7;
}

.login-card {
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 30px;
    box-shadow: 0 15px 45px rgba(0,0,0,.08);
}

.login-brand {
    padding: 0 0 22px;
    color: var(--text);
}

.login-brand small {
    color: var(--muted);
}

.login-card h1 {
    font-size: 25px;
    margin-top: 8px;
}

label {
    display: block;
    margin: 17px 0 7px;
    font-weight: 600;
}

input, select, textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(31,111,235,.18);
    border-color: var(--primary);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 11px 15px;
    font-weight: 700;
    cursor: pointer;
}

.button.primary {
    background: var(--primary);
    color: #fff;
}

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

.full {
    width: 100%;
    margin-top: 22px;
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin: 16px 0;
}

.alert.error {
    background: #fef3f2;
    color: var(--danger);
    border: 1px solid #fecdca;
}

.alert.success {
    background: #ecfdf3;
    color: var(--success);
    border: 1px solid #abefc6;
}

@media (max-width: 1050px) {
    .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .sidebar {
        position: static;
        width: 100%;
    }

    .app { display: block; }
    .main { width: 100%; margin-left: 0; }
    .sidebar nav { display: grid; grid-template-columns: repeat(2, 1fr); }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
    .cards { grid-template-columns: 1fr; }
    .content { padding: 18px; }
}

/* Lager / Bestand */
.simple-table-wrap { width: 100%; overflow-x: auto; }
.simple-table { width: 100%; border-collapse: collapse; }
.simple-table th, .simple-table td { padding: 13px 20px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.simple-table th { color: var(--muted); font-size: 13px; font-weight: 700; background: #fafbfc; }
.simple-table tbody tr:last-child td { border-bottom: 0; }
.simple-table .stock-low { color: #d92d20; font-weight: 800; }
.inventory-filter { width: 100%; display: grid; grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) minmax(220px, 1.3fr) auto; gap: 10px; align-items: center; }
.inventory-filter input, .inventory-filter select { min-width: 0; }
.form-panel { padding: 20px; }
.form-panel form { max-width: 760px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.transfer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .inventory-filter { grid-template-columns: 1fr; } .transfer-grid { grid-template-columns: 1fr; } }
