/* ======================================== */
/* RESET & GLOBAL */
/* ======================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s ease, color 0.3s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ======================================== */
/* THEME VARIABLES */
/* ======================================== */

:root {
    --bg: #f3f4f8;
    --bg-alt: #ffffff;
    --text: #1f1f1f;
    --text-light: #666;
    --border: rgba(0,0,0,0.08);

    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;

    --shadow-soft: 0 10px 30px rgba(0,0,0,0.08);
    --shadow-strong: 0 20px 45px rgba(0,0,0,0.12);
}

body.theme-dark {
    --bg: #17171f;
    --bg-alt: #1e1f26;
    --text: #f0f0f0;
    --text-light: #b0b0b0;
    --border: rgba(255,255,255,0.08);

    --card-bg: #1e1f26;
    --sidebar-bg: #1d1e26;

    --shadow-soft: 0 10px 30px rgba(0,0,0,0.5);
    --shadow-strong: 0 20px 45px rgba(0,0,0,0.65);
}

/* ========================================= */
/*           PXnet TOPBAR (PURPLE)           */
/* ========================================= */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1.2rem;
    height: 62px;

    background: linear-gradient(
        135deg,
        #0d021f,
        #160430,
        #2a0a63,
        #6b2fe8
    );
    background-size: 300% 300%;
    animation: topbarGrad 12s ease infinite;

    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    position: sticky;
    top: 0;
    z-index: 50;
}

@keyframes topbarGrad {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.topbar h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
    margin: 0;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.8rem;
    padding: 0 0.5rem;
    cursor: pointer;
    display: none;
}

.mobile-menu-btn i {
    transition: 0.2s;
}

.mobile-menu-btn:hover i {
    transform: scale(1.15);
    color: #c084fc;
}

/* Theme Switcher */
.theme-switcher a {
    font-size: 1.6rem;
    color: #ffffff;
    display: flex;
    padding: 0.3rem 0.4rem;
    border-radius: 10px;
    transition: 0.25s ease;
}

.theme-switcher a:hover {
    background: rgba(255,255,255,0.12);
    transform: scale(1.12);
    box-shadow: 0 0 12px rgba(163,94,255,0.4);
}

.user-badge {
    background: rgba(255,255,255,0.15);
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #ffffff;
}

/* ======================================== */
/* SIDEBAR */
/* ======================================== */

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    min-height: 100vh;
    padding: 1.5rem 1.2rem;
    position: relative;
    box-shadow: var(--shadow-soft);
    transition: background 0.3s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.3rem;
    font-weight: 600;
    padding-bottom: 1.6rem;
}

.sidebar-nav .nav-item {
    padding: 0.85rem 1rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-size: 0.96rem;
    opacity: 0.8;
    transition: 0.22s ease;
}

.sidebar-nav .nav-item:hover {
    background: rgba(125, 125, 255, 0.12);
    transform: translateX(4px);
    opacity: 1;
}

.sidebar-backdrop {
    display: none;
}

/* ======================================== */
/* LAYOUT */
/* ======================================== */

.layout {
    display: flex;
}

.main {
    flex: 1;
    padding: 2rem 2.4rem;
}

.content {
    max-width: 1200px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ======================================== */
/* BUTTONS */
/* ======================================== */

.btn {
    display: inline-block;
    cursor: pointer;
    border: none;
}

.btn.small {
    padding: 0.45rem 0.8rem;
    border-radius: 10px;
    background: #6c5ce7;
    color: #fff;
    font-size: 0.8rem;
    transition: 0.2s;
}

.btn.small:hover {
    background: #5a4bd4;
}

.btn.small.danger {
    background: rgba(255,70,70,0.25);
    color: #ff4d4d;
    border-radius: 8px;
}

.btn.small.danger:hover {
    background: rgba(255,70,70,0.35);
    color: #ffffff;
}

.btn.primary {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    color: #fff;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35);
    transition: all 0.25s ease;
}

.btn.primary:hover {
    background: linear-gradient(135deg, #c084fc, #8b5cf6);
    box-shadow: 0 10px 28px rgba(139, 92, 246, 0.45);
    transform: translateY(-2px);
}

.btn.primary:active {
    transform: translateY(0px);
    box-shadow: 0 5px 14px rgba(124, 58, 237, 0.25);
}

/* ======================================== */
/* AUTH PAGES */
/* ======================================== */

.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-strong);
    backdrop-filter: blur(18px);
}

