:root {
    --blue: #3b82f6;
    --blue-bright: #5b9dff;
    --bg: #08090c;
    --bg-elevated: #111318;
    --bg-elevated-2: #17191f;
    --text: #f2f3f5;
    --text-secondary: #8b8d94;
    --text-tertiary: #55575e;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);
    --green: #34d399;
    --red: #f87171;
    --radius: 16px;
    --radius-sm: 11px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

body {
    background-image:
        radial-gradient(560px circle at 18% -10%, rgba(59, 130, 246, 0.16), transparent 60%),
        radial-gradient(480px circle at 100% 0%, rgba(59, 130, 246, 0.08), transparent 55%);
    background-repeat: no-repeat;
    min-height: 100vh;
}

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

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 8px 20px 100px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px;
    max-width: 720px;
    margin: 0 auto;
}

.topbar .brand {
    font-weight: 650;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar .brand .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--blue-bright);
    box-shadow: 0 0 10px var(--blue-bright);
}

.topbar .brand b { color: var(--text); font-weight: 650; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.user-chip img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
}

.hero {
    text-align: center;
    padding: 110px 20px 90px;
    position: relative;
}

.hero h1 {
    font-size: 46px;
    font-weight: 680;
    letter-spacing: -0.035em;
    line-height: 1.08;
    margin: 0 0 14px;
    background: linear-gradient(180deg, #ffffff 20%, #b9c2d0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 17px;
    color: var(--text-secondary);
    margin: 0 0 36px;
    line-height: 1.5;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 980px;
    padding: 13px 24px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(.2,.8,.2,1), background 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.06) inset, 0 8px 24px -8px rgba(59, 130, 246, 0.55);
}

.btn:hover { background: var(--blue-bright); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn.secondary {
    background: var(--bg-elevated-2);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--border) inset;
}
.btn.secondary:hover { background: #1d2028; box-shadow: 0 0 0 1px var(--border-strong) inset; }

.btn.danger { background: rgba(248, 113, 113, 0.12); color: var(--red); box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.25) inset; }
.btn.danger:hover { background: rgba(248, 113, 113, 0.2); }

.btn.small { padding: 8px 15px; font-size: 13px; }

/* --- hero stat --- */
.hero-stat { text-align: center; padding: 44px 20px 8px; }

.hero-stat .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}

.hero-stat .amount {
    font-size: 58px;
    font-weight: 650;
    letter-spacing: -0.03em;
    line-height: 1;
}

.hero-stat .amount.positive { color: var(--green); }
.hero-stat .amount.negative { color: var(--red); }

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 28px 0 8px;
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 14px;
}

.stat-card .icon {
    width: 26px;
    height: 26px;
    color: var(--blue-bright);
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.stat-card .label {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 40px 0 14px;
}

.section-header h2 {
    font-size: 19px;
    font-weight: 640;
    letter-spacing: -0.02em;
    margin: 0;
}

.item-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: transform 0.15s cubic-bezier(.2,.8,.2,1), border-color 0.15s ease, background 0.15s ease;
    border-left: 2px solid transparent;
}

.item-card:hover { transform: translateY(-1px); border-color: var(--border-strong); background: var(--bg-elevated-2); }
.item-card.lager { border-left-color: var(--blue); }
.item-card.verkauft { border-left-color: var(--green); }

.item-main { flex: 1; min-width: 0; }

.item-name {
    font-weight: 600;
    font-size: 15.5px;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 980px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.01em;
}

.badge.lager { background: rgba(59, 130, 246, 0.14); color: var(--blue-bright); }
.badge.verkauft { background: rgba(52, 211, 153, 0.14); color: var(--green); }

.item-profit {
    font-weight: 650;
    font-size: 16px;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.item-profit.positive { color: var(--green); }
.item-profit.negative { color: var(--red); }

.item-actions { display: flex; gap: 8px; }

.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-secondary);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

.empty-state svg { width: 34px; height: 34px; color: var(--text-tertiary); margin-bottom: 14px; }

form.card-form {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 22px;
}

.field { margin-bottom: 18px; }

.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
    letter-spacing: -0.005em;
}

.field input, .field textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    font-size: 15.5px;
    font-family: inherit;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder, .field textarea::placeholder { color: var(--text-tertiary); }

.field input:focus, .field textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.error-banner {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
    color: var(--red);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 18px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

table.admin-table th, table.admin-table td {
    padding: 13px 16px;
    text-align: left;
    font-size: 13.5px;
    border-bottom: 1px solid var(--border);
}

table.admin-table th {
    color: var(--text-tertiary);
    font-weight: 650;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-elevated-2);
}

table.admin-table tr:last-child td { border-bottom: none; }
table.admin-table tr:hover td { background: var(--bg-elevated-2); }

@media (max-width: 640px) {
    .hero { padding: 80px 20px 60px; }
    .hero h1 { font-size: 32px; }
    .hero-stat .amount { font-size: 44px; }
    .stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .stat-card { padding: 12px 10px; }
    .stat-card .icon { width: 20px; height: 20px; margin-bottom: 6px; }
    .stat-card .value { font-size: 15px; }
    .stat-card .label { font-size: 10.5px; }
    .item-card { flex-direction: column; align-items: stretch; }
    .item-actions { justify-content: flex-end; }
    .field-row { grid-template-columns: 1fr; }
    table.admin-table { font-size: 12.5px; }
    table.admin-table th, table.admin-table td { padding: 10px; }
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f5f5f7;
        --bg-elevated: #ffffff;
        --bg-elevated-2: #fbfbfc;
        --text: #1d1d1f;
        --text-secondary: #6e6e73;
        --text-tertiary: #a1a1a6;
        --border: rgba(0, 0, 0, 0.07);
        --border-strong: rgba(0, 0, 0, 0.14);
    }
    body {
        background-image:
            radial-gradient(560px circle at 18% -10%, rgba(59, 130, 246, 0.08), transparent 60%),
            radial-gradient(480px circle at 100% 0%, rgba(59, 130, 246, 0.05), transparent 55%);
    }
    .hero h1 {
        background: linear-gradient(180deg, #1d1d1f 20%, #48484c 100%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    .item-card, .stat-card, form.card-form, table.admin-table {
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 20px -6px rgba(0, 0, 0, 0.06);
    }
    .field input, .field textarea { background: #f5f5f7; }
    .field input:focus, .field textarea:focus { background: white; }
}
