/* ========================================================================
   OFFLINE APP STYLES - Angepasst an Haupt-App Design
   Optimiert für PC, Tablet, Mobile & iOS Safari
   ======================================================================== */

/* Offline-Login: min-height in zentraler CSS-Datei (100dvh für iOS-Adressleiste) */
body .login-container {
    min-height: 100vh;
    min-height: 100dvh;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* iOS tap highlight entfernen */
}

html {
    /* iOS Safe Area: unten nur über fixe Bottom-Nav / Content-Padding — kein doppeltes padding-bottom am html */
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
    -webkit-text-size-adjust: 100%; /* Verhindert iOS Text-Zoom */
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased; /* Bessere Schrift-Darstellung auf macOS/iOS */
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================================================
   HEADER
   ======================================================================== */

.offline-header {
    background: linear-gradient(135deg, #2c5aa0 0%, #4f7cc1 100%);
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.offline-header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.offline-logo {
    display: flex;
    align-items: center;
    gap: 20px;
}

.offline-logo img {
    height: 48px;
    width: auto;
}

/* Status Badge */
.status-badge-header {
    display: inline-block;
}

.status-badge-online,
.status-badge-offline {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.status-badge-online {
    background: rgba(40, 167, 69, 0.2);
    border: 1px solid rgba(40, 167, 69, 0.4);
}

.status-badge-offline {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.4);
}

body.online .status-badge-online {
    display: flex;
}

body.offline .status-badge-offline {
    display: flex;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-badge-online .status-dot {
    background: #28a745;
}

.status-badge-offline .status-dot {
    background: #dc3545;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.offline-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
}

.btn-install {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-install:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* PWA-Install-Button: per JS einblenden (kein Inline-Style) */
.btn-install--hidden {
    display: none !important;
}

/* ========================================================================
   NAVIGATION
   ======================================================================== */

.offline-nav {
    background: white;
    border-bottom: 2px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 78px;
    z-index: 99;
}

/* ========================================================================
   MOBILE: HEADER AUSBLENDEN, NAV OBEN (Option A)
   ======================================================================== */
@media (max-width: 768px) {
    .offline-header { display: none; }
    .offline-nav { top: 0; }
}

.offline-nav-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center; /* Items mittig ausrichten */
    gap: 5px;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    color: #555;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    background: #f5f7fa;
    color: #2c5aa0;
}

.nav-item.active {
    color: #2c5aa0;
    border-bottom-color: #2c5aa0;
    background: #f5f7fa;
}

.nav-icon {
    font-size: 20px;
}

.sync-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #dc3545;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Zuletzt synchronisiert - kleines Badge unten rechts am Sync-Icon */
.sync-last {
    position: absolute;
    right: 8px;
    bottom: 6px;
    background: rgba(0,0,0,0.05);
    color: #666;
    font-size: 10px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 6px;
}

/* ========================================================================
   CONTENT AREA
   ======================================================================== */

.offline-content {
    min-height: calc(100vh - 200px);
    min-height: calc(100dvh - 200px);
    padding-bottom: 40px;
}

.content-area {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================================================
   RESPONSIVE TABLES (wie Haupt-App)
   ======================================================================== */

.resp-table {
    width: 100%;
    display: table;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    margin-bottom: 20px;
}

.resp-table-row {
    display: table-row;
}

.resp-table-row:nth-child(even) {
    background: #f9f9f9;
}

.table-body-cell {
    display: table-cell;
    padding: 12px;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
}

.table-body-cell:last-child {
    border-bottom: none;
}

/* ========================================================================
   BUTTONS (wie Haupt-App) - Touch-optimiert
   ======================================================================== */

.button {
    background-color: #04AA6D;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    text-decoration: none;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    display: inline-block;
    font-size: 15px;
    min-height: 44px; /* iOS Touch-Target */
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation; /* Verhindert Doppel-Tap Zoom */
}

.button:hover:not(:disabled) {
    background-color: #039c5e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.button:active {
    transform: translateY(0);
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
    min-height: 44px; /* iOS Touch-Target */
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.btn-primary {
    background: #2c5aa0;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #1e4070;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================================================
   INPUT FIELDS (wie Haupt-App) - iOS Safari optimiert
   ======================================================================== */

input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="password"],
textarea,
select {
    padding: 12px; /* Größer für Touch-Geräte */
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px; /* Mindestens 16px verhindert iOS Zoom */
    font-family: inherit;
    transition: border-color 0.2s;
    -webkit-appearance: none; /* Safari default styling entfernen */
    -moz-appearance: none;
    appearance: none;
    background-color: white;
    width: 100%;
    max-width: 100%;
}

/* iOS Safari spezifische Fixes */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.15);
}

.spaltigtextbox {
    width: 120px;
    min-width: 80px;
}

.offline-zusatzinfo-input {
    width: 200px;
}

input[required] {
    border-left: 3px solid #2c5aa0;
}

/* Touch-optimierte Inputs auf mobilen Geräten */
@media (max-width: 600px) {
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    textarea,
    select {
        padding: 14px;
        font-size: 16px; /* Verhindert Zoom auf iOS */
        min-height: 44px; /* iOS Touch-Target Mindestgröße */
    }
}

/* ========================================================================
   ALERTS
   ======================================================================== */

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 2px solid;
}

.alert-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.alert-error-prominent {
    padding: 20px 22px;
    border-width: 3px;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.45;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.22);
}

.alert-error-prominent strong {
    display: block;
    font-size: 20px;
    margin-bottom: 8px;
}

.offline-form-validation-alert {
    margin-bottom: 24px;
    padding: 20px 22px;
    border-radius: 14px;
    background: #fdf0f0;
    border: 3px solid #dc3545;
    color: #721c24;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.45;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.22);
}

.offline-form-validation-alert strong {
    display: block;
    font-size: 20px;
    margin-bottom: 8px;
}

.offline-field-error-highlight {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.28) !important;
}

.offline-form-section-error h2 {
    color: #dc3545;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* ========================================================================
   FENSTERTYP-AUSWAHL - Responsive Grid
   ======================================================================== */

.fenster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 15px;
}

.fenster-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.2s;
    background: white;
}