.auth-card h1 {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 0.9rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.alert.error {
    background: rgba(255, 80, 80, 0.18);
    border: 1px solid rgba(255, 80, 80, 0.6);
}

.alert.success {
    background: rgba(80, 255, 140, 0.18);
    border: 1px solid rgba(80, 255, 140, 0.6);
}

/* ======================================== */
/* FORM STYLING – Purple UI */
/* ======================================== */

.form {
    max-width: 600px;
    background: rgba(255,255,255,0.08);
    padding: 1.6rem;
    border-radius: 18px;
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.1);
    margin-top: 1rem;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.15);
    color: var(--text);
    font-size: 1rem;
    transition: 0.25s;
}

body.theme-light .form-group input,
body.theme-light .form-group select,
body.theme-light .form-group textarea {
    background: #ffffff;
    border: 1.4px solid rgba(0,0,0,0.18);
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    color: #1f1f1f;
}

body.theme-light .form-group input:focus,
body.theme-light .form-group select:focus,
body.theme-light .form-group textarea:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139,92,246,0.25);
    background: #ffffff;
    outline: none;
}

/* Light Mode – kräftige Status-Badges */
body.theme-light .status-offen {
    background: rgba(255, 193, 7, 0.22);
    border: 1px solid rgba(255, 193, 7, 0.55);
    color: #9a6c00;
}

body.theme-light .status-in_arbeit {
    background: rgba(0, 174, 255, 0.22);
    border: 1px solid rgba(0, 174, 255, 0.55);
    color: #005d80;
}

body.theme-light .status-fertig {
    background: rgba(0, 230, 118, 0.22);
    border: 1px solid rgba(0, 230, 118, 0.55);
    color: #006b41;
}


body.theme-dark .form-group input,
body.theme-dark .form-group select,
body.theme-dark .form-group textarea {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.22);
    color: #f0f0f0;
}

body.theme-dark .form-group input:focus,
body.theme-dark .form-group select:focus,
body.theme-dark .form-group textarea:focus {
    border-color: #c084fc;
    box-shadow: 0 0 0 3px rgba(192,132,252,0.25);
}

/* ======================================== */
/* STATUS BADGES • DARK MODE OPTIMIERT */
/* ======================================== */

body.theme-dark .status-offen {
    background: rgba(255, 215, 0, 0.10);
    color: #ffdb4d; /* weiches Gelb */
    border: 1px solid rgba(255, 215, 0, 0.25);
}

body.theme-dark .status-in_arbeit {
    background: rgba(0, 200, 255, 0.12);
    color: #46e2ff;
    border: 1px solid rgba(0, 200, 255, 0.25);
}

body.theme-dark .status-fertig {
    background: rgba(0, 255, 110, 0.12);
    color: #4effb2;
    border: 1px solid rgba(0, 255, 110, 0.25);
}

/* ======================================== */
/* BUTTONS • DARK MODE */
/* ======================================== */

body.theme-dark .btn.small {
    background: rgba(255,255,255,0.10);
    color: #e4e4e4;
    border: 1px solid rgba(255,255,255,0.15);
}

body.theme-dark .btn.small:hover {
    background: rgba(255,255,255,0.18);
    color: #ffffff;
}

/* Bearbeiten */
body.theme-dark .btn.small:not(.danger):not(.print-btn) {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border: none;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(124,58,237,0.25);
}

