:root {
    --bg-color: #0B1722;
    --card-bg: #152233;
    --text-main: #ffffff;
    --text-muted: #94A3B8;
    --accent: #FF8700; 
    --accent-dark: #cc6c00;
    --danger: #EF4444;
    --success: #10B981;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --radius: 12px;
}

/* Globale Helfer */
.hidden { display: none !important; }
.filter-row.hidden { display: none !important; }

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* HEADER */
header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 50;
    flex-shrink: 0;
}

.logo {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

.pro-badge {
    color: var(--accent);
    margin-left: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}
.user-info span { color: var(--accent); }

.status-indicator {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.status-indicator.online { color: var(--success); border: 1px solid var(--success); }
.status-indicator.offline { color: var(--danger); border: 1px solid var(--danger); }

/* MAIN CONTENT */
main {
    flex: 1;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
    padding-bottom: 40px;
}

/* Views & Animation */
.view-section { animation: slideUp 0.3s ease-out; }

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

/* PAGE HEADERS */
.page-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.page-title {
    font-size: 1.4rem;
    color: var(--text-main);
    margin: 0;
    font-weight: 700;
    white-space: nowrap; 
}

.btn-back {
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px 16px;     
    border-radius: 20px;   
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;           
    height: auto;
    transition: background 0.2s;
    font-weight: 600;
}
.btn-back:active { background: var(--accent); color: #000; }

/* DASHBOARD TILES */
.dashboard-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 30px;
}

.nav-tile {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 15px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.2s;
    color: var(--text-muted);
}
.nav-tile:active { transform: scale(0.95); background: rgba(255,255,255,0.05); }

.tile-icon { font-size: 1.8rem; margin-bottom: 8px; }
.tile-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }

/* DASHBOARD CARD */
.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.05);
}

.status-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 20px;
    font-weight: 600;
}

