/* =========================================================
   TEC DOOR - Modern UI (Blue/Orange) based on monteur_app.html
   Works with existing IDs/classes from your app:
   - .app, .topbar, .content, .card, .field, .btn
   - #viewLogin/#viewOrders/#viewDetails...
   - .order-card, .pill, .msg, etc.
   ========================================================= */

/* ---- reset / base ---- */
:root {
    --blue-900: #002855;
    --blue-800: #003D7A;
    --blue-700: #0059B3;
    --orange-600: #F39200;
    --orange-500: #FF8C00;
    --bg: #eef3f8;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 10px 40px rgba(0,0,0,.10);
    --shadow2: 0 15px 50px rgba(0,0,0,.15);
    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --focus: 0 0 0 3px rgba(243,146,0,.18);
    /* Gray Scale */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    /* Radius */
    --radius: 10px;
    /* Touch-friendly sizing */
    --touch-min: 44px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    /* Prevent zoom on input focus (iOS) */
    -webkit-text-size-adjust: 100%;
}

body {
    height: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    color: var(--text);
    background: linear-gradient(135deg, var(--blue-800) 0%, var(--blue-900) 100%);
    /* Smooth scrolling */
    -webkit-overflow-scrolling: touch;
}

/* keep app centered like template */
.app {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height für mobile */
    display: flex;
    flex-direction: column;
}

/* Safe area padding für Tablets mit Notch/Rounded Corners */
@supports (padding: env(safe-area-inset-bottom)) {
    .content {
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }

    .topbar {
        padding-left: calc(16px + env(safe-area-inset-left));
        padding-right: calc(16px + env(safe-area-inset-right));
    }
}

/* ---- topbar ---- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--blue-800) 0%, var(--blue-700) 100%);
    box-shadow: 0 10px 25px rgba(0,0,0,.18);
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 0;
    background: rgba(255,255,255,.14);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease;
}

    .icon-btn:hover {
        background: rgba(255,255,255,.20);
        transform: translateY(-1px);
    }

    .icon-btn:active {
        transform: translateY(0);
    }

.topbar-title {
    flex: 1;
    min-width: 0;
    color: #fff;
}

.topbar-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-logo {
    height: 32px; /* oder kleiner, z.B. 24px */
    width: auto;
    object-fit: contain;
}

/* We reuse your <span class="emoji">…</span> as logo container */
.emoji {
    width: 72px;
    height: 14px;
    display: inline-block;
    background: url("tecdoor-logo.png") no-repeat left center;
    background-size: contain;
    object-fit: contain;
    /* hide emoji text if any */
    font-size: 0;
    line-height: 0;
}

#pageTitle {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subtitle {
    font-size: 12.5px;
    opacity: .9;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- content wrapper ---- */
.content {
    padding: 18px 16px 40px;
    background: var(--bg);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- cards ---- */
.card {
    background: var(--card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 18px;
    max-width: 980px;
    margin: 0 auto 18px auto;
}

    .card h2 {
        margin: 0 0 6px 0;
        font-size: 22px;
        font-weight: 800;
    }

.muted {
    color: var(--muted);
}

/* ---- fields ---- */
.field {
    display: block;
    margin-top: 12px;
}

    .field > span {
        display: block;
        font-size: 12.5px;
        color: var(--muted);
        margin-bottom: 6px;
    }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 14px;
    font-size: 16px; /* Verhindert Zoom auf iOS */
    min-height: var(--touch-min);
    outline: none;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
    /* Touch-friendly */
    touch-action: manipulation;
}

textarea {
    resize: vertical;
}

    input:focus, select:focus, textarea:focus {
        border-color: var(--orange-600);
        box-shadow: var(--focus);
    }

/* Two-column row helper (your HTML uses .row2 sometimes) */
.row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 599px) {
    .row2 {
        grid-template-columns: 1fr;
    }
}

