:root {
    --primary: #2563eb;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --danger: #ef4444;
    --danger-dark: #b91c1c;
    --success: #22c55e;
    --border: #cbd5e1;
    --item-height: 50px;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header h1 {
    margin-top: 5px;
    /* Stark reduziert (Standard ist oft ~20px oder mehr) */
    margin-bottom: 5px;
    /* Minimaler Abstand nach unten */
    font-size: 1.5rem;
    /* Optional: Etwas kleiner, damit der Header nicht so wuchtig ist */
    line-height: 1.2;
    /* Verhindert unnötige Höhe bei Zeilenumbrüchen */
}

/* Falls dein Header selbst auch noch Abstände hat: */
header {
    padding: 10px 0;
    /* Verringert den Innenabstand des gesamten Headers */
}

.card {
    background: var(--card-bg);
    padding: 12px 16px;
    /* Oben/Unten 12px, Rechts/Links 16px statt überall 20px */
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 12px;
    /* Weniger Abstand zur nächsten Karte */
}

.card h2 {
    margin-top: 0;
    margin-bottom: 10px;
    /* Kleiner, definierter Abstand nach unten */
    font-size: 1.1rem;
    /* Etwas dezenter */
    line-height: 1.2;
}

/* Formular Layout */
#finance-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

#finance-form input,
#finance-form select {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    flex: 1;
}

#add-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 15px;
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: var(--success);
    transition: width 0.4s;
}

#list-wrapper {
    height: 350px;           /* 5 Items à 70px */
    overflow: hidden;        /* Das Guckloch-Prinzip */
    position: relative;      /* Anker für die Liste */
    border: 1px solid #ebe3e3;  /* Damit du die Grenzen siehst */
    /* background: #1a1a1a;  */    /* Optional: Hintergrund für die Liste */
}

#custom-scrollbar {
    position: absolute;
    top: 5px;          /* Ein wenig Abstand zum Rand oben */
    bottom: 5px;       /* Ein wenig Abstand zum Rand unten */
    right: 4px;        /* Etwas Abstand von der rechten Kante */
    width: 6px;        /* Schön schmal */
    background: rgba(200, 200, 200, 0.2); /* Leichtes Hellgrau, transparent */
    border-radius: 10px;
    pointer-events: none; /* Verhindert, dass die Schiene Klicks abfängt */
}

/* Der bewegliche Balken */
#scroll-thumb {
    width: 100%;
    /* NEU: Eine Standard-Höhe, damit er beim Laden sofort da ist */
    height: 50px; 
    min-height: 20px;
    
    background: rgba(150, 150, 150, 0.6);
    border-radius: 10px;
    
    /* WICHTIG: Er muss sichtbar sein */
    display: block !important; 
    
    transition: transform 0.1s linear, height 0.2s ease;
}

/* Optional: Hover-Effekt, wenn man mit der Maus über den Wrapper geht */
#list-wrapper:hover #scroll-thumb {
    background: rgba(100, 100, 100, 0.8); /* Wird etwas dunkler beim Hover */
}

/* Liste & Transaktionen */
#transaction-list {
    /* Deine restlichen Styles (Padding, List-Style etc.) einfach so lassen */
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    will-change: transform;  /* Sagt dem Browser: "Achtung, das bewegt sich smooth!" */
}

/* Die Zeile: Alles in einer Reihe */
#transaction-list li {
    height: var(--item-height);
    display: flex;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 10px 15px !important;
    border-bottom: 1px solid #eee !important;
    box-sizing: border-box;  /* WICHTIG: Padding wird nicht zur Höhe addiert */
}

/* Datum und Beschreibung nebeneinander */
.transaction-date {
    display: inline-block !important;
    /* NICHT MEHR BLOCK */
    font-size: 0.85rem !important;
    color: #64748b !important;
    margin-right: 15px !important;
    /* ABSTAND ZUR BESCHREIBUNG */
    font-family: monospace;
    /* Sieht bei Daten sauberer aus */
}

/* Rechter Block: Betrag und Button */
.amount-display {
    margin-right: 20px !important;
    /* ABSTAND ZUM BUTTON */
    font-weight: bold !important;
    display: inline-block !important;
}

/* Farben für die Beträge */
.total-positive {
    color: #22c55e !important;
}

.total-negative {
    color: #ef4444 !important;
}

/* 1. Der Standard-Zustand (Blau) */
.delete-btn {
    background-color: #2563eb !important;
    color: #ffffff !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 0.85rem !important;

    /* WICHTIG: Kein fettgedruckter Text, damit die Breite gleich bleibt */
    font-weight: 500 !important;

    /* Fixe Mindestbreite, damit der Text "Sicher?" nicht mehr Platz braucht als "Löschen" */
    min-width: 80px !important;
    transition: background-color 0.2s ease !important;

    /* Verhindert das Zucken durch Layout-Sprünge */
    display: inline-block !important;
    text-align: center !important;
}

/* 2. Der Hover-Zustand */
.delete-btn:hover {
    background-color: #1d4ed8 !important;
}

/* 3. Der Warn-Zustand (Rot) - OHNE scale und OHNE extra bold */
.delete-btn.btn-danger {
    background-color: #ef4444 !important;
    color: white !important;

    /* Wir lassen font-weight und transform weg, damit nichts zuckt */
    transform: none !important;
}