body.theme-dark .btn.small:not(.danger):not(.print-btn):hover {
    background: linear-gradient(135deg, #6d5dfc, #9d66ff);
    box-shadow: 0 6px 18px rgba(124,58,237,0.35);
}

/* Danger */
body.theme-dark .btn.small.danger {
    background: rgba(255,70,70,0.18);
    color: #ff6b6b;
    border: 1px solid rgba(255,70,70,0.35);
}

body.theme-dark .btn.small.danger:hover {
    background: rgba(255,70,70,0.28);
    color: #ff7c7c;
}

/* Druck-Button */
body.theme-dark .print-btn {
    background: rgba(124, 58, 237, 0.10);
    color: #e7dbff; /* <- Helle Farbe, perfekt sichtbar */
    border: 1px solid rgba(124,58,237,0.35);
}

body.theme-dark .print-btn:hover {
    background: rgba(124,58,237,0.20);
    color: #ffffff;
}

/* PRINT-BUTTON ICON FIX – immer gut sichtbar */
.print-btn i {
    color: #444 !important;
}

body.theme-dark .print-btn i {
    color: #e7dbff !important; /* Helles Lila-weiß – perfekt sichtbar */
}






.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #c084fc;
    box-shadow: 0 0 0 3px rgba(192,132,252,0.25);
    outline: none;
}

/* ======================================== */
/* DASHBOARD WIDGETS */
/* ======================================== */

.dashboard-widgets {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 1rem;
}

.widget-card {
    padding: 1.4rem;
    border-radius: 16px;
    color: white;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    transition: 0.35s ease;
    text-align: center;
}

.widget-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

.widget-card i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.widget-card h3 {
    font-size: 2rem;
    font-weight: 700;
}

.gradient-purple {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
}

