/* --- ADHELDEN AUDIT OS V6.0: MASTER STYLES (FINAL) --- */

:root {
    /* Brand Colors */
    --ah-bg: #F5F5F7;
    /* Apple Platinum Grey */
    --ah-surface: #FFFFFF;
    /* Pure White */
    --ah-text: #111111;
    /* Deep Black */
    --ah-sub: #86868B;
    /* Subtitle Grey */
    --ah-border: #E5E5E5;
    /* Subtle Border */
    --ah-accent: #FCDB00;
    /* Adhelden Yellow */
    --ah-success: #34C759;
    /* Success Green */
    --ah-error: #FF3B30;
    /* Error Red */

    /* Physics */
    --ah-ease: cubic-bezier(0.16, 1, 0.3, 1);

    /* Layout Dimensions */
    --card-padding: 50px;
}

/* GLOBAL RESET WITHIN APP */
.ah-app-shell,
.ah-app-shell * {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--ah-bg);
}

/* --- 1. APP SHELL --- */
.ah-app-shell {
    background-color: var(--ah-bg);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    color: var(--ah-text);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.ah-main-stage {
    flex: 1;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* --- 2. THE ROBUST LAYOUT GRID (MOBILE FIRST) --- */
/* Standard: Alles untereinander (sicher für alle Themes) */
.ah-console-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Eine Spalte */
    gap: 40px;
    width: 100%;
    max-width: 1300px;
    margin-top: 20px;
}

/* Mobile Order: Sidebar nach unten, Interface nach oben */
.ah-interface-col {
    order: 1;
    width: 100%;
}

.ah-sidebar-col {
    order: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- 3. INTERFACE CARD --- */
.ah-interface-card {
    background: var(--ah-surface);
    border-radius: 24px;
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Mobile: Flexible Höhe */
    height: auto;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    /* WICHTIG: Schneidet alles ab, was übersteht */
}

.ah-card-header {
    padding: 30px 20px 0 20px;
    /* Kleineres Padding mobil */
    flex-shrink: 0;
    background: var(--ah-surface);
    z-index: 20;
}

.ah-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    font-weight: 700;
    margin-bottom: 12px;
}

.ah-progress-track {
    width: 100%;
    height: 3px;
    background: #F0F0F0;
    border-radius: 2px;
    overflow: hidden;
}

.ah-progress-fill {
    height: 100%;
    width: 15%;
    background: var(--ah-text);
    transition: width 0.8s var(--ah-ease);
}

/* --- 4. VIEWPORT & SCROLLING ENGINE --- */
.ah-step-viewport {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 500px;
    /* Mindesthöhe für Content */
}

.ah-step {
    position: absolute;
    inset: 0;
    /* Füllt den Container komplett */
    padding: 30px 20px 60px 20px;
    /* Mobile Padding */

    opacity: 0;
    pointer-events: none;
    transform: translateX(30px);
    transition: all 0.5s var(--ah-ease);

    display: flex;
    flex-direction: column;

    /* Scrollt NUR innerhalb des Steps, nicht die ganze Seite */
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.ah-step.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
    z-index: 10;
}

/* Schöne Scrollbars */
.ah-step::-webkit-scrollbar {
    width: 6px;
}

.ah-step::-webkit-scrollbar-track {
    background: transparent;
}

.ah-step::-webkit-scrollbar-thumb {
    background: #EEE;
    border-radius: 10px;
}

.ah-step::-webkit-scrollbar-thumb:hover {
    background: #CCC;
}

/* --- 5. HEADER --- */
.ah-sys-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.ah-header-inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 15px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ah-brand-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ah-sys-logo {
    height: 20px;
    width: auto;
}

.ah-divider-vert {
    width: 1px;
    height: 24px;
    background: #E5E5E5;
}

.ah-context-title {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.main-title {
    font-size: 14px;
    font-weight: 700;
    color: #111;
}

.sub-status {
    font-size: 11px;
    color: #888;
    font-family: monospace;
}

.ah-trust-center {
    display: none;
    /* Mobil ausblenden für Platz */
    align-items: center;
    gap: 8px;
    background: #FAFAFA;
    border: 1px solid #E5E5E5;
    padding: 7px 14px;
    border-radius: 50px;
}

.secure-dot {
    width: 6px;
    height: 6px;
    background: var(--ah-success);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(52, 199, 89, 0.4);
}

.trust-text {
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

.ah-control-btn {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.ah-control-btn:hover {
    background: #F5F5F7;
    color: #000;
}

.header-progress-line {
    height: 2px;
    width: 0%;
    background: var(--ah-accent);
    transition: width 0.8s var(--ah-ease);
    position: absolute;
    bottom: 0;
    left: 0;
}

/* --- 6. SIDEBAR BOXES --- */
.ah-sidebar-box {
    background: #FFF;
    border: 1px solid #E5E5E5;
    border-radius: 20px;
    padding: 25px;
}

.ah-sidebar-box.support {
    border-top: 3px solid var(--ah-success);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
}

.sb-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.live-indicator {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ah-success);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot-pulse {
    width: 6px;
    height: 6px;
    background: var(--ah-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.sb-agent-profile {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 15px;
}

.sb-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #EEE;
}

.sb-agent-meta .name {
    font-weight: 700;
    font-size: 13px;
    color: #111;
    display: block;
}

.sb-agent-meta .role {
    font-size: 11px;
    color: #888;
}

.sb-chat-bubble {
    background: #F9F9F9;
    padding: 14px;
    border-radius: 12px;
    border-top-left-radius: 2px;
    font-size: 12px;
    color: #555;
    line-height: 1.5;
    font-style: italic;
    margin-bottom: 15px;
    position: relative;
}

.sb-chat-bubble::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 15px;
    border-width: 0 5px 5px;
    border-style: solid;
    border-color: transparent transparent #F9F9F9;
}

.sb-action-link {
    display: block;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #111;
    text-decoration: none;
    border: 1px solid #E5E5E5;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.sb-action-link:hover {
    background: #F5F5F5;
}

.sb-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    color: #BBB;
    margin-bottom: 12px;
    display: block;
}

.sb-logos {
    display: flex;
    gap: 15px;
    opacity: 0.6;
    filter: grayscale(1);
    align-items: center;
}

/* --- 7. FOOTER --- */
.ah-sys-footer {
    background: #FFF;
    border-top: 1px solid #EAEAEA;
    margin-top: auto;
    padding: 0 20px;
}

.ah-footer-inner {
    max-width: 1300px;
    margin: 0 auto;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: #888;
}

.af-col {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sys-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: monospace;
    letter-spacing: -0.3px;
}

.status-led {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    opacity: 0.5;
}

/* CRISP OVERRIDE */
.crisp-client .cc-tns {
    display: none !important;
}

.crisp-client [data-type="launcher"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* --- 8. DESKTOP / LARGE TABLET OVERRIDES (THE FIX) --- */
@media (min-width: 900px) {

    /* Grid schaltet auf 2 Spalten um */
    .ah-console-grid {
        /* minmax(0, 1fr) ist der Schlüssel: Verhindert, dass breiter Inhalt die Spalte aufbläht */
        grid-template-columns: minmax(0, 1fr) 340px !important;
        gap: 30px;
        align-items: start;
        /* Sidebar wird nicht gestreckt */
    }

    /* Sidebar springt nach rechts */
    .ah-sidebar-col {
        order: 2;
        width: 340px !important;
        /* Fixe Breite erzwingen */
        min-width: 340px !important;
    }

    /* Interface Card für Desktop optimieren */
    .ah-interface-card {
        height: 850px;
        /* Fixe Höhe für App-Feeling */
        min-height: 850px;
    }

    .ah-card-header {
        padding: 40px 50px 0 50px;
    }

    .ah-step {
        padding: 40px var(--card-padding) 60px var(--card-padding);
    }

    .ah-header-inner {
        padding: 0 20px;
    }

    /* Trust Center wieder einblenden */
    .ah-trust-center {
        display: flex;
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 1;
    }
}

/* FORCE CHAT VISIBILITY WHEN OPENED */
.crisp-client .cc-tns {
    display: none !important;
}

/* Hide Bubble */
.crisp-client.crisp-client-open .cc-kv6T {
    /* Interne Crisp Klasse für Fenster */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fallback: Make sure chat box is on top */
.crisp-client {
    z-index: 9999 !important;
}