/* =========================================================
   contractmanager - Globales App-Stylesheet
   Ziel:
   - dunkles, schlichtes Layout
   - Desktop mit Sidebar
   - Mobile mit Bottom Navigation
   - einheitliche Cards, Tabellen, Formulare, Dashboard, Chat und Aufträge
   ========================================================= */


/* =========================================================
   1. Design-Variablen
   ========================================================= */

:root {
    --app-bg: #111111;
    --app-panel: #181818;
    --app-panel-soft: #202020;
    --app-border: #333333;
    --app-text: #f4f4f4;
    --app-muted: #b8b8b8;
    --app-danger: #dc3545;
    --app-radius: 16px;
}


/* =========================================================
   2. Basislayout
   ========================================================= */

html {
    min-height: 100%;
    font-size: 16px;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--app-bg);
    color: var(--app-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
}


/* =========================================================
   3. App-Shell: Sidebar + Hauptbereich
   ========================================================= */

.app-shell {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1rem;
    background: #0c0c0c;
    border-right: 1px solid var(--app-border);
    display: flex;
    flex-direction: column;
}

.app-main {
    min-width: 0;
}

.app-content {
    padding: 1.25rem;
}

.public-content {
    min-height: 100vh;
}


/* =========================================================
   4. Logo und Navigation
   ========================================================= */

.app-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--app-text);
    text-decoration: none;
    margin-bottom: 2rem;
}

    .app-logo:hover {
        color: var(--app-text);
    }

.app-logo-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid var(--app-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    background: var(--app-panel);
}

.app-logo-text {
    font-weight: 700;
    letter-spacing: .01em;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

    .app-nav a {
        color: var(--app-text);
        text-decoration: none;
        padding: .85rem .9rem;
        border-radius: 14px;
        border: 1px solid transparent;
        font-size: .95rem;
    }

        .app-nav a:hover {
            background: var(--app-panel);
            border-color: var(--app-border);
        }

.app-sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
}

.app-logout-button {
    width: 100%;
    border: 1px solid var(--app-border);
    background: transparent;
    color: var(--app-text);
    border-radius: 14px;
    padding: .8rem .9rem;
    text-align: left;
}

    .app-logout-button:hover {
        background: var(--app-panel);
    }


/* =========================================================
   5. Topbar
   ========================================================= */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 64px;
    background: #101010;
    border-bottom: 1px solid var(--app-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
}

.app-topbar-title {
    font-weight: 700;
}

.app-topbar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--app-muted);
    font-size: .9rem;
}


/* =========================================================
   6. Mobile Bottom Navigation
   ========================================================= */

.mobile-bottom-nav {
    display: none;
}


/* =========================================================
   7. Standard-Container, Cards, Texte
   ========================================================= */

.app-card {
    background: var(--app-panel);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 1rem;
}

    .app-card h1,
    .app-card h2,
    .app-card h3 {
        margin-top: 0;
    }

.app-muted {
    color: var(--app-muted);
}


/* =========================================================
   8. Buttons
   ========================================================= */

.app-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: var(--app-text);
    color: #111111;
    text-decoration: none;
    padding: .75rem 1rem;
    font-weight: 600;
}

    .app-button:hover {
        color: #111111;
        filter: brightness(.92);
    }

.app-button-secondary {
    background: transparent;
    color: var(--app-text);
}

    .app-button-secondary:hover {
        color: var(--app-text);
        background: var(--app-panel-soft);
    }

.app-button-danger {
    background: var(--app-danger);
    color: #ffffff;
    border-color: var(--app-danger);
}

    .app-button-danger:hover {
        color: #ffffff;
        filter: brightness(.92);
    }


/* =========================================================
   9. Listen
   ========================================================= */

.app-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: 1rem;
}

.app-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: .8rem;
    background: var(--app-panel-soft);
}