.gradient-yellow {
    background: linear-gradient(135deg, #facc15, #f59e0b);
}

.gradient-blue {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.gradient-green {
    background: linear-gradient(135deg, #22c55e, #4ade80);
}

/* ========================================= */
/*            AUFTRAG – KARTEN (CLEAN)       */
/* ========================================= */

.cards {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    margin-top: 1.5rem;
}

/* ======================= */
/*   PREMIUM AUFTRAGSKARTEN */
/* ======================= */

.auftrags-card {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 1.4rem;
    position: relative;

    display: flex;
    flex-direction: column;
    gap: 0.8rem;

    backdrop-filter: blur(18px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);

    transition: 0.3s ease;
}

.auftrags-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 35px rgba(0,0,0,0.15);
}

/* Header */
.auftrag-header h3 {
    font-size: 1.35rem;
    margin-bottom: 0.4rem;
}

/* Art + Status als kompakte Zeile */
.auftrag-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Art-Tag */
.auftrag-art {
    background: rgba(140,80,255,0.2);
    color: #c084fc;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Status-Badge */
.auftrag-status {
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

/* Status-Farben allgemein */
.status-offen {
    background: rgba(255, 215, 0, 0.25);
    color: #b88600;
}

.status-in_arbeit {
    background: rgba(0, 200, 255, 0.25);
    color: #007a99;
}

.status-fertig {
    background: rgba(0, 255, 110, 0.25);
    color: #00994f;
}


/* Beschreibung */
.auftrag-beschreibung {
    background: rgba(255,255,255,0.05);
    padding: 0.8rem;
    border-radius: 12px;
    line-height: 1.45;
    font-size: 0.95rem;
}

/* Footer / Datum */
.auftrag-date {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 0.6rem;
    font-size: 0.85rem;
    opacity: 0.85;
}

.auftrag-date i {
    font-size: 1rem;
    opacity: 0.7;
    margin-right: 0.3rem;
}

/* Button-Bereich unten */
.auftrag-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.6rem;
}


/* Farbband nach Typ */
.type-3d-druck {
    border-left: 4px solid #a78bfa;
}

.type-programmierung {
    border-left: 4px solid #3b82f6;
}

.type-scan {
    border-left: 4px solid #f472b6;
}

/* Verbesserte Strukturierung */
.auftrags-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Titel-Bereich */
.auftrag-header {
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Art + Status-Bereich */
.auftrag-meta {
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Beschreibung */
.auftrag-beschreibung {
    padding: 0.4rem 0;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
    font-size: 0.95rem;
    line-height: 1.35;
}

/* Datum */
.auftrag-date {
    padding-top: 0.5rem;
    margin-top: 0.4rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    opacity: 0.85;
}


/* ========================================= */
/* OVERLAY / MODAL */
/* ========================================= */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.hidden {
    display: none;
}

.overlay-content {
    background: rgba(20,12,40,0.92);
    border-radius: 18px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    color: white;
    backdrop-filter: blur(18px);
    animation: fadeIn 0.35s ease;
    position: relative;
}

.overlay-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: transparent;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* ======================================== */
/* RESPONSIVE */
/* ======================================== */

@media (max-width: 900px) {
    .mobile-menu-btn {
        display: inline-block;
    }
    .main {
        padding: 1.4rem 1rem;
    }
}

@media (max-width: 768px) {
    .topbar-right {
        gap: 0.6rem;
    }
    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ======================================== */
/* MOBILE SIDEBAR / OFFCANVAS               */
/* ======================================== */

@media (max-width: 900px) {

    /* Sidebar als Offcanvas von links */
    .sidebar {
        position: fixed;
        top: 62px; /* unter der Topbar */
        left: 0;
        height: calc(100vh - 62px);
        transform: translateX(-260px);
        z-index: 9999;
        background: var(--sidebar-bg);
        box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    }

    /* wenn JS .sidebar-open setzt → reinsliden */
    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Dunkler Hintergrund hinter der Sidebar */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.55);
        z-index: 9998;
    }

    /* Klasse, die JS auf den Backdrop setzen kann */
    .sidebar-backdrop.active {
        display: block;
    }

    /* Layout auf Handy: Inhalt vollbreit */
    .layout {
        flex-direction: column;
    }

    .main {
        padding: 1.4rem 1rem;
    }
}

/* Delete-Bestätigung in der Karte */
.delete-confirm {
    margin-top: 0.5rem;
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
    background: rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;

    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: 0.2s ease;
    font-size: 0.85rem;
}

.auftrags-card.show-confirm .delete-confirm {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.auftrags-card.show-confirm .auftrag-actions {
    opacity: 0.4;
}

/* Buttons in Karten – schöner Purple-Style */
.auftrag-actions .btn.small {
    padding: 0.45rem 0.9rem;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.15);
    color: #7c3aed;
    border: 1px solid rgba(124, 58, 237, 0.35);
    font-weight: 600;
    transition: 0.25s;
}

.auftrag-actions .btn.small:hover {
    background: rgba(124, 58, 237, 0.25);
    color: #5b21b6;
    border-color: rgba(124, 58, 237, 0.55);
    transform: translateY(-2px);
}

/* Danger */
.auftrag-actions .btn.small.danger {
    background: rgba(255, 70, 70, 0.15);
    border: 1px solid rgba(255, 70, 70, 0.45);
    color: #b42323;
}

.auftrag-actions .btn.small.danger:hover {
    background: rgba(255, 70, 70, 0.25);
    border-color: rgba(255, 70, 70, 0.55);
    color: #7e1d1d;
    transform: translateY(-2px);
}

/* Print */
.print-btn {
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0,0,0,0.25);
    color: #444 !important;
}

.print-btn:hover {
    background: rgba(0,0,0,0.22);
    border-color: rgba(0,0,0,0.38);
    transform: translateY(-2px);
}

/* ========================================= */
/* ICON-BUTTONS • schöner, kompakter, modern */
/* ========================================= */

.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    border-radius: 10px;
}

.icon-btn i {
    font-size: 1.15rem;
    line-height: 1;
    opacity: 0.85;
    transition: 0.2s;
}

.icon-btn:hover i {
    opacity: 1;
    transform: scale(1.15);
}

/* Print Button */
.print-btn {
    background: rgba(124, 58, 237, 0.15);
    border: 1px solid rgba(124,58,237,0.35);
    color: #7c3aed;
}

.print-btn:hover {
    background: rgba(124,58,237,0.25);
    color: #a78bfa;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (max-width: 600px) {
    .cards {
        grid-template-columns: 1fr !important;
        gap: 1.2rem;
    }

    .auftrags-card {
        padding: 1.2rem;
    }

    .auftrag-actions {
        flex-direction: column;
        gap: 0.7rem;
    }

    .icon-btn {
        width: 100%;
        justify-content: center;
    }
}

.pms-thread-list {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.pms-thread-item {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    padding: 1rem;
    border-radius: 16px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.08);
    transition: 0.25s;
}

.pms-thread-item:hover {
    background: rgba(255,255,255,0.12);
    transform: translateX(4px);
}

.pms-avatar {
    background: #7c3aed;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 1rem;
    font-size: 1.2rem;
}

.pms-thread-info {
    flex: 1;
}

.pms-last-msg {
    font-size: 0.85rem;
    opacity: 0.8;
}

.pms-unread-badge {
    background: #ff4d6d;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
}

.chat-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 90px);
}

