/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #222633;
    --border: #2a2e3d;
    --text: #e4e6ed;
    --text-muted: #8b8fa3;
    --primary: #6c5ce7;
    --primary-hover: #7d6ff0;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e17055;
    --info: #74b9ff;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0,0,0,.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ── Header ──────────────────────────────────────────────────────────── */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}
header h1 {
    font-size: 1.4rem;
    margin-bottom: .75rem;
    background: linear-gradient(135deg, var(--primary), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
nav {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}
.nav-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: .4rem .85rem;
    border-radius: 999px;
    font-size: .82rem;
    cursor: pointer;
    transition: all .2s;
}
.nav-btn:hover { background: var(--surface-hover); color: var(--text); }
.nav-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ── Main ────────────────────────────────────────────────────────────── */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: .5rem; }
.tab-header h2 { font-size: 1.3rem; }

h2 { margin-bottom: 1rem; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
    padding: .5rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: .85rem;
    transition: all .15s;
}
.btn:hover { background: var(--surface-hover); }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: rgba(225,112,85,.15); }
.btn-success { color: var(--success); border-color: var(--success); background: transparent; }
.btn-success:hover { background: rgba(0,184,148,.15); }

/* ── Filter bar ──────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: .4rem; margin-bottom: 1rem; }
.filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .8rem;
    cursor: pointer;
    transition: all .2s;
}
.filter-btn:hover { background: var(--surface-hover); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Cards / List items ──────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: .6rem; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    transition: background .15s;
}
.card:hover { background: var(--surface-hover); }
.card-body { flex: 1; min-width: 0; }
.card-title { font-weight: 600; font-size: .95rem; margin-bottom: .25rem; }
.card-meta { font-size: .8rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: .3rem .8rem; }
.card-actions { display: flex; gap: .4rem; flex-shrink: 0; align-items: flex-start; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-zugesagt { background: rgba(0,184,148,.2); color: var(--success); }
.badge-abgesagt { background: rgba(225,112,85,.2); color: var(--danger); }
.badge-offen { background: rgba(253,203,110,.2); color: var(--warning); }
.badge-hoch { background: rgba(225,112,85,.2); color: var(--danger); }
.badge-normal { background: rgba(116,185,255,.2); color: var(--info); }
.badge-niedrig { background: rgba(139,143,163,.2); color: var(--text-muted); }
.badge-bought { background: rgba(0,184,148,.2); color: var(--success); }

.done-text { text-decoration: line-through; opacity: .5; }

/* ── Stats grid ──────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
}
.stat-card h3 { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.stat-number { font-size: 1.8rem; font-weight: 700; }
.stat-sub { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }
.stat-positive { color: var(--success); }
.stat-negative { color: var(--danger); }
.stat-warning { color: var(--warning); }

/* ── Progress bar ────────────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-top: .5rem;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width .3s;
}

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 200;
}
.modal-overlay.visible { display: block; }
.modal {
    display: none;
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    padding: 1.5rem;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 300;
    box-shadow: var(--shadow);
}
.modal.visible { display: block; }
.modal h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.modal label {
    display: block;
    font-size: .82rem;
    color: var(--text-muted);
    margin-bottom: .75rem;
}
.modal input, .modal select, .modal textarea {
    display: block;
    width: 100%;
    margin-top: .25rem;
    padding: .5rem .7rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: .9rem;
    font-family: inherit;
}
.modal input:focus, .modal select:focus, .modal textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1rem;
}

/* ── Settings form ───────────────────────────────────────────────────── */
.settings-form { max-width: 500px; }
.settings-form label {
    display: block;
    font-size: .82rem;
    color: var(--text-muted);
    margin-bottom: .75rem;
}
.settings-form input, .settings-form textarea {
    display: block;
    width: 100%;
    margin-top: .25rem;
    padding: .5rem .7rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: .9rem;
    font-family: inherit;
}
.settings-form input:focus, .settings-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.settings-form .btn { margin-top: .5rem; }

/* ── Shopping total ──────────────────────────────────────────────────── */
.shopping-total {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .8rem 1.2rem;
    margin-bottom: 1rem;
    font-size: .9rem;
    color: var(--text-muted);
}
.shopping-total strong { color: var(--text); }

/* ── Drinks / Food total bar ─────────────────────────────────────────── */
.total-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .8rem 1.2rem;
    margin-bottom: 1rem;
    font-size: .9rem;
    color: var(--text-muted);
}
.total-bar strong { color: var(--text); }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .header-inner { padding: .75rem 1rem; }
    main { padding: 1rem; }
    .card { flex-direction: column; }
    .card-actions { align-self: flex-end; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