/* =========================================================
   10. Login
   ========================================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--app-border);
    border-radius: 18px;
    padding: 1.5rem;
    background: var(--app-panel);
    color: var(--app-text);
}

    .login-card h1 {
        margin-bottom: 1.5rem;
        font-size: 1.75rem;
        font-weight: 700;
    }

    .login-card .form-label {
        color: var(--app-text);
    }

    .login-card .form-control {
        background: #ffffff;
        color: #111111;
    }

    .login-card .form-check-label {
        color: var(--app-text);
    }

    .login-card .text-danger {
        color: #ff8a8a !important;
    }


/* =========================================================
   11. Seitenkopf, Empty States, Tabellen
   ========================================================= */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.empty-state {
    border: 1px dashed var(--app-border);
    border-radius: 14px;
    padding: 1rem;
    color: var(--app-muted);
    background: var(--app-panel-soft);
}

.responsive-table {
    width: 100%;
    overflow-x: auto;
}

.table-dark {
    --bs-table-bg: var(--app-panel);
    --bs-table-border-color: var(--app-border);
}


/* =========================================================
   12. Formulare
   ========================================================= */

.app-form {
    margin-top: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.form-grid-full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
}

.form-hint {
    color: var(--app-muted);
    font-size: .85rem;
    margin-top: .35rem;
}


/* =========================================================
   13. Allgemeine Detailseiten
   ========================================================= */

.details-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
    margin: 1rem 0;
}

    .details-grid > div {
        background: var(--app-panel-soft);
        border: 1px solid var(--app-border);
        border-radius: 14px;
        padding: .9rem;
    }

.detail-label {
    display: block;
    color: var(--app-muted);
    font-size: .85rem;
    margin-bottom: .25rem;
}

.detail-block {
    margin-top: 1.5rem;
    border-top: 1px solid var(--app-border);
    padding-top: 1rem;
}

    .detail-block h2 {
        font-size: 1.15rem;
        margin-bottom: .75rem;
    }

.detail-block-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}


/* =========================================================
   14. Dashboard
   Nachrichten und Kalender sind gleich breit.
   ========================================================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.dashboard-grid-focused {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

    .dashboard-grid-focused .app-card,
    .dashboard-grid-focused .dashboard-calendar-card {
        grid-column: 1 / -1;
    }

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
}

.dashboard-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-message-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.dashboard-message-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: .9rem;
    color: var(--app-text);
    text-decoration: none;
}

    .dashboard-message-row:hover {
        color: var(--app-text);
        border-color: #ffffff;
    }

.dashboard-message-row-unread {
    border-color: #ffffff;
}

.dashboard-message-title {
    font-weight: 700;
    margin-bottom: .2rem;
}

.dashboard-message-preview {
    color: var(--app-text);
    margin: .35rem 0;
    line-height: 1.35;
}

.dashboard-message-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .4rem;
}

.dashboard-calendar-card {
    grid-column: 1 / -1;
}

.dashboard-calendar-legend {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    color: var(--app-muted);
    font-size: .75rem;
    margin-bottom: .4rem;
    padding-left: 82px;
}

    .dashboard-calendar-legend span {
        text-align: center;
    }

        .dashboard-calendar-legend span:first-child {
            text-align: left;
        }

        .dashboard-calendar-legend span:last-child {
            text-align: right;
        }

.dashboard-calendar-list {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.dashboard-calendar-day {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    gap: .75rem;
    align-items: center;
}

.dashboard-calendar-date {
    color: var(--app-text);
    font-size: .85rem;
}

    .dashboard-calendar-date span {
        display: block;
        color: var(--app-muted);
    }

.dashboard-calendar-bar {
    position: relative;
    min-height: 42px;
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    overflow: hidden;
}

.dashboard-calendar-gridline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, .08);
    z-index: 1;
}

.gridline-25 {
    left: 25%;
}

.gridline-50 {
    left: 50%;
}

.gridline-75 {
    left: 75%;
}

.dashboard-calendar-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-muted);
    font-size: .85rem;
    z-index: 2;
}

.dashboard-calendar-segment {
    position: absolute;
    top: 6px;
    bottom: 6px;
    z-index: 3;
    min-width: 42px;
    border-radius: 10px;
    border: 1px solid #3b5b42;
    background: #263a2b;
    color: var(--app-text);
    text-decoration: none;
    padding: .2rem .45rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    white-space: nowrap;
}

    .dashboard-calendar-segment:hover {
        color: var(--app-text);
        border-color: #ffffff;
    }

    .dashboard-calendar-segment span {
        color: var(--app-muted);
    }


/* =========================================================
   15. Auftragserstellung Wizard
   ========================================================= */