.chat-window {
    flex: 1;
    overflow-y: auto;
    padding-right: 1rem;
    margin-bottom: 1rem;
}

.chat-msg {
    margin-bottom: 1rem;
}

.chat-msg.me {
    text-align: right;
}

.chat-bubble {
    display: inline-block;
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    max-width: 70%;
}

.chat-msg.me .chat-bubble {
    background: #7c3aed;
    color: white;
}

.chat-msg.other .chat-bubble {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
}

.chat-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.2rem;
}

.chat-input {
    display: flex;
    gap: 0.7rem;
}

.chat-input textarea {
    flex: 1;
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    resize: none;
}

/* ============================= */
/*   Nachrichten-Popup (PXnet)   */
/* ============================= */

.pms-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 260px;
    padding: 1rem;
    background: rgba(40, 0, 80, 0.45);
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.35s ease;
    z-index: 999999;
}

.pms-popup.show {
    opacity: 1;
    transform: translateY(0);
}

.pms-popup-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.35rem;
    color: #c084fc;
}

.pms-popup-user {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.pms-popup-msg {
    font-size: 0.9rem;
    opacity: 0.9;
    word-break: break-word;
}

.pms-popup.hidden {
    display: none;
}

.userlist {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
    transition: 0.25s;
}

.user-card:hover {
    background: rgba(255,255,255,0.12);
    transform: translateX(4px);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #7c3aed;
    color: white;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 1rem;
    font-size: 1.2rem;
}

.user-info {
    flex: 1;
}

.user-info span {
    display: block;
    opacity: 0.8;
    font-size: 0.8rem;
}

/* PMS Tabs */
.pms-tabs {
    margin: 1rem 0 1.5rem;
    display: flex;
    gap: 1rem;
}

.pms-tabs a {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    color: #ddd;
    font-weight: 600;
    transition: 0.2s;
}

.pms-tabs a:hover {
    background: rgba(255,255,255,0.16);
}

.pms-tabs a.active {
    background: #7c3aed;
    color: white;
}

/* Right Meta */
.pms-thread-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.pms-time {
    opacity: 0.7;
    font-size: 0.75rem;
}

/* CHAT LAYOUT */
.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 90px);
}

.chat-header {
    margin-bottom: 1rem;
}

.chat-window {
    flex: 1;
    overflow-y: auto;
    padding-right: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Chat-Bubbles */
.chat-msg {
    position: relative;
    max-width: 75%;
}

.chat-msg.me {
    align-self: flex-end;
    text-align: right;
}

.chat-msg.other {
    align-self: flex-start;
}

.chat-bubble {
    padding: .9rem 1.2rem;
    border-radius: 14px;
    line-height: 1.45rem;
    font-size: .95rem;
}

.chat-msg.me .chat-bubble {
    background: #7c3aed;
    color: white;
}

.chat-msg.other .chat-bubble {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.15);
}

.chat-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.2rem;
}

.chat-delete {
    position: absolute;
    right: -28px;
    top: 8px;
    opacity: 0.5;
    font-size: 1.1rem;
}

.chat-delete:hover {
    opacity: 1;
}

/* Chat Input */
.chat-input {
    display: flex;
    gap: 1rem;
}

.chat-input textarea {
    flex: 1;
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    resize: none;
}

