/* ========================================================================== */
/* ROOT & GRUNDEINSTELLUNGEN                                                  */
/* ========================================================================== */
:root { 
    --belfor-red: #E3000F; 
    --belfor-dark: #222222; 
    --bg-color: #f0f2f5; 
    --border: #ced4da; 
    --text-main: #333; 
}

* { 
    box-sizing: border-box; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
}

html, body { 
    margin: 0;
    padding: 0;
    background-color: var(--bg-color); 
    color: var(--text-main);
    width: 100%;
    overflow-x: hidden; /* Verhindert horizontales Scrollen der ganzen Seite */
}

/* ========================================================================== */
/* HEADER & NAVIGATION                                                        */
/* ========================================================================== */
header { 
    user-select: none; 
    background: var(--belfor-dark); 
    color: white; 
    padding-left: 1rem; 
	padding-right: 1rem; 
    border-bottom: 4px solid var(--belfor-red); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: sticky; 
    top: 0; 
    z-index: 50;
    width: 100%;
}

.header-title-wrapper { cursor: pointer; }
.header-title-wrapper h2 { margin: 0; font-size: 1.5rem; letter-spacing: 0.5px; }
.header-title-wrapper .subtitle { font-size: 12px;   opacity: 0.8; }
.header-title-wrapper .highlight { color: var(--belfor-red); }

.header-actions { display: flex; gap: 18px; align-items: center; }