.wizard-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
    margin: 1rem 0 1.5rem 0;
}

.wizard-step {
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: .8rem;
    background: var(--app-panel-soft);
    color: var(--app-muted);
    display: flex;
    align-items: center;
    gap: .6rem;
}

    .wizard-step span {
        width: 28px;
        height: 28px;
        border-radius: 999px;
        border: 1px solid var(--app-border);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: .85rem;
    }

.wizard-step-active {
    color: var(--app-text);
    border-color: #ffffff;
}

    .wizard-step-active span {
        background: #ffffff;
        color: #111111;
        border-color: #ffffff;
    }

.wizard-panel h2 {
    font-size: 1.25rem;
    margin-bottom: .5rem;
}

.review-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-top: 1rem;
}

    .review-grid > div {
        background: var(--app-panel-soft);
        border: 1px solid var(--app-border);
        border-radius: 14px;
        padding: .9rem;
    }

.review-grid-full {
    grid-column: 1 / -1;
}


/* =========================================================
   16. Auftrag Detailseite - Minimalansicht
   Bemerkung volle Breite, darunter Positionen + Mitarbeiter
   ========================================================= */

.order-detail-page {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.order-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: #151515;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: .85rem;
}

    .order-hero h1 {
        margin: .15rem 0 .45rem 0;
        font-size: 1.35rem;
    }

.order-number {
    color: var(--app-muted);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.order-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

    .order-hero-meta span {
        display: inline-flex;
        border: 1px solid var(--app-border);
        border-radius: 999px;
        padding: .2rem .55rem;
        color: var(--app-muted);
        font-size: .75rem;
    }

.order-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .75rem;
}

.order-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .75rem;
}

.order-summary-card {
    background: #151515;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: .7rem;
}

    .order-summary-card span {
        display: block;
        color: var(--app-muted);
        font-size: .72rem;
        margin-bottom: .25rem;
    }

    .order-summary-card strong {
        display: block;
        font-size: .88rem;
    }

.order-section {
    background: #151515;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: .85rem;
}

.order-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
}

    .order-section-header h2 {
        font-size: 1rem;
        margin: 0 0 .25rem 0;
    }

    .order-section-header p {
        margin: 0;
        font-size: .82rem;
    }

.order-note-wide {
    width: 100%;
}

.order-note {
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: .85rem;
    white-space: pre-wrap;
}

.order-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
    gap: .75rem;
    align-items: flex-start;
}

.order-positions-column,
.order-people-column {
    min-width: 0;
}

.order-people-column {
    position: sticky;
    top: 80px;
}

.order-people-group {
    margin-top: .9rem;
}

    .order-people-group:first-of-type {
        margin-top: 0;
    }

    .order-people-group h3 {
        font-size: .9rem;
        margin: 0 0 .5rem 0;
        color: var(--app-muted);
    }


/* =========================================================
   17. Auftragsmitarbeiter und Verfügbarkeit
   ========================================================= */

.assignment-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.assignment-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: .9rem;
}

.compact-assignment-list {
    gap: .55rem;
}

.compact-assignment-card,
.compact-employee-card {
    padding: .65rem;
}

.compact-assignment-card {
    align-items: flex-start;
}

    .compact-assignment-card strong,
    .compact-employee-card strong {
        display: block;
        margin-bottom: .1rem;
        font-size: .9rem;
    }

    .compact-assignment-card .app-muted,
    .compact-employee-card .app-muted {
        font-size: .8rem;
    }

.compact-employee-list {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.compact-employee-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
}

.compact-employee-card-disabled {
    opacity: .45;
}

.compact-employee-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .4rem;
    flex-wrap: wrap;
}

.availability-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    padding: .25rem .6rem;
    font-size: .8rem;
    color: var(--app-muted);
}

.availability-conflict {
    margin-top: .25rem;
    color: var(--app-muted);
    font-size: .85rem;
}


/* =========================================================
   18. Auftragspositionen
   ========================================================= */