/* =============================== */
/*          CHAT UI FINAL          */
/* =============================== */

.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px); /* Platz für Topbar */
}

/* Chat Bereich */
.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 1.6rem;
    margin-bottom: 1rem;
    background: var(--bg-alt);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
}

/* Nachricht */
.chat-message {
    max-width: 75%;
    margin-bottom: 1.3rem;
    display: flex;
    flex-direction: column;
}

.chat-message.mine {
    margin-left: auto;
    align-items: flex-end;
}

.chat-message.theirs {
    margin-right: auto;
    align-items: flex-start;
}

/* Bubble */
.chat-message .bubble {
    padding: 0.9rem 1.2rem;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.45;
    max-width: 100%;
}

.chat-message.mine .bubble {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: white;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.chat-message.theirs .bubble {
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    color: var(--text);
}

body.theme-dark .chat-message.theirs .bubble {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.14);
    color: #e5e5e5;
}

/* Timestamp */
.timestamp {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 4px;
}

/* =============================== */
/* Eingabefeld unten */
.chat-form {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    align-items: center;
}

/* Das Textfeld jetzt endlich groß */
.chat-form textarea {
    flex: 1;
    height: 80px;                /* <-- GROSSES Textfeld */
    max-height: 120px;
    resize: vertical;
    padding: 1rem;
    font-size: 1rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    color: var(--text);
}

/* Senden-Button kompakt */
.chat-form button.btn.primary {
    width: auto !important;      /* <-- NICHT mehr full width */
    padding: 0.9rem 1.6rem;
    white-space: nowrap;
    border-radius: 14px;
}

/* Delete-Icon im Chat */
.delete-msg {
    position: absolute;
    right: -32px;
    top: 8px;
    opacity: 0;
    transition: 0.25s;
    color: #ff6b6b;
    font-size: 1.2rem;
}

.chat-message.mine:hover .delete-msg {
    opacity: 1;
    transform: translateX(-6px);
}

.delete-msg:hover {
    color: #ff3b3b;
    transform: scale(1.2);
}

/* ===================================== */
/* MOBILE CHAT OPTIMIERUNG               */
/* ===================================== */

@media (max-width: 700px) {

    /* Chat Wrapper: weniger Rand */
    .chat-wrapper {
        padding: 0.5rem;
    }

    /* Chat-Box höher + weicher */
    .chat-box {
        padding: 0.5rem;
        gap: 1rem;
    }

    /* Nachricht-Bubble full-width */
    .chat-message {
        max-width: 100%;
        width: 100%;
    }

    .chat-message.mine {
        justify-content: flex-end;
    }

    .chat-message.mine .bubble {
        max-width: 80%;
    }

    .chat-message.theirs .bubble {
        max-width: 85%;
    }

    /* Zeitstempel kleiner und näher dran */
    .chat-message .timestamp {
        font-size: 0.75rem;
        margin-top: 2px;
    }

    /* Abstand zwischen Nachrichten erhöhen */
    .chat-message {
        margin-bottom: 1rem;
    }
}

@media (max-width: 700px) {

    .chat-form {
        flex-direction: column;
        gap: 0.6rem;
        padding: 0.7rem;
    }

    .chat-form textarea {
        height: 80px;
        font-size: 1rem;
        padding: 0.8rem;
        border-radius: 14px;
    }

    .chat-form button {
        width: 100%;
        padding: 0.9rem;
        font-size: 1rem;
        border-radius: 14px;
    }
}

.typing-indicator {
    padding: 0.4rem 0.8rem;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    margin: 0.8rem 0;
    width: fit-content;
    font-size: 0.9rem;
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text);
}

.typing-indicator.hidden {
    display: none;
}