/* ---- buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 14px;
    padding: 14px 20px;
    min-height: var(--touch-min);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease;
    user-select: none;
    /* Touch-friendly */
    touch-action: manipulation;
}

    .btn.primary {
        color: #fff;
        background: linear-gradient(135deg, var(--orange-600) 0%, var(--orange-500) 100%);
        box-shadow: 0 10px 24px rgba(243,146,0,.32);
    }

        .btn.primary:hover {
            transform: translateY(-1px);
            box-shadow: 0 14px 30px rgba(243,146,0,.38);
        }

        .btn.primary:active {
            transform: translateY(0);
        }

    .btn.secondary {
        background: #f7fafc;
        border: 2px solid var(--border);
        color: #374151;
    }

        .btn.secondary:hover {
            background: #eef2f7;
        }

    .btn:disabled {
        opacity: .55;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

.btn-mini {
    padding: 8px 10px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: #fff;
    font-weight: 700;
    cursor: pointer;
}

    .btn-mini.btn-edit {
        border-color: #cfe3f6;
    }

    .btn-mini.btn-danger {
        border-color: #ffd4d4;
        color: #b91c1c;
    }

    .btn-mini:hover {
        background: #f7fafc;
    }

/* ---- messages ---- */
.msg {
    margin-top: 10px;
    font-size: 13.5px;
    color: var(--muted);
}

    .msg.ok {
        color: #0f766e;
    }

    .msg.err {
        color: #b91c1c;
        background: #fff1f2;
        border: 1px solid #fecdd3;
        padding: 10px 12px;
        border-radius: 12px;
        white-space: pre-wrap;
    }

/* ---- orders controls (search + selects) ---- */
.controls {
    max-width: 980px;
    margin: 0 auto 16px auto;
    background: var(--card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 16px;
}

.searchbox {
    position: relative;
    margin-bottom: 12px;
}

    .searchbox .icon {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        opacity: .55;
    }

    .searchbox input {
        padding-left: 44px;
    }

.select {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: 2px solid var(--border);
    background: #fff;
    font-size: 14.5px;
}

.controls .row2 {
    margin-top: 10px;
}

.employee-filter-row {
    margin-top: 10px;
}
.employee-filter-row[hidden] { display: none !important; }

/* Vertretungs-Erfassung */
.act-as-select[hidden] { display: none !important; }
.act-as-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #7c3aed;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    text-align: center;
}
.act-as-banner[hidden] { display: none !important; }
.act-as-end {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 8px;
    padding: 3px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.act-as-end:hover { background: rgba(255,255,255,0.35); }

/* Erinnerung: überfällige/vergessene Rapporte */
.orders-reminder {
    max-width: 980px;
    margin: 0 auto 12px auto;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff7ed;
    border: 1.5px solid #fb923c;
    color: #9a3412;
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14.5px;
}
.orders-reminder[hidden] { display: none !important; }
.orders-reminder.active { background: #ffedd5; }
.orders-reminder-icon { font-size: 18px; }
.orders-reminder-text { flex: 1; }
.orders-reminder-btn {
    background: #ea580c;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
}
.orders-reminder-btn:hover { background: #c2410c; }

/* Überfällig-Badge auf Auftragskarten */
.order-card.overdue { border-left: 4px solid #ea580c; }
.order-overdue-badge {
    display: inline-block;
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 11.5px;
    font-weight: 700;
    margin-left: 8px;
    vertical-align: middle;
}

/* Geführter Ablauf (typ-abhängig) */
.flow-guide {
    max-width: 980px;
    margin: 0 auto 14px auto;
    background: var(--card, #fff);
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: var(--radius-xl, 16px);
    box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,0.06));
    padding: 14px 16px;
}
.flow-guide[hidden] { display: none !important; }
.flow-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.flow-type-select {
    border: 2px solid var(--blue-700, #1d4ed8);
    color: var(--blue-700, #1d4ed8);
    background: #eff6ff;
    border-radius: 999px;
    padding: 5px 12px;
    font-weight: 700;
    font-size: 13.5px;
}
.flow-wizard-btn {
    margin-left: auto;
    background: var(--blue-700, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
}
.flow-wizard-btn:hover { background: #1e40af; }
.flow-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.flow-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1.5px solid transparent;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text, #0f172a);
    cursor: pointer;
    transition: all 0.15s;
}
.flow-step:hover { background: #e2e8f0; }
.flow-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 999px;
    background: #cbd5e1;
    color: #fff;
    font-size: 12.5px;
    font-weight: 800;
    flex: none;
}
.flow-step.done { background: #ecfdf5; color: #065f46; }
.flow-step.done .flow-step-num { background: #059669; }
.flow-step.next { border-color: #ea580c; background: #fff7ed; }
.flow-step.next .flow-step-num { background: #ea580c; }
.flow-step.optional { opacity: 0.85; }
.flow-opt { font-weight: 500; color: var(--muted, #64748b); font-size: 12px; }
.flow-actions { display: flex; }
.flow-next-btn {
    width: 100%;
    background: #ea580c;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px 16px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}
.flow-next-btn:hover { background: #c2410c; }
.flow-next-btn.done { background: #059669; }
.flow-next-btn.done:hover { background: #047857; }

/* Touch-Mindesthöhe für die Ablauf-Bedienelemente (Handschuh-tauglich) */
.flow-step, .flow-wizard-btn, .flow-next-btn { min-height: 44px; }

/* Mobil: Ablauf-Leiste kompakt halten, damit der Auftragskopf sichtbar bleibt */
@media (max-width: 599px) {
    .flow-guide { padding: 10px 12px; }
    .flow-head { margin-bottom: 8px; }
    .flow-steps { gap: 6px; margin-bottom: 8px; }
    .flow-step { padding: 6px 10px; font-size: 12.5px; }
    .flow-step-num { width: 20px; height: 20px; font-size: 11.5px; }
    .flow-opt { display: none; }
}

/* Schwebende Erinnerung (Toast) */
.app-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(120%);
    background: #ea580c;
    color: #fff;
    font-weight: 700;
    font-size: 14.5px;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.25);
    cursor: pointer;
    z-index: 9999;
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
    max-width: 90vw;
}
.app-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Grosse App-Dialoge (ersetzen alert/confirm) */
.app-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.app-dialog {
    background: var(--card, #fff);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    width: 100%;
    max-width: 420px;
    padding: 22px 20px 16px;
}
.app-dialog-text {
    font-size: 16px;
    line-height: 1.5;
    color: var(--text, #0f172a);
    white-space: pre-line;
    margin-bottom: 18px;
}
.app-dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.app-dialog-btn {
    min-height: 48px;
    min-width: 96px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    padding: 10px 20px;
}
.app-dialog-btn.ok { background: var(--blue-700, #1d4ed8); color: #fff; }
.app-dialog-btn.ok:hover { background: #1e40af; }
.app-dialog-btn.cancel { background: #e2e8f0; color: var(--text, #0f172a); }
.app-dialog-btn.cancel:hover { background: #cbd5e1; }

/* Erststart-Tour */
.tour-dialog { max-width: 460px; }
.tour-title { font-size: 18px; font-weight: 800; margin-bottom: 16px; }
.tour-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
    font-size: 14.5px;
    line-height: 1.45;
}
.tour-icon { font-size: 22px; flex: none; }
.tour-hint {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--muted, #475569);
    margin-bottom: 16px;
}

/* Offline-Banner (fix am unteren Rand) */
.offline-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #b45309;
    color: #fff;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    padding: 10px 16px;
    z-index: 9998;
    transform: translateY(110%);
    transition: transform 0.3s ease;
}
.offline-banner.show { transform: translateY(0); }

/* 1-Tap-Navigation */
.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    background: #eff6ff;
    border: 1.5px solid var(--blue-700, #1d4ed8);
    color: var(--blue-700, #1d4ed8);
    border-radius: 10px;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 13.5px;
    text-decoration: none;
    min-height: 44px;
}
.nav-btn:hover { background: #dbeafe; }
.nav-btn[hidden] { display: none !important; }

/* Foto-Annotation */
.photo-annotate {
    position: absolute;
    left: 4px;
    top: 4px;
    background: rgba(255,255,255,0.92);
    border: none;
    border-radius: 8px;
    width: 34px; height: 34px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.annotate-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.85);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}
.annotate-box { max-width: 96vw; max-height: 94vh; display: flex; flex-direction: column; gap: 10px; }
.annotate-canvas {
    max-width: 96vw;
    max-height: 80vh;
    width: auto; height: auto;
    border-radius: 10px;
    background: #000;
}
.annotate-actions { display: flex; gap: 10px; justify-content: center; }

/* KI-Rapport */
.flow-ai-btn {
    background: linear-gradient(135deg, #7c3aed, #db2777);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    min-height: 44px;
}
.flow-ai-btn:hover { filter: brightness(1.08); }
.ai-dialog { max-width: 520px; }
.ai-dialog textarea { width: 100%; }

/* Hilfe / Funktionsübersicht */
.help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 12px;
    overflow-y: auto;
}
.help-overlay[hidden] { display: none !important; }
.help-sheet {
    background: var(--card, #fff);
    border-radius: var(--radius-xl, 16px);
    width: 100%;
    max-width: 720px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}
.help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--blue-700, #1d4ed8);
    color: #fff;
}
.help-header h2 { margin: 0; font-size: 18px; }
.help-header .icon-btn { color: #fff; }
.help-body { padding: 8px 20px 20px; }
.help-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border, #e2e8f0);
}
.help-item:last-child { border-bottom: none; }
.help-item-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.help-item-body { font-size: 14px; color: var(--muted, #475569); line-height: 1.5; }

/* ---- orders list ---- */
#ordersList {
    max-width: 980px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

@media (max-width: 599px) {
    #ordersList {
        grid-template-columns: 1fr;
    }
}

.order-card {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 40px rgba(0,0,0,.08);
    padding: 18px;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
    border-left: 5px solid transparent;
    position: relative;
}

.order-status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
}

.order-id {
    font-size: 18px;
    font-weight: 900;
    color: #111827;
    padding-right: 100px; /* Platz für Status-Badge */
}

    .order-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow2);
    }

    .order-card.clickable {
    }

.order-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.order-no {
    font-size: 18px;
    font-weight: 900;
    color: #111827;
}

.order-cust {
    font-size: 15px;
    font-weight: 700;
    margin-top: 4px;
}

.order-customer {
    font-size: 15px;
    font-weight: 700;
    margin-top: 6px;
    color: var(--text);
}

.order-meta {
    margin-top: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 13px;
}

/* ---- status pills ---- */
.pill {
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .4px;
    text-transform: uppercase;
    white-space: nowrap;
}

    .pill.offen {
        background: #FFE4BF;
        color: #A05A00;
    }

    .pill.visiert {
        background: #CCE0F4;
        color: var(--blue-900);
    }

    .pill.fakturiert {
        background: #d1fae5;
        color: #065f46;
    }

    .pill.storniert {
        background: #fee2e2;
        color: #991b1b;
    }

    /* Legacy - für Rückwärtskompatibilität */
    .pill.inbearbeitung {
        background: #CCE0F4;
        color: var(--blue-900);
    }

    .pill.abgeschlossen {
        background: #d1fae5;
        color: #065f46;
    }

/* ---- empty states ---- */
.empty {
    text-align: center;
    color: var(--muted);
    padding: 22px 10px;
}

#ordersEmpty {
    max-width: 980px;
    margin: 0 auto;
    background: rgba(255,255,255,.65);
    border-radius: var(--radius-xl);
    padding: 18px;
}

/* ---- details view blocks ---- */
#viewDetails .card {
    padding: 18px;
}

#viewDetails select {
    /* make status dropdown look like template */
    font-weight: 700;
}

/* ---- Order header ---- */
.kv-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.headline {
    font-size: 28px;
    font-weight: 900;
    color: var(--blue-900);
    line-height: 1.1;
}

.field-inline {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-inline > span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--muted);
    text-transform: uppercase;
}

.field-inline .select.small {
    padding: 10px 14px;
    font-size: 14px;
    min-width: 160px;
}

/* ---- Key-Value Grid ---- */
.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.kv {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kv-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--muted);
    text-transform: uppercase;
}

.kv-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

/* Summary block spacing if you have it */
#viewDetails .summary, .summary {
    background: #f7fafc;
    border: 1px solid #edf2f7;
    border-radius: 16px;
    padding: 14px;
}

/* ---- Summary rows ---- */
.sum-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #edf2f7;
}

.sum-row:last-child {
    border-bottom: none;
}

.sum-icon {
    font-size: 18px;
    width: 28px;
    text-align: center;
}

.sum-label {
    flex: 1;
    font-size: 14px;
    color: var(--text);
}

.sum-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--blue-800);
}

/* Signature preview in summary */
.signature-summary {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #edf2f7;
}

.signature-preview {
    background: #f0fdf4;
    border: 2px solid #bbf7d0;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.signature-preview img {
    max-width: 100%;
    max-height: 80px;
    height: auto;
    width: auto;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    object-fit: contain;
}

.signature-info {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    color: #059669;
}

.signature-info span:first-child {
    font-weight: 600;
}

/* ---- action tiles (Zeiterfassung/Material/Protokoll/Unterschrift) ---- */
.action-grid,
.actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 599px) {
    .action-grid, .actions-grid {
        grid-template-columns: 1fr;
    }
}

.action-tile,
.big-action-btn {
    border: 0;
    border-radius: 16px;
    padding: 14px 14px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
    cursor: pointer;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .action-tile:hover,
    .big-action-btn:hover {
        transform: translateY(-2px);
    }

    .action-tile:active,
    .big-action-btn:active {
        transform: translateY(0);
    }

/* Legacy button IDs - überschrieben von .btn.tile Klassen */

/* ---- signature canvas ---- */
#sigCanvas {
    width: 100%;
    display: block;
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    background: #fff;
    /* Touch-Gesten deaktivieren - wichtig für Signatur auf Touch-Geräten */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.sig-wrap {
    /* Container verhindert auch versehentliches Scrollen */
    touch-action: none;
    overflow: hidden;
}

/* ---- modal ---- */
#modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.40);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

    #modal[hidden] {
        display: none !important;
    }

    #modal .card,
    #modal .modal-card {
        width: min(720px, 100%);
        border-radius: 18px;
    }

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

/* ---- small polish ---- */
a {
    color: inherit;
}

/* ---- line rows for time/material lists ---- */
.line-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #f9fafb;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: background .15s;
}

.line-row:hover {
    background: #f3f4f6;
}

.line-main {
    flex: 0 0 auto;
    min-width: 80px;
}

.line-hours, .line-qty {
    font-weight: 700;
    color: var(--blue-800);
}

.line-art {
    font-size: 12px;
    color: var(--muted);
}

.line-desc {
    flex: 1;
    color: var(--text);
    font-size: 14px;
}

.btn-edit, .btn-del {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

.btn-edit:hover {
    background: #dbeafe;
}

.btn-del:hover {
    background: #fee2e2;
}

.list.small {
    max-height: 300px;
    overflow-y: auto;
}

/* ---- Readonly fields ---- */
.readonly-field {
    background: #f8fafc !important;
    color: #475569;
    cursor: default;
    border-color: #e2e8f0 !important;
}

.readonly-field:focus {
    border-color: #e2e8f0 !important;
    box-shadow: none !important;
}

/* ---- Section title ---- */
.section-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 12px;
    text-transform: uppercase;
}

/* ---- Checkbox group ---- */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.15s ease;
}

.checkbox-item:hover {
    background: #f1f5f9;
}

.checkbox-item:has(input:checked) {
    background: #eff6ff;
    border-color: var(--blue-700);
}

.checkbox-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--blue-700);
}

.checkbox-item span {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

/* Responsive checkboxes für Tablets */
@media (min-width: 600px) {
    .checkbox-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }

    .checkbox-item {
        flex: 1;
        min-width: 200px;
    }
}

/* ---- Photo Upload ---- */
.photo-upload-area {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.photo-btn {
    flex: 1;
    min-width: 140px;
    padding: 16px 14px !important;
    font-size: 14px !important;
}

.photo-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.photo-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
    border: 2px solid var(--border);
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item .photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.15s ease;
}

.photo-preview-item .photo-remove:hover {
    transform: scale(1.1);
}

.photo-preview-item .photo-upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0,0,0,0.2);
}

.photo-preview-item .photo-upload-progress-bar {
    height: 100%;
    background: var(--orange-600);
    transition: width 0.3s ease;
}

.uploaded-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.uploaded-photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.uploaded-photo-item:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.uploaded-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.uploaded-photo-item .photo-date {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 11px;
    text-align: center;
}

/* Photo delete button */
.photo-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.85);
    color: white;
    border: none;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.uploaded-photo-item:hover .photo-delete-btn {
    opacity: 1;
}

.photo-delete-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

/* Photo lightbox */
.photo-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.photo-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.photo-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 599px) {
    .photo-preview-list {
        grid-template-columns: repeat(3, 1fr);
    }

    .uploaded-photos-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ---- Button Row Layout (links/rechts gruppiert) ---- */
.button-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    max-width: 980px;
    margin: 0 auto 18px auto;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.button-group .btn.tile {
    padding: 14px 20px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    transition: transform .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}

.button-group .btn.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,.15);
}