.btn-header { 
    background: rgba(255,255,255,0.1); 
    color: white; 
    border: 1px solid rgba(255,255,255,0.3); 
    padding: 0.5rem 1rem; 
    cursor: pointer; 
    border-radius: 4px; 
    transition: 0.2s; 
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.btn-header:hover { background: var(--belfor-red); border-color: var(--belfor-red); }
.btn-header.icon-only { padding: 0.4rem 0.6rem; font-size: 16px; }
.btn-header.success { border-color: #28a745; }
.btn-header.primary { background: #0b509e; border-color: #0b509e; }
.btn-header.info { background: #17a2b8; border-color: #17a2b8; }

/* ========================================================================== */
/* HAUPTBEREICH & KARTEN                                                      */
/* ========================================================================== */
main { max-width: 1400px; margin: 0 auto; padding: 20px; padding-right:40px; width: 100%; }

.view { display: none; } 
.view.active { display: block; animation: fadeIn 0.3s ease; }

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

.card { 
    background: white; 
    padding: 1.5rem; 
    border-radius: 8px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
    margin-bottom: 1.5rem; 
    width: 100%;
    overflow-x: auto; /* Erlaubt horizontales Scrollen für Tabellen in der Karte */
}

/* ========================================================================== */
/* FORMULARE & EINGABEFELDER                                                  */
/* ========================================================================== */
input, select, textarea { 
    padding: 0.4rem; border: 1px solid var(--border); border-radius: 4px; 
    width: 100%; font-size: 13px; background: #fff; transition: 0.2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--belfor-red); box-shadow: 0 0 0 3px rgba(227, 0, 15, 0.1); }
input[readonly] { background-color: #e9ecef; color: #666; cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { width: auto; margin: 0; cursor: pointer; }
textarea { resize: none; overflow-y: hidden; min-height: 32px; line-height: 1.4; }

label { font-weight: 600; font-size: 12px; color: #495057; margin-bottom: 3px; display: block; }
.label-inline { display: flex; align-items: center; gap: 8px; font-weight: normal; font-size: 11px; margin: 0; cursor: pointer; }
.label-vertical { display: flex; flex-direction: column; align-items: center; font-weight: normal; font-size: 11px; margin: 0; cursor: pointer; }

.form-group { margin-bottom: 1rem; }
.flex-row { display: flex; gap: 0.8rem; align-items: flex-end; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.gap-20 { gap: 20px; }

/* ==========================================
   STICKY EDITOR MENÜ (Rechter Rand)
   ========================================== */
.sticky-side-menu {
    position: fixed;
    top: 150px; 
    right: 0px; 
	padding: 4px;
    display: flex;
    flex-direction: column;
	gap:4px;
    z-index: 1000; 
	background: #f8f9fa;
	border-top-left-radius: 4px;
	border-bottom-left-radius: 4px;
}
.sticky-side-menu button {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15); /* Leichter 3D-Schatten */
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px;
    border-radius: 8px;
}

/* Hover-Effekt: Hebt den Button beim Drüberfahren leicht an */
.sticky-side-menu button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}
/* ========================================================================== */
/* BUTTONS                                                                    */
/* ========================================================================== */
button { user-select: none; cursor: pointer; padding: 0.5rem 1rem; border: none; border-radius: 4px; font-weight: 600; transition: all 0.2s; font-size: 13px; display:inline-flex; align-items:center; gap:5px; justify-content:center;}
.btn-primary { background: var(--belfor-red); color: white; box-shadow: 0 2px 4px rgba(227, 0, 15, 0.2); }
.btn-primary:hover { background: #c2000d; transform: translateY(-1px); }
.btn-primary.green { background: #28a745; }
.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #5a6268; }
.btn-danger { background: #dc3545; color: white; padding: 0.4rem; display: flex; align-items: center; justify-content: center; }
.btn-outline { background: #f8f9fa; border: 1px solid var(--border); color: #495057; }
.btn-outline:hover { background: #e2e6ea; }
.btn-outline.active { background: var(--belfor-dark); color: white; border-color: var(--belfor-dark); }
.btn-outline.warning { border-color: #ffc107; color: #856404; }
.btn-outline.info { border-color: #17a2b8; color: #17a2b8; }
.btn-outline.success { border-color: #28a745; color: #28a745; }
.btn-small { font-size: 11px; padding: 0.4rem 0.6rem; }
.btn-block { width: 100%; display: block; margin-bottom: 10px; }

/* ========================================================================== */
/* PANELS & SECTIONS (Ehemals Inline-Styles)                                  */
/* ========================================================================== */
.section-header { margin-top: 1.5rem; border-bottom: 2px solid var(--belfor-dark); color: var(--belfor-dark); padding-bottom: 6px; margin-bottom: 12px; font-size: 1.1rem; }
.section-header.no-border { border: none; margin: 0; padding: 0; }
.section-divider { border-top: 2px solid var(--belfor-dark); margin-bottom: 0.5rem; margin-top: 0.3rem; }

.panel-light { background: #f8f9fa; padding: 12px; border-radius: 6px; border: 1px solid var(--border); margin-bottom: 12px; }
.panel-blue { background: #e7f5ff; padding: 12px; border-radius: 6px; border: 1px solid #339af0; margin-bottom: 15px; }
.panel-warning { background: #fff3cd; padding: 10px; border-radius: 4px; border: 1px solid #ffeeba; border-left: 4px solid #ffc107; margin-top: 8px; }
.panel-danger { background: #f8d7da; padding: 10px; border-radius: 4px; border: 1px solid #f5c6cb; border-left: 4px solid #dc3545; color: #721c24; margin-top: 8px; font-weight: bold; font-size: 11px; }

.info-text { font-size: 13px; color: #6c757d; }
.info-text.small { font-size: 11px; }
.highlight-text { font-size: 15px; font-weight: bold; color: var(--belfor-red); margin-bottom: 10px; }
.divider-vertical { border-left: 1px solid #339af0; height: 15px; margin: 0 5px; }

/* ========================================================================== */
/* DASHBOARD SPEZIFISCH                                                       */
/* ========================================================================== */
.dashboard-top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.dashboard-title-group { display: flex; align-items: center; gap: 20px; }
.dashboard-title-group h3 { margin: 0; }
.dashboard-action-group { display: flex; gap: 10px; align-items: center;justify-content: flex-end }
.dashboard-action-group button { flex: 1 1 0;}
table { width: 100%; border-collapse: collapse; margin-top: 10px; } 
th, td { padding: 0.6rem; text-align: left; border-bottom: 2px dashed var(--border); vertical-align: middle; } 


.project-list-item { display: flex; flex-direction:column; color: #495057; font-size: 16px; border-bottom: 2px dashed var(--border);  padding:15px; border-radius:5px; }
.project-list-item:hover { background: #FFFDE7; cursor:pointer; }
/* ========================================================================== */
/* DOKU / RAPPORT FORMULAR SPEZIFISCH                                         */
/* ========================================================================== */
.doku-header-bar { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--belfor-dark); padding-bottom: 10px; margin-bottom: 15px; }
.doku-header-left, .doku-header-right { display: flex; gap: 10px; align-items: center; }
.doku-header-right { background: #f8f9fa; padding: 5px 10px; border-radius: 4px; border: 1px solid var(--border); }
.doku-type-badge { background: var(--belfor-dark); color: white; padding: 10px 18px; border-radius: 4px; font-size: 12px; margin-left: 10px; vertical-align: middle; }

.doku-time-box { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.doku-checkbox-row { border-top: 1px dashed #339af0; margin-top: 8px; padding-top: 8px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.doku-footer-bar { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 2rem; background: #f8f9fa; padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border); }

/* ========================================================================== */
/* GRIDS (Personal, Material, Geräte, Fuhrpark)                               */
/* ========================================================================== */
.diary-week-grid { display: grid; gap: 6px; }
.vehicle-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; } 
.v-box { background: #f8f9fa; padding: 10px; border: 1px solid var(--border); border-radius: 4px; border-left: 4px solid var(--belfor-dark); }

.pers-header { font-size: 10px; font-weight: 600; color: #fff; text-align: center; }
.pers-header.left { text-align: left; }

.grid-row-tag { background: #fff; padding: 6px; border: 1px solid var(--border); border-radius: 4px; margin-bottom: 4px; display: flex; gap: 4px; align-items: center; }
.grid-row-woche { background: #fff; padding: 6px; border: 1px solid var(--border); border-radius: 4px; margin-bottom: 4px; display: flex; gap: 4px; align-items: center; }
.grid-header { background: var(--belfor-dark); border: none; }

.grid-row-woche div {flex: 0 0 auto; }

#dokuForm.hide-z .col-z, #dokuForm.hide-t .col-t { display: none !important; }
.nu-group-box { background: #fdfdfd; border: 1px solid var(--border); padding: 12px; border-radius: 4px; margin-bottom: 12px; border-left: 4px solid #6c757d; }

.p-mo, .p-di, .p-mi, .p-do, .p-fr, .p-sa, .p-so, .m-mo, .m-di, .m-mi, .m-do, .m-fr, .m-sa, .m-so, .g-mo, .g-di, .g-mi, .g-do, .g-fr, .g-sa, .g-so, .f-qty{
	flex-grow: 0;
    flex-shrink: 0;
    flex-basis: 60px;
}
.p-hours, .p-unit, .p-qual, .m-code, .m-unit, .m-ges, .g-days, .f-km{
	flex-grow: 0;
    flex-shrink: 0;
    flex-basis: 80px;
}
.p-from, .p-to, .p-pause, .m-qty, .g-qty{
	flex-grow: 0;
    flex-shrink: 0;
    flex-basis: 90px;
}

/* ========================================================================== */
/* KALENDER                                                                   */
/* ========================================================================== */
.calendar-grid { display: grid; grid-template-columns: 55px repeat(7, 1fr); gap: 2px; background: var(--border); margin-top: 1rem; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.calendar-header { display: grid; grid-template-columns: 55px repeat(7, 1fr); background: var(--belfor-dark); color: white; text-align: center; padding: 0.6rem 0; font-size: 12px; font-weight: 600; }
.calendar-kw { background: #e9ecef; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 5px; border-right: 1px solid var(--border); }
.calendar-day { background: white; min-height: 100px; padding: 0.5rem; display: flex; flex-direction: column; cursor: pointer; transition: 0.2s; }
.calendar-day:hover { background: #f8f9fa; }
.calendar-day.weekend { background-color: #f1f3f5; color: #adb5bd; }
.calendar-day.today { border: 2px solid #339af0; background-color: #e7f5ff; }
.cal-date-num { font-weight: 700; font-size: 13px; margin-bottom: 5px; color: #495057; }
.cal-suborder-badge { font-size: 9px; padding: 4px; margin-bottom: 4px; border-radius: 3px; background: #f8f9fa; border-left: 3px solid #ced4da; transition: 0.2s; }
.cal-suborder-title { font-weight: 700; color: #343a40; margin-bottom: 3px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; font-size: 10px; }
.cal-hours-grid { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.cal-hour-badge { background: #dee2e6; color: #495057; padding: 2px 4px; border-radius: 3px; font-size: 9px; font-weight: bold; }

.color-0 { border-left-color: #e03131; background: #fff5f5; } 
.color-1 { border-left-color: #1971c2; background: #e7f5ff; } 
.color-2 { border-left-color: #2f9e44; background: #ebfbee; } 
.color-3 { border-left-color: #f08c00; background: #fff9db; } 
.color-4 { border-left-color: #9c36b5; background: #f3f0ff; }
.cal-suborder-badge.span-week { opacity: 0.8; border-left-style: dashed; }

/* ========================================================================== */
/* MODALS & OVERLAYS                                                          */
/* ========================================================================== */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: none; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(2px); flex-direction: column; }
.modal-overlay.active { display: flex; }
.modal-overlay.dark-overlay { background: rgba(0,0,0,0.95); z-index: 10002; }
.modal-content { background: #fff; padding: 0; border-radius: 8px; width: 90%; max-width: 550px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); overflow: hidden; animation: slideDown 0.3s ease; }
.modal-content.large { max-width: 800px; }
.modal-content.padded { padding: 40px; text-align: center; }
.modal-header { background: var(--belfor-dark); color: #fff; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { color: #fff; margin: 0; font-size: 16px; }
.modal-header button { color: #fff; background: transparent; border: none; font-size: 20px; cursor: pointer; padding: 0; }
.modal-body { padding: 20px; max-height: 80vh; overflow-y: auto; background: #f8f9fa; }
.modal-body.white { background: #fff; }
.modal-footer { padding: 12px 18px; background: #f8f9fa; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-footer.center { justify-content: center; }
/* ========================================================================== */
/* DASHBOARD FORTSCHRITTSBALKEN & MODAL BUTTONS                               */
/* ========================================================================== */
.suborder-box { background: #fff; padding: 10px; border: 1px solid var(--border); border-left: 4px solid var(--belfor-red); border-radius: 6px; margin-bottom: 10px; }
.suborder-title { font-weight: 700; margin-bottom: 6px; border-bottom: 1px solid #f1f3f5; padding-bottom: 4px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.quali-budget-row { display: flex; align-items: center; margin-bottom: 4px; font-size: 11px; }
.quali-label { width: 35px; font-weight: 700; color: #495057; }
.progress-container { flex: 1; background: #e9ecef; border-radius: 4px; overflow: hidden; height: 10px; margin: 0 10px; }
.progress-bar { height: 100%; transition: width 0.4s ease; }
.progress-bar.success { background: #28a745; }
.progress-bar.warning { background: #ffc107; }
.progress-bar.danger { background: #dc3545; }
.progress-bar.purple { background: #6f42c1; }
.quali-stats { width: 120px; text-align: right; color: #495057; font-weight: 600; }

.existing-report-btn { display: flex; justify-content: space-between; align-items: center; background: #e7f5ff; border: 1px solid #339af0; padding: 10px 12px; border-radius: 4px; cursor: pointer; color: #0b509e; font-weight: bold; transition: 0.2s; }
.existing-report-btn:hover { background: #d0ebff; }
@keyframes slideDown { 
    from { transform: translateY(-30px); opacity: 0; } 
    to { transform: translateY(0); opacity: 1; } 
}

/* ========================================================================== */
/* SIGNATUR OVERLAY & CANVAS                                                  */
/* ========================================================================== */
.sig-sidebar-box { display: flex; flex-direction: column; gap: 8px; margin-top: 15px; }
.sig-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.7); display: flex; justify-content: center; align-items: center; z-index: 9999999; backdrop-filter: blur(3px); padding: 10px; }
.sig-modal { background: #fff; width: 100%; max-width: 800px; border-radius: 12px; padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); display: flex; flex-direction: column; box-sizing: border-box; }
#sig-title { margin: 0 0 5px 0; font-size: 1.2rem; color: #333; }
.sig-subtitle { margin: 0 0 15px 0; font-size: 0.9rem; color: #666; }
.sig-canvas-container { width: 100%; height: 250px; border: 2px dashed #ccc; border-radius: 8px; margin-bottom: 20px; overflow: hidden; background-color: #f9f9f9; background-image: linear-gradient(to bottom, transparent 180px, #adb5bd 180px, #adb5bd 182px, transparent 182px); position: relative; }
#uni-sig-canvas { width: 100%; height: 100%; cursor: crosshair; touch-action: none; display: block; }
.sig-buttons { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.sig-buttons-right { display: flex; gap: 10px; }
.sig-buttons button { padding: 10px 16px; border: none; border-radius: 6px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: 0.2s; }

/* ========================================================================== */
/* PDF VORSCHAU LAYOUT                                                        */
/* ========================================================================== */
.pdf-overlay-wrapper { display: flex; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 9999; background: #525659; flex-direction: row; margin: 0; padding: 0; }
.pdf-overlay-canvas-container { flex-grow: 1; height: 100%; display: flex; flex-direction: column; align-items: center; overflow-y: auto; padding: 20px; gap: 15px; }
.pdf-overlay-sidebar { width: 320px; background: #f8f9fa; padding: 20px; box-shadow: -2px 0 5px rgba(0,0,0,0.1); overflow-y: auto; }
.pdf-sidebar-card { background: white; padding: 15px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }



/* ========================================================================== */
/* JS HELPER CLASSES (Ersatz für Inline-Styles in der app.js)                 */
/* ========================================================================== */
.badge-archive { background: #6c757d; color: #fff; font-size: 10px; padding: 2px 5px; border-radius: 3px; margin-top: 5px; display: inline-block; }
.badge-type { font-size: 11px; font-weight: bold; }
.text-danger { color: #dc3545 !important; }
.bold { font-weight: bold !important; }
.mb-10 { margin-bottom: 10px !important; }
.mb-12 { margin-bottom: 12px !important; }
.mb-15 { margin-bottom: 15px !important; }
.pb-10 { padding-bottom: 10px !important; }
.gap-5 { gap: 5px !important; }
.align-top { vertical-align: top !important; }
.no-border { border: none !important; }
.pt-20 { padding-top: 20px !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-end { align-items: flex-end !important; }

.checkbox-box { display: flex; align-items: center; background: #fff; padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; height: 34px; }
.btn-fixed-height { height: 34px; display: flex; align-items: center; justify-content: center; padding: 0 10px; }
.btn-icon { padding: 0.7rem; display: flex; align-items: center; justify-content: center; }

.btn-outline.danger { border-color: #dc3545; color: #dc3545; background: #fff; }
.btn-outline.primary { border-color: #0b509e; color: #0b509e; }
.btn-primary.blue { background: #0b509e; }

.calendar-day.empty { background: var(--bg-color); cursor: default; }
.cal-kw-label { font-weight: 700; font-size: 12px; color: #495057; text-align: center; margin-bottom: 5px; }

.input-bold { border-color: #6c757d; font-weight: bold; }
.input-highlight { background: #fff !important; font-weight: bold !important; color: var(--belfor-red) !important; }
.input-readonly-highlight { background: #e9ecef !important; font-weight: bold !important; color: var(--belfor-red) !important; }
.input-readonly-bold { background: #e9ecef !important; font-weight: bold !important; }
/* ========================================================================== */
/* DASHBOARD FORTSCHRITTSBALKEN                                               */
/* ========================================================================== */
.suborder-box { background: #fff; padding: 10px; border: 1px solid var(--border); border-left: 4px solid var(--belfor-red); border-radius: 6px; margin-bottom: 10px; cursor:pointer;}
.suborder-title { font-weight: 700; margin-bottom: 6px; border-bottom: 1px solid #f1f3f5; padding-bottom: 4px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.quali-budget-row { display: flex; align-items: center; margin-bottom: 4px; font-size: 11px; }
.quali-label { width: 35px; font-weight: 700; color: #495057; }
.progress-container { flex: 1; background: #e9ecef; border-radius: 4px; overflow: hidden; height: 10px; margin: 0 10px; }
.progress-bar { height: 100%; transition: width 0.4s ease; }
.progress-bar.success { background: #28a745; }
.progress-bar.warning { background: #ffc107; }
.progress-bar.danger { background: #dc3545; }
.progress-bar.purple { background: #6f42c1; }
.quali-stats { width: 120px; text-align: right; color: #495057; font-weight: 600; }
.toggle-grid { margin-top:0.5rem; display:flex;border:1px solid #ced4da; border-radius:4px; }
.toggle-item { cursor:pointer; display:flex; align-items:center; gap:8px; font-size:16px; background:#fff; padding:4px 8px; border-radius:4px;  }
.toggle-item:hover { background: #FFFDE7; }

/* Animation für den Live-Fortschrittsbalken */
@keyframes progress-stripes {
    from { background-position: 1rem 0; }
    to { background-position: 0 0; }
}

.progress-bar.current-session {
    background-color: #339af0; /* Auffälliges Blau */
    background-image: linear-gradient(45deg, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
    background-size: 1rem 1rem;
    animation: progress-stripes 1s linear infinite;
    border-left: 1px solid rgba(255, 255, 255, 0.4); /* Trennstrich zum alten Balken */
}
/* ========================================================================== */
/* MOBILE OPTIMIERUNG (Smartphones & Tablets)                                 */
/* ========================================================================== */
@media (max-width: 768px) {
        /* Verhindert das Zusammenquetschen der Dashboard-Tabelle auf dem Handy */
    #view-dashboard table { 
        min-width: 800px; 
    }

    /* 1. Grundlayout absichern */
    html, body {
        overflow-x: hidden !important; 
        width: 100vw !important;
        max-width: 100vw !important;
        position: relative;
    }

    main {
        padding: 10px;
		padding-right:30px;
        width: 100%;
        box-sizing: border-box;
    }

    h2, h3, h4, p, div { word-wrap: break-word; }

    /* 2. Header */
    header {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 15px !important;
        width: 100% !important;
        gap: 15px;
    }
    .header-actions {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr; 
        gap: 8px !important;
    }
    .btn-header {
        width: 100% !important;
        padding: 8px 4px !important;
        font-size: 11px !important;
        text-align: center;
        white-space: normal; 
        height: 100%;
    }

    /* 3. Dashboard */
    .dashboard-top-bar, .dashboard-title-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .dashboard-action-group {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    .dashboard-action-group button { width: 100%; margin: 0; }

    /* 4. Formulare & Flex-Rows */
    .flex-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    .doku-header-bar, .doku-footer-bar { flex-direction: column; align-items: stretch; gap: 15px; }
    .doku-header-left, .doku-header-right { flex-direction: column; width: 100%; align-items: stretch; }

    .card .btn-primary, .card .btn-secondary, .card .btn-outline, .card .btn-danger {
        width: 100% !important; margin: 0 !important; justify-content: center; padding: 12px 10px !important;
    }

    /* 5. Tabellen und Grids (Wischbar machen) */
    .vehicle-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
    
    .grid-row-tag.pers-grid-tag   { min-width: 650px; }
    .grid-row-woche.pers-grid-woche { min-width: 900px; }
    .grid-row-tag.mat-grid-tag    { min-width: 600px; }
    .grid-row-woche.mat-grid-woche  { min-width: 850px; }
    .grid-row-tag.eq-grid-tag     { min-width: 500px; }
    .grid-row-woche.eq-grid-woche   { min-width: 800px; }
    
    .grid-row-tag, .grid-row-woche { padding: 10px 6px; }

    /* 6. PDF Vorschau Split-Screen */
    .pdf-overlay-wrapper { flex-direction: column; }
    .pdf-overlay-canvas-container { width: 100%; height: 50vh; padding: 10px; flex-grow: 0; }
    .pdf-overlay-sidebar { width: 100%; height: 50vh; padding: 15px; border-top: 3px solid var(--belfor-dark); }
    #pdf-preview-container { width: 100% !important; padding: 0 !important; overflow-x: hidden; }

    /* 7. Signatur Modal */
    .sig-modal { width: 95%; padding: 15px; max-height: 90vh; }
    .sig-canvas-container { height: 200px; }
    .sig-buttons { flex-direction: column; gap: 10px; }
    .sig-buttons-right, .sig-buttons button { width: 100%; justify-content: center; }
}