.position-timeline {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.position-card {
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: .85rem;
}

.position-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.position-card h3 {
    font-size: .95rem;
    margin: 0 0 .25rem 0;
}

.position-description {
    margin: .85rem 0 0 0;
    white-space: pre-wrap;
    font-size: .9rem;
}

/* =========================================================
   19. Bootstrap Modal
   ========================================================= */

.app-modal {
    background: var(--app-panel);
    color: var(--app-text);
    border: 1px solid var(--app-border);
    border-radius: 16px;
}

    .app-modal .modal-header,
    .app-modal .modal-footer {
        border-color: var(--app-border);
    }

    .app-modal .form-control {
        background: #ffffff;
        color: #111111;
    }


/* =========================================================
   20. Automatisch generierte Formulare
   ========================================================= */

.auto-form-grid {
    display: grid;
    gap: 1rem;
}

.auto-form-grid-1 {
    grid-template-columns: 1fr;
}

.auto-form-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auto-form-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auto-form-full {
    grid-column: 1 / -1;
}

.auto-form-grid .form-check {
    padding-top: .45rem;
}


/* =========================================================
   21. Nachrichtenübersicht
   ========================================================= */

.message-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
    margin: 1rem 0;
}

    .message-summary-grid > div,
    .message-status-grid > div {
        background: var(--app-panel-soft);
        border: 1px solid var(--app-border);
        border-radius: 14px;
        padding: .9rem;
    }

.message-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.message-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: 1rem;
    color: var(--app-text);
    text-decoration: none;
}

    .message-card:hover {
        color: var(--app-text);
        border-color: #ffffff;
    }

.message-card-unread {
    border-color: #ffffff;
}

.message-card h3 {
    font-size: 1.05rem;
    margin: 0 0 .25rem 0;
}

.message-card-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
}

.message-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
    margin: 1rem 0;
}

.message-body {
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: 1rem;
    white-space: pre-wrap;
}

.message-preview {
    margin: .4rem 0;
    color: var(--app-text);
}


/* =========================================================
   22. Konversation / Chat
   Eigene Nachrichten stehen links.
   Nachrichten vom Chatpartner stehen rechts.
   ========================================================= */

.conversation-thread {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    margin-top: 1rem;
    padding: 1rem;
    background: #141414;
    border: 1px solid var(--app-border);
    border-radius: 18px;
}

.conversation-message {
    position: relative;
    width: fit-content;
    max-width: min(68%, 680px);
    border: 1px solid var(--app-border);
    border-radius: 18px;
    padding: .8rem .9rem;
    background: var(--app-panel-soft);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

.conversation-message-own {
    align-self: flex-start;
    margin-right: auto;
    margin-left: 0;
    background: #263a2b;
    border-color: #3b5b42;
    border-bottom-left-radius: 6px;
}

.conversation-message-other {
    align-self: flex-end;
    margin-left: auto;
    margin-right: 0;
    background: #202020;
    border-color: var(--app-border);
    border-bottom-right-radius: 6px;
}

.conversation-message-own::after {
    content: "";
    position: absolute;
    left: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border-right: 10px solid #263a2b;
    border-top: 10px solid transparent;
}

.conversation-message-other::after {
    content: "";
    position: absolute;
    right: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 10px solid #202020;
    border-top: 10px solid transparent;
}

.conversation-message-meta {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    color: var(--app-muted);
    font-size: .78rem;
    margin-bottom: .45rem;
}

    .conversation-message-meta strong {
        color: var(--app-text);
        font-size: .82rem;
    }

.conversation-message-body {
    white-space: pre-wrap;
    line-height: 1.45;
    word-break: break-word;
}

.conversation-message-status {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    color: var(--app-muted);
    font-size: .72rem;
    margin-top: .45rem;
}

.conversation-attachments {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-top: .7rem;
}

.conversation-attachment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 12px;
    padding: .55rem .7rem;
    color: var(--app-text);
    text-decoration: none;
    background: rgba(255, 255, 255, .06);
}

    .conversation-attachment:hover {
        color: var(--app-text);
        border-color: #ffffff;
    }

    .conversation-attachment small {
        color: var(--app-muted);
    }


/* =========================================================
   23. Anhänge
   ========================================================= */

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.attachment-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: 1rem;
    color: var(--app-text);
    text-decoration: none;
}

    .attachment-card:hover {
        color: var(--app-text);
        border-color: #ffffff;
    }


/* =========================================================
   24. Ticketsystem
   ========================================================= */