.btn.tile.blue {
    background: linear-gradient(135deg, #0059B3 0%, #003D7A 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(0,89,179,.25);
}

.btn.tile.amber {
    background: linear-gradient(135deg, #F39200 0%, #FF8C00 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(243,146,0,.25);
}

.btn.tile.gray {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(107,114,128,.25);
}

.btn.tile.green {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(5,150,105,.25);
}

.btn.tile.purple {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(124,58,237,.25);
}

/* ---- Montageinfo Styles ---- */
.montage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.montage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 2px solid transparent;
}

.montage-item:hover {
    background: #f1f5f9;
    border-color: var(--border);
}

.montage-item:active {
    transform: scale(0.99);
}

.montage-folder {
    background: #eff6ff;
    border-color: #dbeafe;
}

.montage-folder:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.montage-file {
    background: #fafafa;
}

.montage-icon {
    font-size: 24px;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.montage-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.montage-meta {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 599px) {
    .montage-item {
        padding: 12px 14px;
        gap: 10px;
    }

    .montage-icon {
        font-size: 20px;
        width: 28px;
    }

    .montage-name {
        font-size: 14px;
    }

    .montage-meta {
        font-size: 11px;
    }
}

/* SharePoint Link Styles */
.sharepoint-path {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    color: var(--muted);
    word-break: break-all;
    margin-top: 12px;
}

.sharepoint-path strong {
    color: var(--text);
}

.sharepoint-btn {
    gap: 8px;
}

/* Detail Actions Grid - Auftragsdetails Buttons */
.detail-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 980px;
    margin: 0 auto 18px auto;
}
.detail-actions-grid .btn.tile {
    padding: 14px 20px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.detail-actions-grid .btn.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,.15);
}

/* =============================================
   RESPONSIVE BREAKPOINTS
   - Mobile: < 600px
   - Tablet Portrait: 600px - 900px
   - Tablet Landscape / 11": 900px - 1200px
   - Desktop: > 1200px
   ============================================= */

/* --- Mobile (< 600px) --- */
@media (max-width: 599px) {
    .detail-actions-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .detail-actions-grid .btn.tile {
        padding: 12px 10px;
        font-size: 12px;
    }

    .button-row {
        flex-direction: column;
        gap: 12px;
    }

    .button-group {
        flex-direction: row;
        gap: 10px;
    }

    .button-group .btn.tile {
        flex: 1;
        justify-content: center;
        padding: 12px 14px;
        font-size: 13px;
    }

    .card {
        padding: 14px;
        border-radius: 16px;
    }

    .content {
        padding: 12px 10px 30px;
    }

    #pageTitle {
        font-size: 17px;
    }

    .order-card {
        padding: 14px;
    }

    .line-row {
        padding: 10px 12px;
        flex-wrap: wrap;
    }
}

/* --- Tablet Portrait (600px - 900px) --- */
@media (min-width: 600px) and (max-width: 899px) {
    .content {
        padding: 20px 20px 40px;
    }

    .card {
        padding: 20px;
        max-width: 720px;
    }

    #ordersList {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 16px;
        max-width: 720px;
    }

    .button-row {
        max-width: 720px;
        gap: 20px;
    }

    .button-group .btn.tile {
        padding: 16px 24px;
        font-size: 15px;
    }

    .controls, .cal-toolbar, .view-toggle-bar {
        max-width: 720px;
    }
}

/* --- Tablet Landscape / 11" (900px - 1200px) --- */
@media (min-width: 900px) and (max-width: 1199px) {
    .content {
        padding: 24px 32px 50px;
    }

    .card {
        padding: 24px;
        max-width: 900px;
    }

    #ordersList {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        max-width: 900px;
    }

    .button-row {
        max-width: 900px;
        gap: 24px;
    }

    .button-group {
        flex-direction: row;
        gap: 12px;
    }

    .button-group .btn.tile {
        padding: 18px 28px;
        font-size: 16px;
    }

    .controls, .cal-toolbar, .view-toggle-bar {
        max-width: 900px;
    }

    .row2 {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .topbar {
        padding: 16px 24px;
    }

    #pageTitle {
        font-size: 22px;
    }
}

/* --- Desktop (> 1200px) --- */
@media (min-width: 1200px) {
    .content {
        padding: 30px 40px 60px;
    }

    .card {
        padding: 28px;
        max-width: 1100px;
    }

    #ordersList {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
        max-width: 1100px;
    }

    .button-row {
        max-width: 1100px;
    }

    .button-group {
        flex-direction: row;
        gap: 14px;
    }

    .button-group .btn.tile {
        padding: 20px 32px;
        font-size: 16px;
    }

    .controls, .cal-toolbar, .view-toggle-bar {
        max-width: 1100px;
    }

    .topbar {
        padding: 18px 32px;
    }

    #pageTitle {
        font-size: 24px;
    }
}

/* --- Touch Device Optimizations --- */
@media (hover: none) and (pointer: coarse) {
    /* Grössere Touch-Targets auf Touch-Geräten */
    .btn, .btn.tile, .icon-btn, .btn-mini, .btn-edit, .btn-del,
    .flow-step, .flow-wizard-btn, .flow-next-btn {
        min-height: 48px;
        min-width: 48px;
    }

    .line-row {
        padding: 14px 16px;
        gap: 14px;
    }

    .order-card {
        padding: 18px;
    }

    /* Keine Hover-Effekte auf Touch */
    .btn:hover,
    .order-card:hover,
    .button-group .btn.tile:hover {
        transform: none;
    }

    /* Active-State statt Hover */
    .btn:active,
    .order-card:active,
    .button-group .btn.tile:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    /* Lösch-Button auf Touch-Geräten immer sichtbar */
    .photo-delete-btn {
        opacity: 1;
    }
}

/* --- Landscape Orientation auf Tablets --- */
@media (min-width: 600px) and (max-height: 600px) and (orientation: landscape) {
    .topbar {
        padding: 10px 20px;
    }

    #pageTitle {
        font-size: 18px;
    }

    .content {
        padding: 12px 20px 30px;
    }

    .card {
        padding: 16px;
    }
}

/* ---- Article Source Tabs (Ersatzteile / Eigene Artikel) ---- */
.article-source-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
}