/* ===================================== */
/* MOBILE Chat Input Fix                 */
/* ===================================== */
@media (max-width: 700px) {

    .chat-wrapper {
        padding: 0.5rem;
    }

    .chat-box {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .chat-form {
        flex-direction: column;
        gap: 0.6rem;
        padding: 0.75rem 0.5rem 0.9rem;
    }

    .chat-form textarea {
        min-height: 120px !important;
        height: 120px !important;
        max-height: 200px;
        resize: vertical;
        padding: 0.9rem;
        font-size: 1rem;
        border-radius: 14px;
    }

    .chat-form button {
        width: 100%;
        padding: 0.9rem;
        font-size: 1rem;
        border-radius: 14px;
    }
}


.pms-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgb(99, 62, 255);
    color: white;
    padding: 0.9rem 1.2rem;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.35);
    cursor: pointer;
    font-size: 0.95rem;
    z-index: 999999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.35s ease;
}

.pms-popup.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

.pms-popup:not(.hidden) {
    opacity: 1;
    transform: translateY(0px);
}

/* ========================================================= */
/*          WHATSAPP-STYLE CHAT INPUT LEISTE                 */
/* ========================================================= */

.chat-input-bar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.2rem;
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    z-index: 20;
}

.chat-input {
    flex: 1;
    resize: none;
    height: 55px;
    max-height: 110px;
    border-radius: 16px;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 1rem;
    line-height: 1.4;
    overflow-y: auto;
}

.chat-input:focus {
    outline: none;
    border-color: #a78bfa;
    box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.25);
}

/* SENDEN BUTTON – ICON STYLE */
.send-btn {
    width: 55px;
    height: 55px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.6rem;
    cursor: pointer;
    transition: 0.25s;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.25);
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.35);
}

/* DARK MODE OPTIMIERUNG */
body.theme-dark .chat-input-bar {
    background: #12121a;
    border-color: rgba(255,255,255,0.07);
}

body.theme-dark .chat-input {
    background: #1a1a22;
    border-color: rgba(255,255,255,0.13);
    color: #e8e8e8;
}

body.theme-dark .send-btn {
    background: linear-gradient(135deg, #6d28d9, #9d4edd);
}

.shared-offen {
    background: rgba(255,200,0,0.18);
    color: #caa400;
}

.shared-erledigt {
    background: rgba(0,255,100,0.2);
    color: #00cc55;
}

.shared-ausgeblendet {
    background: rgba(150,150,150,0.18);
    color: #666;
}

.auftrag-completed-info {
    margin-top: 0.8rem;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    font-size: 0.9rem;
    background: rgba(50, 200, 120, 0.12);
    color: #19c37d;
    border-left: 3px solid #19c37d;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.share-users-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.4rem 0;
}

.share-user-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.7rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.4);
    border: 1px solid rgba(0,0,0,0.04);
    cursor: pointer;
    font-size: 0.9rem;
}

body.theme-dark .share-user-item {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
}

.share-user-item input[type="checkbox"] {
    transform: scale(1.1);
}

.share-user-name {
    font-weight: 600;
}

.share-user-email {
    font-size: 0.8rem;
    opacity: 0.7;
}

.auftrag-owner-info {
    margin-top: 0.2rem;
    font-size: 0.85rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.auftrag-completed-info {
    margin-top: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: 10px;
    font-size: 0.85rem;
    background: rgba(25, 195, 125, 0.08);
    color: #19c37d;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    border-left: 3px solid #19c37d;
}

/* ================================= */
/* CONFIRM OVERLAY                   */
/* ================================= */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.confirm-overlay.hidden {
    display: none;
}

.confirm-window {
    background: var(--card-bg);
    padding: 1.8rem;
    border-radius: 20px;
    width: 92%;
    max-width: 420px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    text-align: center;
    animation: popupFade 0.25s ease;
}

.confirm-window h3 {
    font-size: 1.4rem;
    margin-bottom: 0.7rem;
}

.confirm-window p {
    margin-bottom: 1.4rem;
    opacity: 0.9;
}

.confirm-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

@keyframes popupFade {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* MINI CHAT */
.mini-chat {
    height: 100%;
    background: var(--card-bg);
    padding: 1rem;
    overflow: hidden;
}

.mini-chat .chat-box {
    height: calc(100% - 70px); 
}

.mini-chat textarea.chat-input {
    resize: none;
}

.mini-chat .send-btn {
    font-size: 1.4rem;
}