.ticket-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.ticket-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: 1rem;
    color: var(--app-text);
    text-decoration: none;
}

    .ticket-card:hover {
        color: var(--app-text);
        border-color: #ffffff;
    }

    .ticket-card h2 {
        font-size: 1.05rem;
        margin: 0 0 .25rem 0;
    }

.ticket-card-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
}

.ticket-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
    margin: 1rem 0;
}

    .ticket-detail-grid > div {
        background: var(--app-panel-soft);
        border: 1px solid var(--app-border);
        border-radius: 14px;
        padding: .9rem;
    }


/* =========================================================
   25. Responsive Design
   ========================================================= */

@media (max-width: 1200px) {
    .order-workspace {
        grid-template-columns: 1fr;
    }

    .order-people-column {
        position: static;
    }
}

@media (max-width: 900px) {
    .order-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .app-shell {
        display: block;
        padding-bottom: 72px;
    }

    .app-sidebar {
        display: none;
    }

    .app-topbar {
        height: 56px;
        padding: 0 1rem;
    }

    .app-topbar-user span {
        display: none;
    }

    .app-content {
        padding: 1rem;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        height: 64px;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        background: #0c0c0c;
        border-top: 1px solid var(--app-border);
    }

        .mobile-bottom-nav a {
            color: var(--app-text);
            text-decoration: none;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: .78rem;
            padding: .25rem;
            text-align: center;
        }

    .dashboard-grid,
    .dashboard-grid-focused {
        grid-template-columns: 1fr;
    }

    .dashboard-card-header {
        flex-direction: column;
    }

        .dashboard-card-header .app-button {
            width: 100%;
        }

    .dashboard-message-row {
        flex-direction: column;
    }

    .dashboard-message-status {
        justify-content: flex-start;
    }

    .dashboard-calendar-legend {
        display: none;
    }

    .dashboard-calendar-day {
        grid-template-columns: 1fr;
        gap: .35rem;
    }

    .dashboard-calendar-bar {
        min-height: 52px;
    }

    .dashboard-calendar-segment {
        top: 8px;
        bottom: 8px;
        font-size: .7rem;
    }

    .page-header {
        flex-direction: column;
    }

        .page-header .app-button {
            width: 100%;
        }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-actions .app-button,
    .form-actions button {
        width: 100%;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .detail-block-header {
        flex-direction: column;
    }

    .wizard-steps {
        grid-template-columns: 1fr;
    }

    .wizard-step {
        padding: .75rem;
    }

    .review-grid {
        grid-template-columns: 1fr;
    }

    .order-hero {
        flex-direction: column;
    }

    .order-hero-actions {
        width: 100%;
        flex-direction: column;
    }

        .order-hero-actions .app-button {
            width: 100%;
        }

    .order-summary-grid {
        grid-template-columns: 1fr;
    }

    .order-workspace {
        grid-template-columns: 1fr;
    }

    .order-section-header {
        flex-direction: column;
    }

        .order-section-header .app-button,
        .order-section-header button {
            width: 100%;
        }

    .compact-employee-card,
    .compact-assignment-card {
        flex-direction: column;
    }

        .compact-employee-actions,
        .compact-employee-actions form,
        .compact-employee-actions button,
        .compact-assignment-card form,
        .compact-assignment-card button {
            width: 100%;
        }

    .position-card-header {
        flex-direction: column;
    }

        .position-card-header form,
        .position-card-header button {
            width: 100%;
        }

    .position-card-actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: .5rem;
        flex-wrap: wrap;
    }

    @media (max-width: 768px) {
        .position-card-actions,
        .position-card-actions form,
        .position-card-actions a,
        .position-card-actions button {
            width: 100%;
        }
    }

    .modal-footer {
        flex-direction: column;
    }

        .modal-footer .app-button {
            width: 100%;
        }

    .auto-form-grid-2,
    .auto-form-grid-3 {
        grid-template-columns: 1fr;
    }

    .message-summary-grid,
    .message-status-grid {
        grid-template-columns: 1fr;
    }

    .message-card {
        flex-direction: column;
    }

    .message-card-status {
        justify-content: flex-start;
    }

    .conversation-thread {
        gap: .9rem;
        padding: .75rem;
    }

    .conversation-message {
        max-width: 86%;
        padding: .7rem .8rem;
    }

    .conversation-message-meta {
        flex-direction: column;
        gap: .15rem;
    }

    .attachment-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .ticket-card {
        flex-direction: column;
    }

    .ticket-card-status {
        justify-content: flex-start;
    }

    .ticket-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Kalenderseite
   ========================================================= */

.calendar-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.calendar-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

    .calendar-summary-grid > div {
        background: var(--app-panel-soft);
        border: 1px solid var(--app-border);
        border-radius: 14px;
        padding: .9rem;
    }

.calendar-legend {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    color: var(--app-muted);
    font-size: .75rem;
    padding-left: 82px;
}

    .calendar-legend span {
        text-align: center;
    }

        .calendar-legend span:first-child {
            text-align: left;
        }

        .calendar-legend span:last-child {
            text-align: right;
        }

.calendar-week {
    display: flex;
    flex-direction: column;
    gap: .65rem;
}

.calendar-day-row {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    gap: .75rem;
    align-items: center;
}

.calendar-day-label {
    font-size: .85rem;
}

    .calendar-day-label span {
        display: block;
        color: var(--app-muted);
    }

.calendar-day-bar {
    position: relative;
    min-height: 54px;
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    overflow: hidden;
}

.calendar-gridline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, .08);
    z-index: 1;
}