.location-wrapper {
    min-height: 100px; 
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.location-display {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.3;
    margin-bottom: 10px;
}

/* ACCORDION (Kontakte) */
.contact-display { width: 100%; margin-top: 5px; }

.contact-trigger {
    background: rgba(255,255,255,0.05);
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}
.contact-trigger:active { background: rgba(255,255,255,0.1); }
.contact-trigger .arrow { font-size: 0.7em; color: var(--text-muted); transition: transform 0.3s; }
.contact-trigger.open .arrow { transform: rotate(180deg); color: var(--accent); }

.contact-details {
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out, opacity 0.3s; opacity: 0;
    margin-top: 15px; width: 100%;
}
.contact-details.open { max-height: 200px; opacity: 1; }

.contact-grid { display: flex; gap: 15px; }
.contact-btn {
    flex: 1;
    background: #0B1722;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 15px;
    text-decoration: none;
    color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.contact-btn:active { border-color: var(--accent); color: #fff; transform: translateY(2px); }
.contact-icon { font-size: 1.4rem; }

.timer-display {
    font-family: 'Courier New', monospace;
    font-size: 3.5rem;
    font-weight: 700;
    color: #fff;
    margin: 10px 0 30px 0;
    text-shadow: 0 0 20px rgba(255, 135, 0, 0.1);
}

.note-display {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #cbd5e1;
    background: rgba(255,255,255,0.05);
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
    display: inline-block;
}

/* BUTTONS */
.btn-3d {
    width: 100%;
    padding: 18px;
    font-size: 1rem;
    font-weight: 800;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex; justify-content: center; align-items: center; gap: 10px;
    transition: transform 0.1s, box-shadow 0.1s;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, #FF8700 0%, #e67e00 100%);
    color: #fff;
    box-shadow: 0 6px 0 #9f5700, 0 15px 20px rgba(0,0,0,0.4);
}
.btn-primary:active { transform: translateY(6px); box-shadow: 0 0 0 #9f5700; }

.btn-primary.checkout-mode {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    box-shadow: 0 6px 0 #991B1B, 0 15px 20px rgba(0,0,0,0.4);
}
.btn-primary.checkout-mode:active { box-shadow: 0 0 0 #991B1B; }

.btn-secondary {
    background-color: #1E293B;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 0 #0F172A;
}
.btn-secondary:active { transform: translateY(4px); box-shadow: 0 0 0 #0F172A; }

/* GHOST / OUTLINE BUTTON */
.btn-outline-primary {
    background: transparent;
    color: var(--accent);
    border: 3px solid var(--accent); 
    border-radius: 14px;
    padding: 15px;
    font-weight: 800;
    text-transform: uppercase;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    display: flex; justify-content: center; align-items: center; gap: 10px;
}
.btn-outline-primary:active {
    background: rgba(255, 135, 0, 0.15);
    transform: scale(0.98);
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.hint-text { margin-top: 20px; font-size: 0.8rem; color: var(--text-muted); opacity: 0.7; }

/* MODERN DROPDOWNS (SEGMENTED CONTROLS) */
.filter-card {
    background: rgba(0,0,0,0.2);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
}

.filter-row { margin-bottom: 15px; }
.filter-row:last-child { margin-bottom: 0; }

.filter-row label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Wippen-Container */
.segmented-control {
    display: flex;
    background: #081018; 
    border-radius: 12px;
    padding: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: opacity 0.3s;
}

.segmented-control.disabled {
    opacity: 0.4;
    pointer-events: none; 
}

/* Die einzelnen Buttons in der Wippe */
.segment-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 0;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.segment-btn:active { transform: scale(0.98); }

.segment-btn.active {
    background: var(--card-bg); 
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.05);
}

/* TABS - VERBESSERT */
.protocol-tabs {
    background: #081018;
    padding: 5px;
    border-radius: 14px;
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
}

.proto-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 0;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

/* Aktiver Tab: Dunkler Hintergrund + Orange Schrift */
.proto-tab.active {
    background: var(--card-bg);
    color: var(--accent); /* HIER WAR VORHER WEISS */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* HISTORY LIST & GROUPS */
.history-section h3 {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.history-list, .protocol-list { list-style: none; }

.history-item {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--text-muted);
    transition: transform 0.1s;
}
.history-item:active { transform: scale(0.98); background: #1a2b40; }

.history-info div:first-child { font-weight: 700; color: #fff; margin-bottom: 4px; }
.history-info div:last-child { font-size: 0.8rem; color: var(--text-muted); }
.history-time { font-family: monospace; font-size: 1.1rem; font-weight: 700; color: #fff; text-align: right; }

/* GROUP HEADER */
.group-container { margin-bottom: 15px; }

.group-header {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--accent);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.05);
    border-left-width: 4px; 
}
.group-header:active { background: rgba(255,255,255,0.08); }

.group-title { font-weight: 700; color: #fff; font-size: 1rem; }
.group-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; display: flex; gap: 10px;}

.group-arrow { margin-right: 12px; color: var(--text-muted); font-size: 0.8rem; transition: transform 0.3s; }
.group-header.open .group-arrow { transform: rotate(90deg); color: var(--accent); }

.group-export-btn {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--accent);
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}
.group-export-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }
.group-export-btn:active { transform: scale(0.9); }

.group-content {
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), opacity 0.3s;
    margin-left: 10px; border-left: 2px solid rgba(255,255,255,0.05);
}
.group-content.open { max-height: 2000px; opacity: 1; transition: max-height 0.4s ease-in-out, opacity 0.3s; margin-top: 10px; }

/* FOOTER */
.export-footer {
    margin-top: 40px;
    background: #0F1824;
    padding: 25px;
    border-radius: 20px;
    border: 1px solid rgba(255,135,0,0.2);
}

.summary-box { margin-bottom: 20px; }
.sum-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 1rem; color: #cbd5e1; }
.sum-row strong { color: var(--accent); font-family: monospace; font-size: 1.2rem; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); font-style: italic; }

/* MODALS */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
}
.modal.hidden { display: none; }

.modal-content {
    background: var(--card-bg);
    width: 90%; max-width: 400px;
    padding: 25px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.modal-content h3 { color: var(--accent); margin-bottom: 5px; }
.modal-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }

/* INPUTS */
input, textarea {
    width: 100%;
    background: #081018;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 15px;
    outline: none;
    transition: border-color 0.2s;
}
input:focus, textarea:focus { border-color: var(--accent); }

.input-label { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; display: block; font-weight: 700; }
.input-row { display: flex; gap: 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; align-items: center; }

.btn-flat { background: none; border: none; color: var(--text-muted); padding: 10px; cursor: pointer; font-size: 0.9rem; }
.btn-flat:hover { color: #fff; }



/* TOAST */
.toast {
    position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
    background: #fff; color: #000;
    padding: 12px 24px; border-radius: 30px;
    font-weight: 600; box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 2000; transition: all 0.3s;
    white-space: nowrap;
}
.toast.hidden { transform: translate(-50%, 50px); opacity: 0; pointer-events: none; }

/* --- FIX: NOT-STOPP MODAL HÖHER SETZEN --- */
/* Dies sorgt dafür, dass das Modal bei offener Tastatur oben bleibt */

#delete-security-modal {
    /* Falls du Flexbox zum Zentrieren nutzt: */
    align-items: flex-start !important; 
    padding-top: 10vh !important; /* Nur 10% Abstand von oben statt Mitte */
}

/* Wir zwingen die innere Karte (Card) nach oben */
#delete-security-modal > div, 
#delete-security-modal .card {
    /* Falls absolute Positionierung genutzt wird: */
    top: 10% !important;       /* Fest auf 10% von oben nageln */
    bottom: auto !important;   /* Unten loslassen */
    transform: translateX(-50%) !important; /* Nur horizontal zentrieren, nicht vertikal */
    
    /* Sicherheitshalber Margin entfernen, falls vorhanden */
    margin-top: 0 !important;
}

/* --- VERSION 34 (CSS ACTIVE COLOR) --- */