.fenster-option:hover {
    border-color: #2c5aa0;
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.2);
}

.fenster-option input[type="radio"] {
    margin-top: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.fenster-option input[type="radio"]:checked {
    accent-color: #2c5aa0;
}

.fenster-img {
    width: 100%;
    height: auto;
    max-width: 120px;
    border-radius: 4px;
}

.fenster-label {
    margin-top: 8px;
    font-size: 12px;
    text-align: center;
    color: #666;
    font-weight: 500;
}

/* Details/Summary Styling */
details {
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

details summary {
    cursor: pointer;
    padding: 12px;
    background: #f8f9fa;
    font-weight: bold;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.2s;
}

details summary:hover {
    background: #e9ecef;
}

details[open] summary {
    background: #2c5aa0;
    color: white;
}

/* ========================================================================
   TABLET RESPONSIVE (768px - 1024px)
   ======================================================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .content-area {
        padding: 15px;
    }
    
    .fenster-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
    
    .offline-header-content {
        padding: 0 15px;
    }
}

/* ========================================================================
   MOBILE RESPONSIVE (bis 600px) - iOS Safari optimiert
   ======================================================================== */

@media (max-width: 600px) {
    .offline-header {
        padding: 10px 15px;
    }
    
    .offline-header-content {
        flex-direction: column;
        gap: 8px;
    }
    
    .offline-logo {
        width: 100%;
        justify-content: space-between;
    }
    
    .offline-logo img {
        height: 40px;
    }
    
    .offline-user-info {
        width: 100%;
        justify-content: space-between;
        font-size: 14px;
    }
    
    .btn-install {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    /* Bottom Navigation für Mobile */
    .offline-nav {
        top: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-top: 2px solid #e0e0e0;
        border-bottom: none;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); /* Bottom-Nav + Home-Indikator */
        background: white;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .offline-nav-content {
        justify-content: space-around;
        padding: 0;
        gap: 0;
    }
    
    .nav-item {
        flex-direction: column;
        padding: 10px 8px;
        gap: 4px;
        flex: 1;
        justify-content: center;
        align-items: center;
        min-height: 60px; /* Touch-Target für iOS */
        border-bottom: none;
    }
    
    .nav-item.active {
        background: #f0f4fb;
        border-bottom: none;
    }
    
    .nav-text {
        font-size: 11px;
    }
    
    .nav-icon {
        font-size: 24px;
    }
    
    .sync-badge {
        top: 5px;
        right: 5px;
    }
    
    .offline-content {
        padding-bottom: calc(80px + env(safe-area-inset-bottom)); /* Platz für Bottom Nav + Safe Area */
    }
    
    .content-area {
        padding: 15px 10px;
    }
    
    /* Tables als Cards auf Mobile */
    .resp-table {
        border: none;
        background: transparent;
    }
    
    .resp-table-row {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 12px;
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
    
    .table-body-cell {
        display: block;
        padding: 10px 0;
        border: none;
    }
    
    .table-body-cell:first-child {
        padding-top: 0;
    }
    
    .table-body-cell:last-child {
        padding-bottom: 0;
    }
    
    .table-body-cell strong {
        display: block;
        margin-bottom: 6px;
        color: #2c5aa0;
        font-size: 13px;
    }
    
    /* Fenstertyp-Grid auf Mobile */
    .fenster-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 10px;
        padding: 10px;
    }
    
    .fenster-option {
        padding: 8px;
    }
    
    .fenster-img {
        max-width: 90px;
    }
    
    .fenster-label {
        font-size: 11px;
    }
    
    /* Buttons volle Breite auf Mobile */
    .button,
    .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    /* Details/Summary auf Mobile */
    details summary {
        padding: 10px;
        font-size: 14px;
    }
}

/* ========================================================================
   SEHR KLEINE DISPLAYS (< 375px)
   ======================================================================== */

@media (max-width: 374px) {
    .nav-text {
        font-size: 10px;
    }
    
    .nav-icon {
        font-size: 20px;
    }
    
    .fenster-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .offline-logo img {
        height: 36px;
    }
}

/* ========================================================================
   FOTO-UPLOAD - iOS Safari optimiert
   ======================================================================== */

input[type="file"] {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
    -webkit-appearance: button;
    cursor: pointer;
    padding: 10px 20px;
    background: #2c5aa0;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
}

.foto-preview {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.foto-container {
    margin: 15px 0;
}

.foto-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 13px;
    color: #666;
}

.btn-remove-foto {
    background: #dc3545;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

/* Mobile Foto-Upload Optimierung */
@media (max-width: 600px) {
    input[type="file"] {
        width: 100%;
        padding: 12px;
        border: 2px dashed #2c5aa0;
        border-radius: 8px;
        background: #f8f9fa;
    }
    
    input[type="file"]::-webkit-file-upload-button {
        width: 100%;
        margin: 0;
        padding: 14px;
        min-height: 44px; /* iOS Touch-Target */
    }
    
    .foto-preview {
        max-height: 300px;
        width: auto;
        max-width: 100%;
    }
}

/* ========================================================================
   LOADING & TRANSITIONS
   ======================================================================== */

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* Smooth Scrolling für iOS */
* {
    -webkit-overflow-scrolling: touch;
}

/* ========================================================================
   PRINT STYLES
   ======================================================================== */

@media print {
    .offline-header,
    .offline-nav,
    .btn,
    .button {
        display: none !important;
    }
    
    .offline-content {
        padding: 0;
    }
}

/* ========================================================================
   iOS SAFARI SPEZIFISCHE FIXES
   ======================================================================== */

/* Verhindert iOS Zoom bei Focus auf Inputs mit font-size < 16px */
@supports (-webkit-touch-callout: none) {
    input,
    textarea,
    select {
        font-size: max(16px, 1em);
    }
}

/* iOS Safari Select-Styling */
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 40px;
}

/* iOS Checkbox & Radio Buttons größer */
input[type="checkbox"],
input[type="radio"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    cursor: pointer;
}

@media (max-width: 600px) {
    input[type="checkbox"],
    input[type="radio"] {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
    }
}

/* ========================================================================
   ANIMATIONEN (Toast-Benachrichtigungen)
   ======================================================================== */

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Innentür-Offline: Tabellenzeilen per Klasse ein-/ausblenden (ohne Inline-Styles) */
.offline-innentuer-row-hidden {
    display: none !important;
}

.offline-innentuer-stack {
    margin-bottom: 8px;
}

.offline-innentuer-inline-label {
    display: inline-block;
    width: 160px;
}

.offline-innentuer-wide-input {
    width: 100%;
    max-width: 520px;
}

/* Innentür-Offline: Messungs-Skizze (Canvas) Card-Layout */
.offline-it-skizze-card {
    border: 2px solid #04AA6D;
    border-radius: 8px;
    overflow: hidden;
}

.offline-it-skizze-summary {
    cursor: pointer;
    user-select: none;
    padding: 12px;
    background: #04AA6D;
    color: #fff;
    font-weight: bold;
}

.offline-it-skizze-body {
    padding: 15px;
    background: #eef9f3;
}

.offline-it-skizze-canvas-wrap {
    overflow-x: auto;
}

.offline-it-skizze-canvas {
    border: 2px solid #04AA6D;
    border-radius: 8px;
    touch-action: none;
    max-width: 100%;
    background: #fff;
}

.offline-it-skizze-toolbar {
    margin-top: 15px;
    padding: 15px;
    background: #eef9f3;
    border-radius: 8px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.offline-it-skizze-toolbar .control {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.offline-it-skizze-color {
    width: 50px;
    height: 30px;
    cursor: pointer;
}

.offline-it-skizze-range {
    width: 120px;
}

/* Insektenschutz Offline – Auflagen (Spannrahmen) */
.offline-insekt-auflagen-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: #64748b;
}

.offline-insekt-auflagen-table {
    border-collapse: collapse;
    margin: 0 auto;
}

.offline-insekt-auflagen-table th {
    padding: 8px 12px;
    font-size: 15px;
    color: #1e3a5f;
}

.offline-insekt-auflagen-cell-center {
    text-align: center;
    vertical-align: middle;
    padding: 8px;
}

.offline-insekt-auflage-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.offline-insekt-auflage-input {
    display: inline-block;
    width: 64px;
    max-width: 64px;
    min-width: 0;
    margin: 0;
    padding: 4px 6px;
    vertical-align: middle;
    text-align: center;
    font-weight: 600;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
}

.offline-insekt-auflage-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #6c757d;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.offline-insekt-auflage-toggle:hover {
    background: #5a6268;
}

.offline-insekt-auflagebestand-table {
    border-collapse: collapse;
    margin: 16px auto 0;
}

.offline-insekt-auflagebestand-colhead {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    text-transform: lowercase;
}

.offline-insekt-auflagebestand-label {
    padding: 8px 12px 8px 0;
    text-align: right;
    font-weight: 600;
    color: #1e3a5f;
    white-space: nowrap;
}

.offline-insekt-spannrahmen-img {
    max-width: 100%;
    height: auto;
}

/* Messungsformular – Speichern / Messungen anzeigen (wie Online-App) */
.offline-messung-footer-actions {
    margin-top: 30px;
}

.offline-messung-footer-actions-table {
    border-collapse: collapse;
}

.offline-messung-footer-spacer {
    width: 20px;
}

.offline-messung-icon-btn {
    display: inline-block;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    line-height: 0;
}

.offline-messung-icon-btn img,
.offline-messung-icon-link img {
    display: block;
    height: 45px;
    width: auto;
}

.offline-messung-icon-link {
    display: inline-block;
    line-height: 0;
}

.offline-messung-icon-btn:hover,
.offline-messung-icon-link:hover {
    opacity: 0.85;
}

/* Startseite / Auftragsliste – Suche wie Haupt-App */
.offline-welcome-search-form {
    margin-bottom: 20px;
}

.offline-welcome-search-table {
    width: 100%;
    border-collapse: collapse;
}

.offline-welcome-search-table td {
    vertical-align: middle;
    padding: 2px 4px;
}

.offline-welcome-search-input {
    width: 100%;
    max-width: 320px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
}

.offline-welcome-search-hint {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

.offline-welcome-search-clear {
    display: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: #666;
}

.offline-auftraege-search-form .offline-welcome-search-input {
    max-width: none;
}

/* Versatz-Richtung (Offline Bockfenster / Standard) */
.offline-versatz-diff {
    font-weight: bold;
    color: #666;
}

.offline-versatz-diff-cell {
    vertical-align: middle;
}

.offline-versatz-richtung-img {
    display: none;
    height: 48px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Anschlussfugen Tür Bockfenster (wie online: Tür- und Fenster-Fuge
   nebeneinander unter dem Schema-Bild) */
.offline-anschlussfugen-tuer-info {
    cursor: pointer;
    vertical-align: middle;
    margin-left: 6px;
}

.offline-af-unten-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.offline-af-unten-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.offline-af-unten-input-row {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}

.offline-af-unten-label {
    font-size: 12px;
    font-weight: 600;
    color: #2c5aa0;
}

/* Seitliche Tür-Fuge (unter dem linken/rechten Seitenfeld, wie online) */
.offline-af-seite-tuer {
    margin-top: 14px;
}

/* ============================================================
   Checkout: Positionsbearbeitung in der Messungsliste
   ============================================================ */
/* JS-gerenderte Zeilen-Container innerhalb der .resp-table:
   display:contents lässt die .resp-table-row-Kinder direkt am
   Table-Layout teilnehmen (sonst falsche Spaltenausrichtung). */
#checkoutMessungenBody,
#offlineMessungenBody {
    display: contents;
}

.offline-pos-checkout-hint {
    color: #999;
    font-size: 12px;
    white-space: nowrap;
    cursor: help;
}

.offline-pos-edit-unavailable {
    color: #999;
    font-size: 12px;
    cursor: help;
}

.offline-pos-geaendert-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 4px;
    background: #fff3cd;
    border: 1px solid #e0a800;
    color: #856404;
    white-space: nowrap;
}

.offline-pos-row-edited {
    background: #fff9e6;
}

/* Login-Seite: Hinweis, wenn das Gerät offline ist (Anmeldung nicht möglich) */
.offline-login-offline-hinweis {
    margin-bottom: 20px;
    padding: 14px;
    background: #fff3cd;
    border: 2px solid #e0a800;
    border-radius: 8px;
    color: #856404;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}

.offline-info-image-modal {
    display: block;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.offline-info-image-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 520px;
    text-align: center;
}

.offline-info-image-modal-img {
    max-width: 100%;
    height: auto;
    margin-bottom: 16px;
}

.offline-info-image-modal-close {
    width: 100%;
    background: #2c5aa0;
}

/* Zusatzfotos (Offline, alle Messarten) */
.offline-zusatzfotos-hint {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px 0;
}

.offline-zusatzfotos-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.offline-zusatzfoto-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.offline-zusatzfoto-thumb {
    max-height: 100px;
    border: 2px solid #28a745;
    border-radius: 4px;
}

.offline-zusatzfoto-remove-btn {
    padding: 4px 10px;
    background: #dc3545;
    color: #fff;
    font-size: 12px;
}

.offline-zusatzfotos-add-btn {
    background: #2c5aa0;
}

.offline-zusatzfotos-file-input {
    display: none;
}

/* ============================================================
   Versatz-Gruppen (oben/links/rechts) ein-/ausklappbar
   ============================================================ */
.offline-versatz-toggle-row td {
    padding: 4px 8px;
}

.offline-versatz-toggle-link {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: #2c5aa0;
    text-decoration: none;
    cursor: pointer;
    padding: 4px 0;
}

.offline-versatz-toggle-link:hover {
    text-decoration: underline;
}

/* Achse Pfosten / Stulp: Spaltenbeschriftung von links / von rechts */
.offline-achse-pfosten-spalten td {
    padding: 4px 10px 2px;
    font-size: 13px;
    font-weight: 600;
    color: #2c5aa0;
}

.offline-info-icon {
    cursor: pointer;
    vertical-align: middle;
    margin-left: 5px;
}

.offline-info-image-modal {
    display: block;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

.offline-info-image-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.offline-info-image-modal-img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 15px;
}

.offline-info-image-modal-close {
    width: 100%;
    background: #2c5aa0;
}

/* ========================================================================
   MATERIAL-FILTER (Klaes-Fensterauswahl: Holz / Kunststoff / Holz-Alu / Alu)
   ======================================================================== */

.offline-material-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 15px 0;
    padding: 10px;
    background: #f5f7fa;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.offline-material-filter-titel {
    font-weight: 600;
    color: #333;
    margin-right: 4px;
}

.offline-material-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.offline-material-btn:hover {
    border-color: #2c5aa0;
}

.offline-material-btn-aktiv {
    border-color: #2c5aa0;
    background: #2c5aa0;
    color: white;
    font-weight: 600;
}

.offline-material-btn-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 3px;
}

/* Vom Material-Filter ausgeblendete Fenstertypen/Gruppen */
.fa-mat-hidden {
    display: none !important;
}

/* ========================================================================
   AUFTRAGSLISTE: Cache-Hinweis + Datenstand-Badge
   ======================================================================== */

.offline-cache-hinweis {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    font-size: 14px;
}

.cache-stand-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: #eef1f5;
    border: 1px solid #cfd8e3;
    border-radius: 10px;
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    vertical-align: middle;
}

/* Zusatzfotos: Hinweis nach Wiederherstellung aus letzter Sitzung */
.offline-zusatzfotos-restore-hinweis {
    margin: 8px 0;
    padding: 8px 12px;
    background: #e4edfd;
    border-left: 4px solid #2563eb;
    border-radius: 4px;
    color: #1e429f;
    font-size: 13px;
}