.calendar-gridline-25 {
    left: 25%;
}

.calendar-gridline-50 {
    left: 50%;
}

.calendar-gridline-75 {
    left: 75%;
}

.calendar-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-muted);
    font-size: .85rem;
    z-index: 2;
}

.calendar-segment {
    position: absolute;
    top: 7px;
    bottom: 7px;
    z-index: 3;
    min-width: 72px;
    border-radius: 10px;
    border: 1px solid #3b5b42;
    background: #263a2b;
    color: var(--app-text);
    text-decoration: none;
    padding: .3rem .55rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .75rem;
    white-space: nowrap;
}

    .calendar-segment:hover {
        color: var(--app-text);
        border-color: #ffffff;
    }

    .calendar-segment span {
        color: var(--app-muted);
    }

    .calendar-segment em {
        font-style: normal;
        color: var(--app-muted);
        overflow: hidden;
        text-overflow: ellipsis;
    }

.calendar-order-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.calendar-order-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: .9rem;
    color: var(--app-text);
    text-decoration: none;
}

    .calendar-order-card:hover {
        color: var(--app-text);
        border-color: #ffffff;
    }

@media (max-width: 768px) {
    .calendar-summary-grid {
        grid-template-columns: 1fr;
    }

    .calendar-legend {
        display: none;
    }

    .calendar-day-row {
        grid-template-columns: 1fr;
        gap: .35rem;
    }

    .calendar-day-bar {
        min-height: 64px;
    }

    .calendar-segment {
        top: 8px;
        bottom: 8px;
        font-size: .7rem;
    }

    .calendar-order-card {
        flex-direction: column;
    }
}

.position-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .position-card-actions,
    .position-card-actions form,
    .position-card-actions a,
    .position-card-actions button {
        width: 100%;
    }
}

/* =========================================================
   Backups
   ========================================================= */

.backup-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.backup-layout {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr);
    gap: 1rem;
    align-items: flex-start;
}

.backup-list-section,
.backup-readme-section {
    background: #151515;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 1rem;
}

    .backup-list-section h2,
    .backup-readme-section h2 {
        font-size: 1.1rem;
        margin: 0 0 .75rem 0;
    }

.backup-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.backup-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: .9rem;
}

.backup-card-selected {
    border-color: #ffffff;
}

.backup-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    flex-wrap: wrap;
}

.backup-readme-box {
    background: var(--app-panel-soft);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: 1rem;
    max-height: 720px;
    overflow: auto;
}

    .backup-readme-box pre {
        margin: 0;
        color: var(--app-text);
        white-space: pre-wrap;
        word-break: break-word;
        font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
        font-size: .85rem;
    }

@media (max-width: 1000px) {
    .backup-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .backup-card {
        flex-direction: column;
    }

    .backup-card-actions,
    .backup-card-actions a {
        width: 100%;
    }
}