.tab-small {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-small:hover {
    color: var(--text);
    background: rgba(255,255,255,0.5);
}

.tab-small.active {
    background: #fff;
    color: var(--blue-800);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Article result items with source badge */
.art-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f9fafb;
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.art-item:hover {
    background: #f3f4f6;
}

.art-no {
    font-weight: 700;
    color: var(--blue-800);
    font-size: 14px;
    min-width: 100px;
}

.art-desc {
    flex: 1;
    color: var(--text);
    font-size: 14px;
}

.art-unit {
    color: var(--muted);
    font-size: 12px;
    min-width: 40px;
    text-align: right;
}

.art-source-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.art-source-badge.ersatzteile {
    background: #dbeafe;
    color: #1e40af;
}

.art-source-badge.eigene {
    background: #d1fae5;
    color: #065f46;
}

/* Article Input Wrapper with Dropdown */
.article-input-wrapper {
    position: relative;
}

.article-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid var(--border);
    border-top: none;
    border-radius: 0 0 14px 14px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: none;
}

.article-dropdown.active {
    display: block;
}

.article-dropdown .art-item {
    margin-bottom: 0;
    border-radius: 0;
    border-bottom: 1px solid #f1f5f9;
}

.article-dropdown .art-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.article-dropdown .art-item:hover {
    background: #eff6ff;
}

.article-dropdown .no-results {
    padding: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

/* ---- Contact Grid ---- */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.contact-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
}

.contact-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 12px;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.contact-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
}

.contact-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
}

.contact-link {
    color: var(--blue-700);
    text-decoration: none;
}

.contact-link:hover {
    text-decoration: underline;
}

/* ---- Email Field (Rapport) ---- */
.email-field-wrapper {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    border: 2px solid #c6d8f5;
    border-radius: 14px;
    padding: 16px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.email-field-wrapper:focus-within {
    border-color: var(--orange-600);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}

.email-field-wrapper .field > span {
    font-size: 13px;
    font-weight: 700;
    color: #1e40af;
    letter-spacing: 0.3px;
}

textarea.email-textarea {
    width: 100%;
    min-height: 64px;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.6;
    padding: 12px 14px;
    border: 2px solid #d1d5f0;
    border-radius: 10px;
    background: #fff;
    resize: vertical;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea.email-textarea:focus {
    border-color: var(--orange-600);
    box-shadow: var(--focus);
    outline: none;
}

textarea.email-textarea::placeholder {
    color: #94a3b8;
    font-size: 13px;
}

/* ---- Report / Rapport View ---- */
.report-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.report-container {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 30px;
    max-width: 900px;
    margin: 0 auto;
}

/* Report Header */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.report-logo img {
    height: 50px;
    width: auto;
}

.report-title {
    text-align: right;
}

.report-title h1 {
    font-size: 28px;
    font-weight: 900;
    color: var(--blue-900);
    margin: 0 0 5px 0;
}

.report-title .report-order-no {
    font-size: 18px;
    font-weight: 600;
    color: var(--muted);
}

/* Report Sections */
.report-section {
    margin-bottom: 25px;
}

.report-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--blue-700);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.report-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.report-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.report-info-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
}

.report-info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

/* Report Tables */
.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.report-table th,
.report-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.report-table th {
    background: #f8fafc;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--muted);
}

.report-table td {
    font-size: 14px;
}

.report-table tr:last-child td {
    border-bottom: none;
}

.report-table .text-right {
    text-align: right;
}

.report-table .total-row {
    background: #f1f5f9;
    font-weight: 700;
}

/* Report Signature */
.report-signature {
    display: flex;
    justify-content: flex-end;
    gap: 32px;
    flex-wrap: wrap;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.report-signature-box {
    text-align: center;
}

.report-signature-img {
    max-width: 200px;
    max-height: 80px;
    margin-bottom: 10px;
}

.report-signature-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
}

.report-signature-date {
    font-size: 13px;
    font-weight: 500;
}

/* Report Text Blocks */
.report-text-block {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Report Photos Grid */
.report-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.report-photo-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
}

.report-photo-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 300px;
}

.report-photo-date {
    padding: 4px 8px;
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    background: #f1f5f9;
}

/* Report Footer */
.report-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

/* Email Dialog */
.email-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.email-dialog[hidden] {
    display: none !important;
}

.email-dialog-content {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 24px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow2);
}

.email-dialog-content h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--blue-900);
}

.email-dialog-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* ========== CHECKLISTEN STYLES ========== */

.checklist-create {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checklist-create .btn {
    align-self: flex-start;
}

.checklist-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.checklist-header-info h2 {
    margin: 0;
}

.checklist-status {
    font-size: 14px;
}

.checklist-header-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .field-row {
        grid-template-columns: 1fr;
    }
}

.checkbox-row {
    margin: 8px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    background: var(--gray-100);
    border-radius: var(--radius);
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: var(--gray-200);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--blue-700);
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    white-space: nowrap;
}

.checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Checklisten-Lines */
.checklist-lines {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checklist-line-item {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px;
}

.checklist-line-header {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.line-num {
    font-weight: 700;
    color: var(--blue-700);
    min-width: 28px;
}

.line-task {
    flex: 1;
    font-weight: 500;
}

.checklist-line-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.cl-status-select {
    padding: 10px 14px !important;
    border: 3px solid #6b7280 !important;
    border-radius: 10px !important;
    font-size: 15px !important;
    min-width: 180px;
    background: #ffffff !important;
    font-weight: 600;
    color: #1e293b;
    appearance: auto;
    -webkit-appearance: menulist;
    height: auto !important;
}
.cl-status-select:focus {
    border-color: #f97316 !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25) !important;
}

.checklist-line-notes {
    margin-top: 8px;
}

.cl-notes-input {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 40px;
}
.cl-notes-input:focus {
    border-color: var(--orange-600);
    box-shadow: var(--focus);
    outline: none;
}

/* Badges */
.list-item-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge.green {
    background: #d4edda;
    color: #155724;
}

.badge.amber {
    background: #fff3cd;
    color: #856404;
}

.badge.blue {
    background: #cce5ff;
    color: #004085;
}

.badge.red {
    background: #f8d7da;
    color: #721c24;
}

.badge.gray {
    background: #e5e7eb;
    color: #4b5563;
}

/* Checklist Status Badges in Overview */
.cl-status-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.cl-status-badges .badge {
    font-size: 11px;
    padding: 2px 6px;
}

.cl-complete {
    border-left: 4px solid #22c55e !important;
}

.cl-incomplete {
    border-left: 4px solid #f59e0b !important;
}

/* Checklisten Fotos */
.cl-photo-section {
    margin-top: 12px;
}

.cl-photo-upload-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.cl-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.cl-photo-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
}

.cl-photo-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.cl-photo-item .cl-photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 38, 38, 0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Signatur-Preview */
.signature-preview {
    max-width: 100%;
    max-height: 150px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

/* Button Styles */
.btn.full-width {
    width: 100%;
}

.btn.danger {
    color: #dc3545;
    border-color: #dc3545;
}

.btn.danger:hover {
    background: #dc3545;
    color: white;
}

.button-row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* Signature Gallery */
.signature-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}
.signature-gallery-item {
    position: relative;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}
.signature-gallery-item img {
    width: 100%;
    display: block;
}
.signature-gallery-item .sig-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--gray-500);
    background: var(--gray-50);
}
.signature-gallery-item .btn-delete-sig {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
}
.section-subtitle {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 6px;
}

/* Clickable List Items */
.list-item.clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.list-item.clickable:hover {
    background: var(--gray-100);
}

.list-item-main {
    flex: 1;
}

.list-item-title {
    font-weight: 600;
    color: var(--blue-900);
}

.list-item-sub {
    font-size: 13px;
    color: var(--gray-600);
    margin-top: 4px;
}

/* =========================================================
   Offline UI Styles
   ========================================================= */

.offline-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
    text-align: center;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 14px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
}

.sync-badge {
    background: white;
    color: #d35400;
    border-radius: 50%;
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    padding: 0 4px;
}

/* Explizites display schlägt das hidden-Attribut – ohne diese Regeln ist die
   Leiste (und die Zahl) DAUERHAFT sichtbar, auch wenn der Code sie versteckt. */
.offline-bar[hidden] { display: none; }
.sync-badge[hidden] { display: none; }

.offline-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    white-space: nowrap;
    max-width: 90vw;
}

