:root {
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --primary: #2680af;
    --text: #1e293b;
    --text-light: #64748b;
    --light: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

body { 
    font-family: 'Inter', -apple-system, sans-serif; 
    background-color: var(--bg); 
    color: var(--text);
    margin: 0; 
    line-height: 1.5;
    padding-bottom: 40px;
}

/* HEADER & NAVIGATION (Logout rechts, Menu links) */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--primary);
    padding: 0;
    display: flex;
    align-items: center;
}

.logo {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--primary);
    cursor: pointer;
}

/* HAMBURGER MENÜ (SIDEBAR) */
.side-menu {
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100%;
    background: white;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    transition: 0.3s ease-in-out;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.side-menu.active {
    left: 0;
}

.menu-header {
    font-weight: 800;
    font-size: 1.2rem;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-header span {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-light);
}

.side-menu a {
    display: block;
    padding: 12px 15px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.side-menu a:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.side-menu hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

.menu-footer {
    position: absolute;
    bottom: 20px;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* LAYOUT */
.container { 
    max-width: 600px; 
    margin: 0 auto; 
    padding: 20px; 
}

.grid {
    display: grid;
    gap: 16px;
}

/* KARTEN-DESIGN */
.card { 
    background: var(--card-bg); 
    padding: 20px; 
    border-radius: var(--radius); 
    box-shadow: var(--shadow); 
    margin-bottom: 16px; 
    border: 1px solid #f1f5f9;
}

.shadow-none { box-shadow: none !important; }

h2 { font-size: 1.25rem; font-weight: 700; margin-top: 0; color: var(--text); }
h3 { font-size: 1rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 8px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-outline { background: white; color: var(--text); border: 1px solid #e2e8f0; }
.btn-ghost { background: #f1f5f9; color: var(--text-light); }
.btn-small { padding: 6px 12px; font-size: 12px; }

.btn-logout {
    background: #fee2e2;
    color: var(--danger);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.btn-logout:hover { background: #fecaca; }
.btn:active { transform: scale(0.96); }

.btn-link { 
    background: none; border: none; color: var(--primary); 
    cursor: pointer; padding: 0; font-size: 0.85rem; text-decoration: underline; 
}

/* FORMULARE */
input, select { 
    width: 100%; padding: 12px; margin: 8px 0 16px 0; 
    border: 1px solid #e2e8f0; border-radius: 10px; 
    background: #fdfdfd; font-size: 16px;
    box-sizing: border-box;
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
}

/* MODAL SYSTEM */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(4px);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
}

.modal-card {
    background: white !important;
    padding: 25px !important;
    border-radius: 16px !important;
    width: 90% !important;
    max-width: 500px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2) !important;
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions button { flex: 1; }

/* BADGES / TAGS */
.tag {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    display: inline-block;
}

/* ZÄHLER / HISTORIE */
.history-item {
    background: #f8fafc;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #eee;
}

.text-light { color: var(--text-light); }


.modal-card {
    position: relative; /* Wichtig für die absolute Positionierung des X */
    padding-top: 40px;   /* Platz schaffen für das X */
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--danger); /* Nutzt deine rote Variable bei Hover */
}

.modal-card {
    display: flex;
    flex-direction: column;
    max-height: 85vh !important; /* Etwas Platz lassen für Ränder */
    overflow: hidden !important;  /* Verhindert, dass die Karte selbst wächst */
}

.modal-form {
    flex: 1; 
    overflow-y: auto !important; /* Erzwingt das Scrollen innerhalb der Form */
    padding-right: 10px;
}

.reading-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-edit-small {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-edit-small:hover {
    background: #f1f5f9;
}