.offline-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.offline-toast-ok { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.offline-toast-warn { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.offline-toast-err { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.offline-toast-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* Offline Vorbereiten Button */
.offline-prep-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.offline-prep-btn {
    white-space: nowrap;
    font-size: 14px !important;
    padding: 8px 16px !important;
}

.offline-prep-status {
    font-size: 13px;
    color: var(--gray-600, #4b5563);
    flex: 1;
    min-width: 200px;
}

.offline-prep-progress {
    background: var(--gray-200, #e5e7eb);
    border-radius: 6px;
    height: 8px;
    margin-top: 4px;
    overflow: hidden;
}

.offline-prep-progress-bar {
    background: linear-gradient(90deg, #003878, #e67e22);
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* Print Styles */
@media print {
    body {
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .app {
        min-height: auto;
    }

    .topbar,
    .no-print,
    #btnBack,
    #btnSettings {
        display: none !important;
    }

    .content {
        padding: 0 !important;
        background: #fff !important;
    }

    .report-container {
        box-shadow: none !important;
        padding: 0 !important;
        max-width: none !important;
    }

    .report-section {
        page-break-inside: avoid;
    }

    .report-table {
        page-break-inside: auto;
    }

    .report-table tr {
        page-break-inside: avoid;
    }

    .report-photos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .report-photo-item {
        page-break-inside: avoid;
    }

    .report-photo-item img {
        max-height: 250px;
    }
}

/* Red tile button */
.btn.tile.red {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
}

.btn.tile.red:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Teal tile button (Abnahmeprotokoll) */
.btn.tile.teal {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(20, 184, 166, 0.25);
}

.btn.tile.teal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.4);
}

/* ========== ABNAHMEPROTOKOLL STYLES ========== */

/* Toggle Switch Styles */
.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 12px;
    gap: 16px;
}

.toggle-item > span {
    flex: 1;
    font-size: 14px;
    color: var(--text);
    line-height: 1.4;
}

.toggle-item-with-reason {
    flex-direction: column;
    align-items: stretch;
}

.toggle-item-with-reason .toggle-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.toggle-item-with-reason .toggle-main > span {
    flex: 1;
    font-size: 14px;
    color: var(--text);
    line-height: 1.4;
}

.toggle-reason {
    margin-top: 12px;
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
}

.toggle-reason:focus {
    border-color: var(--orange-600);
    box-shadow: var(--focus);
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: relative;
    width: 52px;
    height: 28px;
    background: #cbd5e1;
    border-radius: 28px;
    transition: all 0.3s ease;
}

.toggle-switch .slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .slider {
    background: #10b981;
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(24px);
}

.toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    min-width: 30px;
}

.toggle-switch input:checked ~ .toggle-label {
    color: #10b981;
}

/* Radio Button Styles für Acceptance */
.acceptance-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
}

.radio-item:hover {
    background: #f1f5f9;
}

.radio-item:has(input:checked) {
    background: #eff6ff;
    border-color: var(--blue-700);
}

.radio-item input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--blue-700);
    cursor: pointer;
}

.radio-item span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

/* Abnahmeprotokoll Signature Canvas */
#accSigCanvas {
    width: 100%;
    display: block;
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    background: #fff;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Responsive Anpassungen für Abnahmeprotokoll */
@media (max-width: 599px) {
    .toggle-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .toggle-item > span {
        font-size: 13px;
    }

    .toggle-switch {
        align-self: flex-end;
    }

    .radio-item {
        padding: 10px 14px;
    }

    .radio-item span {
        font-size: 13px;
    }

    .acceptance-options {
        gap: 8px;
    }
}

@media (min-width: 600px) {
    .acceptance-options {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* ===== INLINE ZEITERFASSUNG & MATERIAL ===== */

.section-header-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
    gap: 8px;
}

.section-header-toggle .section-title {
    flex: 1;
    margin: 0;
}

.toggle-summary {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.toggle-arrow {
    font-size: 12px;
    color: var(--muted);
    transition: transform 0.2s;
}

.section-header-toggle.collapsed .toggle-arrow {
    transform: rotate(-90deg);
}

.collapsible-content {
    margin-top: 12px;
    transition: max-height 0.3s ease;
    overflow: hidden;
}

.section-header-toggle.collapsed + .collapsible-content {
    display: none;
}

/* Inline Lines List */
.inline-lines-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.inline-line-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--surface);
    border-radius: 8px;
    font-size: 14px;
}

.inline-line-row .il-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.inline-line-row .il-top {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-line-row .il-hours {
    font-weight: 700;
    color: var(--primary);
    min-width: 55px;
}

.inline-line-row .il-art {
    font-weight: 600;
    color: var(--primary);
    min-width: 70px;
}

.inline-line-row .il-qty {
    font-weight: 700;
    color: var(--text);
}

.inline-line-row .il-desc {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inline-line-row .il-actions {
    display: flex;
    gap: 4px;
}

.inline-line-row .il-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.6;
}

.inline-line-row .il-actions button:hover {
    opacity: 1;
    background: rgba(0,0,0,0.05);
}

/* Inline Forms */
.section-subtitle {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.inline-form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.inline-input {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
    background: var(--bg);
}

.inline-input.small {
    width: auto;
    flex: 1;
}

.inline-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.15);
}

textarea.inline-input {
    resize: vertical;
    margin-bottom: 8px;
}

.inline-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.btn.small {
    padding: 6px 16px;
    font-size: 13px;
}

.inline-tabs {
    margin-bottom: 8px;
}

.inline-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.inline-wrapper .art-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.inline-wrapper .art-dropdown.active {
    display: block;
}

/* Inline total row */
.inline-total {
    display: flex;
    justify-content: flex-end;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    border-top: 1px solid var(--border);
    margin-bottom: 8px;
}

/* ===== VIEW TOGGLE BAR (Aufträge / Kalender) ===== */

.view-toggle-bar[hidden] { display: none !important; }

.view-toggle-bar {
    display: flex;
    gap: 0;
    max-width: 980px;
    margin: 0 auto 8px auto;
    background: #fff;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
}

.view-toggle-btn {
    flex: 1;
    padding: 12px 12px;
    border: none;
    background: #f1f5f9;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.view-toggle-btn:first-child { border-radius: var(--radius-lg) 0 0 0; }
.view-toggle-btn:last-child { border-radius: 0 var(--radius-lg) 0 0; }

.view-toggle-btn.active {
    background: var(--card);
    color: var(--blue-700);
    border-bottom-color: var(--orange-600);
}

.view-toggle-btn:not(.active):hover {
    background: #e2e8f0;
    color: var(--text);
}

/* ===== CALENDAR TOOLBAR ===== */

.cal-toolbar {
    max-width: 980px;
    margin: 0 auto 12px auto;
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
}

.cal-mode-toggle {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.cal-mode-btn {
    padding: 6px 16px;
    border: none;
    background: var(--gray-50);
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cal-mode-btn.active {
    background: var(--blue-700);
    color: #fff;
}

.cal-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cal-nav-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    transition: all 0.15s;
}

.cal-nav-btn:hover { background: var(--gray-100); }
.cal-nav-btn:active { background: var(--gray-200); }

.cal-nav-today {
    padding: 6px 14px;
    border: 1px solid var(--blue-700);
    border-radius: 8px;
    background: transparent;
    color: var(--blue-700);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.cal-nav-today:hover { background: var(--blue-700); color: #fff; }

.cal-date-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-left: auto;
}

/* ===== CALENDAR DAY VIEW ===== */

.cal-day-view { position: relative; }

/* ===== CALENDAR DAY TIMELINE (RoutenplanungApp style) ===== */

.cal-day-timeline {
    padding: 0;
}

.cal-timeline-container {
    position: relative;
    height: 840px; /* 14h * 60px */
    margin-left: 50px;
}

/* Hour lines */
.cal-timeline-hour {
    position: absolute;
    left: 0; right: 0;
    border-top: 1px solid var(--gray-200);
    z-index: 1;
}
.cal-timeline-hour.noon { border-top: 2px solid var(--orange-600); }
.cal-timeline-hour-label {
    position: absolute;
    left: -50px; top: -9px;
    width: 44px;
    text-align: right;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
}

/* Noon marker */
.cal-timeline-noon {
    position: absolute;
    left: 0; right: 0;
    height: 0;
    border-top: 2px dashed var(--orange-600);
    z-index: 2;
    opacity: 0.6;
}

/* Current time marker */
.cal-timeline-now {
    position: absolute;
    left: -8px; right: 0;
    height: 0;
    border-top: 2px solid #dc2626;
    z-index: 5;
}
.cal-timeline-now::before {
    content: '';
    position: absolute;
    left: -4px; top: -5px;
    width: 8px; height: 8px;
    background: #dc2626;
    border-radius: 50%;
}
.cal-timeline-now-label {
    position: absolute;
    left: -50px; top: -9px;
    width: 44px;
    text-align: right;
    font-size: 10px;
    font-weight: 700;
    color: #dc2626;
}

/* Schedule blocks (absolutely positioned by time) */
.cal-block-abs {
    position: absolute;
    left: 4px; right: 12px;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    z-index: 3;
    color: #fff;
    overflow: hidden;
    transition: box-shadow 0.15s;
    min-height: 28px;
}
.cal-block-abs.short-block {
    right: 50%;
}
.cal-block-side-info {
    position: absolute;
    left: 52%;
    right: 12px;
    color: var(--text);
    font-size: 12px;
    z-index: 3;
    pointer-events: none;
}
.cal-block-side-info .side-title {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-block-side-info .side-sub {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-block-abs:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.2); z-index: 4; }
.cal-block-abs.repair { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }
.cal-block-abs.service { background: linear-gradient(135deg, var(--blue-700) 0%, var(--blue-800) 100%); }
.cal-block-abs.task { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }

.cal-block-time {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.9;
}

.cal-block-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.cal-block-sub {
    font-size: 11px;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-block-drive {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 2px;
}

.cal-block-route {
    position: absolute;
    top: 6px; right: 8px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== CALENDAR WEEK VIEW ===== */

.cal-week-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

@media (max-width: 600px) {
    .cal-week-grid {
        grid-template-columns: 1fr;
    }
}

.cal-week-col {
    background: var(--card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.cal-week-day-hdr {
    padding: 8px 10px;
    background: var(--blue-800);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.cal-week-day-hdr.today {
    background: var(--orange-600);
}

.cal-week-day-body {
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 80px;
}

.cal-week-card {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    border-left: 4px solid var(--blue-700);
    transition: background 0.15s;
}

.cal-week-card:hover { background: var(--gray-100); }
.cal-week-card.repair { border-left-color: #dc2626; }
.cal-week-card.service { border-left-color: var(--blue-700); }
.cal-week-card.task { border-left-color: #8b5cf6; }

.cal-week-card-time {
    font-size: 11px;
    font-weight: 700;
    color: var(--blue-700);
}

.cal-week-card.repair .cal-week-card-time { color: #dc2626; }
.cal-week-card.task .cal-week-card-time { color: #8b5cf6; }

.cal-week-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-week-card-sub {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-week-empty {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--gray-400);
}

/* ===== COMPLETED TASK STYLES ===== */

.cal-block-abs.completed {
    opacity: 0.55;
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%) !important;
}
.cal-block-abs.completed .cal-block-title { text-decoration: line-through; }

.cal-week-card.completed {
    opacity: 0.55;
    border-left-color: #6b7280 !important;
}
.cal-week-card.completed .cal-week-card-title { text-decoration: line-through; color: var(--muted); }
.cal-week-card.completed .cal-week-card-time { color: #6b7280 !important; }

.task-complete-btn {
    background: #16a34a !important;
    color: #fff !important;
    border: none !important;
    font-weight: 600;
}
.task-complete-btn:hover { background: #15803d !important; }

/* ===== SCHEDULE INFO POPUP ===== */

.schedule-info-popup {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
}

.schedule-info-popup[hidden] { display: none; }

.schedule-info-sheet {
    background: var(--card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow2);
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.schedule-info-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--border);
}

.schedule-info-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--blue-700);
    text-transform: uppercase;
}

.schedule-info-kicker.repair { color: #dc2626; }
.schedule-info-kicker.task { color: #8b5cf6; }

.schedule-info-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-top: 2px;
}

.schedule-info-body {
    padding: 16px 20px;
}

.schedule-info-time {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--blue-700);
    margin-bottom: 12px;
}

.schedule-info-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
    color: var(--text);
}

.schedule-info-icon {
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.schedule-info-section {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.schedule-info-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.schedule-info-todo {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    white-space: pre-wrap;
    background: var(--gray-50);
    padding: 10px 12px;
    border-radius: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.schedule-info-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
}

.schedule-info-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px 20px;
}

.schedule-info-actions .btn { flex: 1; }

/* =========================================================
   i18n – Language Selector, Mic Buttons, Customer View
   ========================================================= */

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255,255,255,.14);
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: background .15s ease;
}

.lang-select:hover {
    background: rgba(255,255,255,.22);
}

.lang-select:focus {
    box-shadow: var(--focus);
}

.lang-select option {
    background: var(--blue-800);
    color: #fff;
}

.customer-view-btn {
    position: relative;
}

.customer-view-btn.active {
    background: var(--orange-600);
    color: #fff;
}

.customer-view-btn.active::after {
    content: "DE";
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 8px;
    font-weight: 700;
    background: #fff;
    color: var(--orange-600);
    border-radius: 4px;
    padding: 1px 3px;
    line-height: 1;
}

/* Mic Button */
.mic-field {
    position: relative;
}

.mic-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: var(--gray-100);
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease, transform .15s ease;
    z-index: 2;
}

.mic-btn:hover {
    background: var(--gray-200);
    color: var(--blue-700);
    transform: scale(1.05);
}

.mic-btn.mic-active {
    background: #ef4444;
    color: #fff;
    animation: mic-pulse 1.2s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* Translation indicator */
.translating-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--blue-700);
    padding: 4px 8px;
    background: rgba(0,89,179,.08);
    border-radius: 8px;
    margin-top: 4px;
}

.translating-indicator::before {
    content: "";
    width: 12px;
    height: 12px;
    border: 2px solid var(--blue-700);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Customer view banner */
.customer-view-banner {
    display: none;
    background: var(--orange-600);
    color: #fff;
    text-align: center;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
}

.customer-view-banner.visible {
    display: block;
}

/* ===== AUTO TIMER ===== */

.auto-timer-card {
    background: linear-gradient(135deg, var(--blue-700) 0%, #1a56db 100%);
    color: #fff;
    padding: 12px 16px;
}

.auto-timer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auto-timer-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auto-timer-icon { font-size: 20px; }

.auto-timer-time {
    font-size: 28px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}

.auto-timer-status {
    font-size: 12px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auto-timer-card.running {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.auto-timer-card.running .auto-timer-icon::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #34d399;
    border-radius: 50%;
    margin-left: 6px;
    animation: timerPulse 1.5s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.auto-timer-actions {
    display: flex;
    gap: 8px;
}

.timer-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
}

.timer-btn:hover {
    background: rgba(255,255,255,0.3);
}

.auto-timer-mode {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 11px;
    transition: background 0.2s;
    cursor: pointer;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--orange-600);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* ===== BARCODE SCANNER ===== */

.input-with-scan {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.input-with-scan input {
    flex: 1;
    min-width: 0;
}

.btn-scan {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    min-width: 48px;
    background: var(--gray-50);
    border: 2px solid var(--border);
    border-radius: 14px;
    color: var(--blue-700);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-scan:hover {
    background: var(--blue-700);
    color: #fff;
    border-color: var(--blue-700);
}

.scanner-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-overlay[hidden] { display: none; }

.scanner-sheet {
    background: var(--card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    font-weight: 700;
    font-size: 16px;
    background: var(--blue-700);
    color: #fff;
}

.scanner-header .icon-btn { color: #fff; }

.scanner-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
}

.scanner-viewport video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 100px;
    border: 2px solid var(--orange-600);
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.4);
}

.scanner-status {
    padding: 12px 16px;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

/* ===== ORDER HISTORY ===== */

.history-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 10px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}

.history-item:hover {
    background: #e2e8f0;
}

.history-item-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 12px;
    color: var(--muted);
}

.history-item-arrow {
    color: var(--muted);
    flex-shrink: 0;
}

/* ===== COMPLETION WIZARD ===== */

.wizard-trigger {
    width: 100%;
    margin-top: 16px;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--orange-600) 0%, #e85d04 100%);
    border-radius: var(--radius-lg);
    letter-spacing: 0.3px;
}

.wizard-trigger:hover {
    filter: brightness(1.05);
}

.wizard-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;           /* über dem Offline-/Sync-Balken (9999), sonst deckt er die Buttons zu */
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.wizard-overlay[hidden] { display: none; }

.wizard-sheet {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--blue-700);
    color: #fff;
    font-weight: 700;
    font-size: 18px;
}

.wizard-header .icon-btn { color: #fff; }

.wizard-progress {
    height: 4px;
    background: var(--border);
}

.wizard-progress-bar {
    height: 100%;
    background: var(--orange-600);
    transition: width 0.4s ease;
}

.wizard-step-label {
    text-align: center;
    padding: 12px 16px 4px;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wizard-body {
    flex: 1;
    padding: 16px 20px;
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
}

.wizard-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--card);
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
    position: sticky;
    bottom: 0;
}

.wizard-footer .btn {
    flex: 1;
    padding: 14px;
    font-size: 15px;
}

.wizard-check-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.wizard-check-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.wizard-check-label {
    flex: 1;
    font-weight: 600;
}

.wizard-check-value {
    font-size: 14px;
    color: var(--muted);
}

.wizard-check-ok { color: #059669; }
.wizard-check-warn { color: var(--orange-600); }

.wizard-done {
    text-align: center;
    padding: 40px 20px;
}

.wizard-done-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.wizard-done-text {
    font-size: 20px;
    font-weight: 700;
    color: #059669;
}

/* =========================================================
   Welle 2: Objekt-Lebensakte, QR, Dispo-Board, Bewertung
   ========================================================= */

/* --- Objekt-Lebensakte --- */
.obj-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.obj-name {
    font-size: 18px;
    font-weight: 700;
}

.obj-address {
    color: var(--muted);
    font-size: 14px;
    margin-top: 2px;
}

.obj-id {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
}

.obj-section-title {
    margin: 16px 4px 8px;
}

.obj-entry {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    cursor: pointer;
}

.obj-entry:active {
    background: var(--bg);
}

.obj-entry-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.obj-entry-date {
    font-size: 13px;
    color: var(--muted);
}

.obj-status {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
}

.obj-status-offen { background: #dbeafe; color: #1d4ed8; }
.obj-status-visiert { background: #dcfce7; color: #15803d; }
.obj-status-fakturiert { background: #e2e8f0; color: #334155; }
.obj-status-storniert { background: #fee2e2; color: #b91c1c; }

.obj-entry-title {
    font-weight: 700;
    font-size: 15px;
}

.obj-entry-product {
    font-size: 13px;
    color: var(--text);
    margin-top: 2px;
}

.obj-entry-notes {
    font-size: 13px;
    color: var(--muted);
    margin-top: 6px;
    white-space: pre-line;
}

.obj-history-btn {
    width: 100%;
    margin-top: 10px;
}

/* --- QR-Dialog --- */
.qr-dialog {
    text-align: center;
}

.qr-title {
    font-weight: 700;
    font-size: 17px;
    margin-bottom: 10px;
}

.qr-img {
    width: 200px;
    height: 200px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.qr-sub {
    font-size: 14px;
    margin-top: 8px;
    font-weight: 600;
}

.qr-hint {
    font-size: 13px;
    color: var(--muted);
    margin-top: 6px;
}

/* --- Dispo-Board --- */
.board-columns {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    align-items: flex-start;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.board-col {
    flex: 0 0 240px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
}

.board-col-pool {
    background: #fff7ed;
    border-color: #fdba74;
}

.board-col-head {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.board-count {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    padding: 1px 8px;
    color: var(--muted);
}

.board-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 4px solid #94a3b8;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
}

.board-card.st-inArbeit { border-left-color: var(--orange-600); }
.board-card.st-fertig { border-left-color: #16a34a; }

.board-card:active { background: var(--bg); }

.bc-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.bc-id { font-weight: 700; font-size: 14px; }

.bc-cust {
    font-size: 13px;
    margin-top: 3px;
}

.bc-city {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.board-chip {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.chip-plan { background: #e2e8f0; color: #334155; }
.chip-work { background: #ffedd5; color: #c2410c; }
.chip-done { background: #dcfce7; color: #15803d; }

.board-ratings {
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 14px;
}

.board-rating-quote {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
    font-style: italic;
}

/* --- Bewertungslink-Checkbox im Mail-Dialog --- */
.rating-link-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    margin: 4px 0 10px;
    cursor: pointer;
}

.rating-link-row input {
    width: 20px;
    height: 20px;
    accent-color: var(--orange-600);
}

@media (max-width: 600px) {
    .board-col { flex-basis: 210px; }
    .obj-head { flex-direction: column; }
    .obj-head .btn { width: 100%; }
}

/* =========================================================
   TimeTac: Arbeitszeit, Absenzen, Board-Präsenz
   ========================================================= */
.worktime-btn { position: relative; }
.worktime-dot {
    position: absolute; top: 6px; right: 6px;
    width: 9px; height: 9px; border-radius: 50%;
    background: #16a34a; border: 2px solid var(--card, #fff);
}
.worktime-clock { text-align: center; }
.worktime-big { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.worktime-sub { color: var(--muted); font-size: 14px; min-height: 1.2em; }
.worktime-hours { color: var(--muted); font-size: 13px; margin-top: 4px; }
.worktime-actions { display: flex; gap: 10px; margin-top: 14px; }
.worktime-toggle { flex: 1; }
.worktime-toggle.danger { background: #dc2626; }
.btn.danger { background: #dc2626; color: #fff; }
.sick-btn { width: 100%; margin-bottom: 12px; }
.absence-dates { display: flex; gap: 10px; }
.absence-dates .field { flex: 1; }

/* Board: Präsenz/Abwesenheit */
.board-absent {
    background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
    border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px;
}
.board-tech-badge {
    display: inline-block; font-size: 12px; font-weight: 700;
    padding: 2px 10px; border-radius: 999px; margin-bottom: 8px;
}
.tb-in { background: #dcfce7; color: #15803d; }
.tb-absent { background: #fee2e2; color: #b91c1c; }
.board-col-in { border-color: #86efac; }
.board-col-absent { border-color: #fca5a5; background: #fef2f2; }

/* TimeTac: Listen (Absenzen, Zeiteinträge, Freigaben) */
.tt-list { margin-top: 8px; }
.tt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--border); }
.tt-row:last-child { border-bottom: none; }
.tt-main { min-width: 0; }
.tt-title { font-weight: 600; font-size: 14px; }
.tt-sub { color: var(--muted); font-size: 13px; }
.tt-open { color: #dc2626; font-weight: 600; }
.tt-badge { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.tt-badge.st-open { background: #e2e8f0; color: #334155; }
.tt-badge.st-ok { background: #dcfce7; color: #15803d; }
.tt-badge.st-cancel { background: #fee2e2; color: #b91c1c; }
.tt-approve-actions { display: flex; gap: 6px; }
.btn.small { padding: 6px 12px; font-size: 14px; min-width: auto; }
#btnAddEntry { width: 100%; margin-bottom: 8px; }

/* TimeTac Admin-Schalter */
.tt-toggle-card { background: #eff6ff; border: 1px solid #bfdbfe; }
.tt-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tt-toggle-title { font-weight: 700; font-size: 15px; }
.tt-toggle-sub { color: var(--muted); font-size: 13px; }
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; }
.switch-slider::before { content: ""; position: absolute; height: 24px; width: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .switch-slider { background: #16a34a; }
.switch input:checked + .switch-slider::before { transform: translateX(22px); }

/* Report: Kunde/Objekt getrennt nebeneinander */
.report-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 18px 0;
}
.report-party {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    background: #fbfcfe;
}
.report-party-name { font-weight: 700; font-size: 15px; margin: 4px 0 6px; }
.report-party-line { font-size: 13px; color: #333; line-height: 1.5; }
@media (max-width: 640px) { .report-parties { grid-template-columns: 1fr; } }
@media print {
    .report-parties { grid-template-columns: 1fr 1fr; }
    .report-party { background: #fff; break-inside: avoid; }
}

/* Auto-Speichern: dezenter Hinweis statt Speicher-Button */
.autosave-hint {
    margin-top: 12px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}
.saved-flash { transition: opacity .3s; }

/* Auftragskarte: Kunde/Objekt getrennte Zeilen */
.order-object {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

/* Wizard: Positionen direkt erfassen */
.wiz-lines { margin: 10px 0 4px; }
.wiz-line {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid var(--border);
}
.wiz-line:last-child { border-bottom: none; }
.wiz-line-desc { flex: 1; min-width: 0; font-size: 14px; }
.wiz-hours, .wiz-qty {
    width: 84px; padding: 10px 8px; font-size: 16px; text-align: right;
    border: 1px solid var(--border); border-radius: 8px;
}
.wiz-unit { color: var(--muted); font-size: 13px; min-width: 34px; }
.wiz-saved { outline: 2px solid #16a34a; }
.wiz-add-row { display: flex; gap: 8px; margin-top: 12px; }
.wiz-add-row input[type="number"] { width: 90px; }
.wiz-add-row input[type="text"] { flex: 1; min-width: 0; }
.wiz-add-row input { padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; }
.wiz-add-mat input[type="text"]#wizMatUnit { flex: 0 0 64px; }
.wiz-hint { padding: 8px 0; font-size: 14px; }
.wiz-photo-btns { display: flex; gap: 10px; margin-top: 12px; }
.wiz-photo-btns .btn { flex: 1; }
.wiz-nameplate { margin-top: 10px; font-size: 14px; }

/* Zweite Zeile in Kopf-Feldern (z.B. Kundenadresse unter dem Kundennamen) */
.kv-sub {
    font-weight: 400;
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
}

/* Hebebühne ja/nein Umschalter */
.hb-toggle { display: flex; gap: 8px; margin-top: 4px; }
.hb-btn {
    flex: 0 0 auto; min-width: 84px; padding: 10px 18px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--card); font-size: 15px; font-weight: 600; cursor: pointer;
}
.hb-btn.active { background: var(--blue-700); color: #fff; border-color: var(--blue-700); }
.hb-btn:disabled { opacity: .5; cursor: default; }

/* Produkt-Zusatzfelder: 2-spaltiges Raster */
.extra-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}
@media (max-width: 480px) { .extra-grid { grid-template-columns: 1fr; } }

/* =========================================================
   Handy-Feinschliff (schmale Screens)
   ========================================================= */
@media (max-width: 520px) {
    /* Logo überlappt sonst die Topbar-Icons */
    .brand-logo { display: none; }
    /* Timer-Bar: Buttons in eigene Zeile statt rechts rauslaufen */
    .auto-timer-row { flex-wrap: wrap; }
    .auto-timer-actions { width: 100%; display: flex; gap: 8px; }
    .auto-timer-actions .btn { flex: 1; }
}

/* Grosses Mikrofon im KI-Rapport-Dialog (App-Spracherkennung statt Tastatur-Diktat) */
.ai-dialog .mic-btn.ai-mic {
    top: auto;
    bottom: 10px;
    right: 10px;
    width: 52px;
    height: 52px;
}
.ai-dialog .mic-btn.ai-mic svg { width: 26px; height: 26px; }

/* =========================================================
   Service-Coach, Abrechnungs-Ampel, Einfacher Modus, TTS
   ========================================================= */

/* Service-Coach Dialog */
.svc-dialog { max-width: 420px; }
.svc-intro { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.svc-list { text-align: left; }
.svc-item { padding: 7px 0; font-size: 14.5px; border-bottom: 1px solid var(--border); }
.svc-item:last-child { border-bottom: none; }
.svc-item.svc-clean {
    background: #fefce8; border: 1px solid #fde047; border-radius: 8px;
    padding: 10px; font-weight: 700; margin: 4px 0;
}

/* Abrechnungs-Ampel */
.billing-legend { font-size: 13px; margin: 4px 4px 10px; }
.bill-row { cursor: pointer; }
.bill-warn { color: #b45309; font-weight: 700; }

/* Einfacher Modus: grosser Start-Knopf, Experten-Karten weg */
.simple-start-btn {
    width: 100%; padding: 22px; font-size: 20px; font-weight: 800;
    background: var(--orange-600); color: #fff; border: none; border-radius: 14px;
    cursor: pointer; box-shadow: 0 4px 14px rgba(234, 88, 12, .35);
}
.simple-progress { text-align: center; color: var(--muted); font-weight: 700; margin: 10px 0; }
.flow-ai-btn.simple-ai { width: 100%; }
body.simple-mode .card:has(#toggleTimeSection),
body.simple-mode .card:has(#toggleMatSection),
body.simple-mode .card:has(#detailInvoice),
body.simple-mode .card:has(#toggleHistorySection),
body.simple-mode #autoTimerBar,
body.simple-mode .detail-actions-grid,
body.simple-mode .extra-grid,
body.simple-mode .hb-toggle { display: none !important; }

/* Vorlesen-Knopf */
.field-label-row { display: flex; align-items: center; gap: 8px; }
.tts-btn {
    border: 1px solid var(--border); background: var(--card); border-radius: 8px;
    font-size: 15px; padding: 2px 10px; cursor: pointer; line-height: 1.4;
}

/* Fix: globale input[type=...]-Regel (width:100%) übersteuert die Wizard-Zeilen-Felder.
   Höhere Spezifität -> Stunden-/Mengen-Felder bleiben kompakt, Beschreibung bekommt Platz. */
.wiz-line input.wiz-hours,
.wiz-line input.wiz-qty {
    width: 84px;
    flex: 0 0 84px;
    min-height: auto;
    padding: 10px 8px;
}
.wiz-line-desc {
    flex: 1 1 auto;
    min-width: 45%;
    overflow-wrap: anywhere;
}
.wiz-add-row input[type="number"] { width: 90px; flex: 0 0 90px; }
.wiz-add-row input[type="text"] { width: auto; flex: 1 1 auto; min-width: 0; }
.wiz-add-mat input#wizMatUnit { flex: 0 0 64px; width: 64px; }

/* Wizard: Vollausbau (Beschriftungen, editierbare Zeilen, Artikelsuche, Mic) */
.wiz-section-label {
    font-size: 12px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .5px; margin: 14px 0 6px;
}
.wiz-line input.wiz-line-text {
    flex: 1 1 auto; min-width: 40%; width: auto;
    min-height: auto; padding: 10px 8px;
}
.wiz-art-search { display: flex; gap: 8px; }
.wiz-art-search input { flex: 1 1 auto; min-width: 0; }
.wiz-art-search .btn { flex: 0 0 auto; }
.wiz-art-results {
    border: 1px solid var(--border); border-radius: 10px; background: var(--card);
    margin-top: 6px; max-height: 220px; overflow-y: auto;
}
.wiz-art-item { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 14px; }
.wiz-art-item:last-child { border-bottom: none; }
.wiz-art-item:active { background: var(--bg); }
.mic-btn.wiz-mic-inline { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.wiz-check-group { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.wiz-check-group label { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.wiz-check-group input { width: 20px; height: 20px; }
.photo-waiver-info {
    background: #fefce8; border: 1px solid #fde047; border-radius: 10px;
    padding: 10px 12px; margin-top: 10px; font-size: 14px;
}

/* Admin: Mindestzeiten-Karte */
.minh-grid { display: flex; gap: 12px; margin-top: 10px; }
.minh-grid label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.minh-grid input { min-height: auto; padding: 10px; }

/* Visiert-Sperre: Lösch-/Edit-Buttons in allen Listen ausblenden, solange der Auftrag gesperrt ist */
body.order-locked .btn-del,
body.order-locked .il-del,
body.order-locked .il-edit,
body.order-locked .btn-delete-sig { display: none; }

/* Sauberkeits-Bestätigung (Abschluss-Dialog) */
.clean-line { display: flex; align-items: center; gap: 10px; padding: 8px 2px; font-size: 15px; cursor: pointer; }
.clean-line input { width: 22px; height: 22px; flex: 0 0 22px; }

/* Interner Büro-Vermerk (nur Admins): dezent, aber erkennbar */
.bo-badge {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 13px;
    padding: 10px 14px;
}

/* Papierrapport-Import: Vorschau-Dialog */
.pi-dialog { max-width: 640px; max-height: 86vh; overflow-y: auto; text-align: left; }
.pi-hint { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.pi-warn { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 8px; }
.pi-sec { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }
.pi-line { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.pi-line input[type="date"] { flex: 0 0 140px; }
.pi-line input.pi-t-hours { flex: 0 0 84px; width: 84px; }
.pi-line-mat input.pi-m-art { flex: 0 0 100px; }
.pi-line-mat input.pi-m-desc { flex: 1 1 160px; min-width: 120px; }
.pi-line-mat input.pi-m-qty { flex: 0 0 70px; width: 70px; }
.pi-line-mat input.pi-m-unit { flex: 0 0 70px; width: 70px; }
.pi-take { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 0; cursor: pointer; }
.pi-take input { width: 20px; height: 20px; flex: 0 0 20px; }
.pi-grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* Nicht übertragene Offline-Änderungen: Leiste + Dialog */
.offline-bar-failed { background: #b45309 !important; }
.sync-badge-failed { background: #fbbf24 !important; color: #7c2d12 !important; }
.sp-dialog { max-width: 560px; max-height: 84vh; overflow-y: auto; text-align: left; }
.sp-hint { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.sp-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.sp-title { font-weight: 600; font-size: 14px; }
.sp-reason { font-size: 13px; color: #b45309; margin-top: 2px; }
.sp-date { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sp-actions { display: flex; gap: 8px; margin-top: 8px; }
.sp-actions .btn { flex: 1; padding: 8px 6px; font-size: 13px; }

/* Auftrag selber erfassen: Wizard + Büro-Prüfliste */
.sc-dialog { max-width: 560px; max-height: 86vh; overflow-y: auto; text-align: left; }
.sc-hint { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.sc-badge { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; font-size: 13px; padding: 10px 14px; }
.sc-row .tt-main { cursor: pointer; }
.sc-row .sc-ack { flex: 0 0 auto; padding: 8px 10px; font-size: 13px; }

/* ---- Spracheingabe: Aufnahme-Fenster (gross und eindeutig, auch für Ungeübte) ---- */
.speech-sheet {
    position: fixed; inset: 0; z-index: 4000;
    background: rgba(15, 23, 42, 0.55);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 16px;
}
.speech-card {
    background: var(--surface, #fff); color: var(--text, #0f172a);
    border-radius: 18px 18px 12px 12px;
    width: 100%; max-width: 480px;
    padding: 22px 20px 20px;
    box-shadow: 0 -6px 28px rgba(0,0,0,.28);
    text-align: center;
}
.speech-title { font-size: 19px; font-weight: 700; margin: 10px 0 6px; }
.speech-live {
    font-size: 15px; line-height: 1.5; color: var(--muted, #64748b);
    min-height: 66px; max-height: 30vh; overflow-y: auto;
    background: rgba(127,127,127,.10); border-radius: 10px; padding: 10px 12px; margin-bottom: 16px;
    text-align: left; word-break: break-word;
}
.speech-stop {
    width: 100%; padding: 16px; font-size: 17px; font-weight: 700;
    border: none; border-radius: 12px; cursor: pointer;
    background: var(--primary, #ea580c); color: #fff;
}
.speech-wave { display: flex; justify-content: center; align-items: flex-end; gap: 5px; height: 34px; }
.speech-wave span {
    width: 6px; border-radius: 3px; background: var(--primary, #ea580c);
    animation: speechPulse 1s ease-in-out infinite;
}
.speech-wave span:nth-child(1) { height: 12px; animation-delay: 0s; }
.speech-wave span:nth-child(2) { height: 22px; animation-delay: .12s; }
.speech-wave span:nth-child(3) { height: 32px; animation-delay: .24s; }
.speech-wave span:nth-child(4) { height: 22px; animation-delay: .36s; }
.speech-wave span:nth-child(5) { height: 12px; animation-delay: .48s; }
@keyframes speechPulse { 0%,100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) {
    .speech-wave span { animation: none; }
}
/* Gerät kann nicht direkt aufnehmen: Knopf bleibt sichtbar und erklärt den Tastatur-Weg */
.mic-btn-hint { opacity: .55; }

/* ---- Rapport-Check: Vorher/Nachher der Rechtschreibkorrektur ---- */
.polish-dialog { max-width: 600px; max-height: 84vh; overflow-y: auto; text-align: left; }
.polish-hint { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.polish-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.polish-label { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.polish-old { font-size: 14px; color: #b45309; text-decoration: line-through; margin-bottom: 4px; word-break: break-word; }
.polish-new { font-size: 15px; color: #15803d; font-weight: 600; word-break: break-word; }

/* 19.10.2026: Artikel-Trefferliste (Material/Arbeit) wurde vom aufklappbaren Bereich abgeschnitten (overflow:hidden) – nur wenige Treffer sichtbar */
.collapsible-content:has(.inline-wrapper) { overflow: visible; }
.inline-wrapper .art-dropdown { max-height: min(60vh, 420px); overflow-y: auto; box-shadow: 0 10px 28px rgba(15,23,42,.18); background: var(--card, #fff); }
