:root {
    --bg-light: #f4f4f9;
    --text-light: #333;
    --card-light: #fff;
    --bg-dark: #121212;
    --text-dark: #e0e0e0;
    --card-dark: #1e1e1e;
    --primary: #4a9fd4;
    --primary-dark: #3a8fc4;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* Light Mode */
#fvd-app.light { background: var(--bg-light); color: var(--text-light); }
#fvd-app.light .top-bar, #fvd-app.light .bottom-nav { background: #fff; border-color: #ddd; }
#fvd-app.light input, #fvd-app.light select { background: #fff; border: 1px solid #ccc; color: #333; }
#fvd-app.light .nav-btn.active { color: var(--primary); background: rgba(74, 159, 212, 0.1); }
#fvd-app.light .btn-primary { background: var(--primary); }
#fvd-app.light .btn-primary:hover { background: var(--primary-dark); }

/* Dark Mode */
#fvd-app.dark { background: var(--bg-dark); color: var(--text-dark); }
#fvd-app.dark .top-bar, #fvd-app.dark .bottom-nav { background: #2c2c2c; border-color: #444; color: #fff; }
#fvd-app.dark input, #fvd-app.dark select, #fvd-app.dark .email-input { background: #333; border: 1px solid #555; color: #fff; }
#fvd-app.dark .nav-btn.active { color: var(--primary); background: rgba(74, 159, 212, 0.2); }

/* App Layout */
#fvd-app { 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    position: relative;
}

.top-bar { 
    padding: 10px 15px; 
    font-weight: bold; 
    font-size: 1.1rem; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    z-index: 10; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    position: sticky;
    top: 0;
    background: #fff;
}

.header-brand { display: flex; align-items: center; gap: 10px; }
.header-logo { height: 30px; width: auto; }
.app-logo-img { max-width: 150px; height: auto; margin-bottom: 20px; display: block; margin-left: auto; margin-right: auto; }

.btn-logout {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
}

.content-area { 
    flex: 1; 
    padding: 15px; 
    padding-bottom: 100px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.bottom-nav { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    display: flex; 
    justify-content: space-around; 
    padding: 8px 0; 
    border-top: 1px solid #ccc; 
    z-index: 100; 
    background: #fff;
}

.nav-btn { 
    background: none; 
    border: none; 
    font-size: 0.75rem; 
    color: inherit; 
    opacity: 0.6; 
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.nav-btn.active { 
    opacity: 1; 
    font-weight: bold; 
}

.hidden { display: none !important; }

/* Buttons */
.btn-primary { 
    background: var(--primary); 
    color: #fff; 
    width: 100%; 
    padding: 14px; 
    border: none; 
    border-radius: 8px; 
    font-size: 1rem; 
    margin-top: 15px; 
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { 
    background: #6c757d; 
    color: #fff; 
    padding: 10px 15px; 
    border: none; 
    border-radius: 5px; 
    cursor: pointer;
}

.btn-success { 
    background: #28a745; 
    color: #fff; 
    padding: 10px 15px; 
    border: none; 
    border-radius: 5px;
    cursor: pointer;
}

/* Form Styles */
#form-issue {
    max-width: 450px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
}

/* Radio Button Group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0,0,0,0.03);
    padding: 10px;
    border-radius: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #fff;
    border-radius: 5px;
    cursor: pointer;
    font-weight: normal;
    margin: 0;
}

.radio-label input[type="radio"] {
    width: auto;
    margin: 0;
    transform: scale(1.2);
}

#fvd-app.dark .radio-label {
    background: #333;
}

#fvd-app.dark .radio-group {
    background: rgba(255,255,255,0.05);
}

.toggle-group { 
    background: rgba(0,0,0,0.05); 
    padding: 12px; 
    border-radius: 8px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 10px; 
    border: 1px solid rgba(0,0,0,0.1); 
}
.toggle-group input { width: auto; margin: 0; transform: scale(1.5); }

/* Login */
.login-container { max-width: 400px; margin: 50px auto; padding: 20px; text-align: center; }
.login-container input { margin-bottom: 15px; }
.error-msg { color: #dc3545; margin-top: 10px; }

/* History */
.history-item { 
    padding: 15px; 
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
    background: var(--card-light);
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#fvd-app.dark .history-item {
    background: var(--card-dark);
    border-color: #444;
}

.history-item-info { 
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item strong { 
    font-size: 1.1rem; 
    display: block;
}

.history-item small {
    display: block;
    opacity: 0.7;
    font-size: 0.9rem;
}

.status-open { color: #dc3545; font-weight: bold; font-size: 0.85rem; margin-top: 4px; display: inline-block; }
.status-billed { color: #28a745; font-weight: bold; font-size: 0.85rem; margin-top: 4px; display: inline-block; }

.history-item-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.email-section {
    display: flex;
    gap: 8px;
    align-items: stretch;
    width: 100%;
}

.email-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    min-height: 44px;
}

.btn-reprint, .btn-email {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: opacity 0.2s;
    min-height: 44px;
    white-space: nowrap;
}

.btn-reprint {
    width: 100%;
}

.btn-reprint:hover, .btn-email:hover {
    opacity: 0.8;
}

.btn-reprint:disabled, .btn-email:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tablet und größer */
@media (min-width: 768px) {
    .history-item {
        flex-direction: row;
        align-items: center;
        padding: 20px;
    }
    
    .history-item-info {
        flex: 1;
    }
    
    .history-item-actions {
        width: auto;
        min-width: 400px;
    }
    
    .email-section {
        width: 100%;
    }
    
    .email-input {
        max-width: 250px;
    }
    
    .btn-reprint {
        width: auto;
        min-width: 120px;
    }
}

/* Desktop große Bildschirme */
@media (min-width: 1200px) {
    .history-item {
        padding: 24px;
    }
    
    .history-item-actions {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }
    
    .email-section {
        width: auto;
        flex: 1;
    }
    
    .btn-reprint {
        order: -1;
    }
}

/* Mobile Optimierungen */
@media (max-width: 767px) {
    .history-item {
        padding: 16px;
    }
    
    .email-input {
        font-size: 16px; /* Verhindert Zoom auf iOS */
    }
    
    .btn-reprint, .btn-email {
        font-size: 16px;
        padding: 12px 16px;
    }
}

.history-open-summary {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

#fvd-app.dark .history-open-summary {
    background: #3d3200;
    border-color: #ffc107;
    color: #ffc107;
}

/* Billing */
.billing-grand-total {
    background: var(--primary);
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 1.1rem;
    text-align: center;
}

.billing-seller-block {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    overflow: hidden;
}

#fvd-app.dark .billing-seller-block {
    background: #2c2c2c;
}

.billing-seller-header {
    background: rgba(74, 159, 212, 0.1);
    padding: 12px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.billing-total {
    color: var(--primary);
    font-weight: bold;
}

.billing-permits-list {
    max-height: 250px;
    overflow-y: auto;
}

.billing-permit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.permit-info {
    flex: 1;
    font-size: 0.85rem;
}

.permit-info strong {
    color: var(--primary);
}

.btn-delete-permit {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px 8px;
    opacity: 0.6;
}
.btn-delete-permit:hover { opacity: 1; }
.btn-danger { color: #dc3545; }

.billing-actions {
    display: flex;
    gap: 10px;
    padding: 12px 15px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.billing-actions button {
    flex: 1;
    padding: 10px;
    font-size: 0.85rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10px;
    overflow-y: auto;
}

.modal-content {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 650px;
    margin: 10px auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: #f8f8f8;
    border-radius: 10px 10px 0 0;
}

.modal-header h3 { margin: 0; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 5px;
}

.modal-body {
    padding: 15px;
    background: #e0e0e0;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.modal-footer button {
    flex: 1;
}

/* Preview Container */
.preview-container {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    margin: 0 auto;
    transform-origin: top center;
}

/* Permit Card Styles - Used for Preview AND Print */
.permit-card {
    background: #fff;
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
    padding: 20px;
    border: 2px solid #000;
    position: relative;
}

.permit-card.permit-a4 {
    width: 100%;
    max-width: 600px;
    min-height: 800px;
    margin: 0 auto;
}

.permit-card.permit-a5 {
    width: 100%;
    max-width: 450px;
    min-height: 550px;
    margin: 0 auto;
    font-size: 0.9em;
}

.permit-header {
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.permit-header h1 {
    margin: 10px 0 5px;
    font-size: 1.5em;
    color: #000;
}

.permit-header h2 {
    margin: 0 0 10px;
    font-size: 1.1em;
    font-weight: normal;
    color: #000;
}

.permit-nr {
    margin: 5px 0 0;
    font-size: 1em;
    color: #333;
}

.permit-data {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.permit-data tr {
    border-bottom: 1px dotted #999;
}

.permit-data td {
    padding: 8px 5px;
    vertical-align: top;
}

.permit-data td.label {
    width: 130px;
    font-weight: bold;
    color: #000;
}

.permit-data td.value {
    color: #000;
}

.permit-warning {
    background: #ffeeee;
    border: 2px solid #cc0000;
    padding: 12px;
    margin: 15px 0;
    color: #000;
}

.permit-info-box {
    background: #eeffee;
    border: 2px solid #00aa00;
    padding: 12px;
    margin: 15px 0;
    color: #000;
    font-weight: bold;
}

.permit-rules {
    font-size: 0.9em;
    color: #333;
    margin: 15px 0;
}

/* Textarea for custom info */
#inp-custom-info {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

#fvd-app.dark #inp-custom-info {
    background: #333;
    border-color: #555;
    color: #fff;
}

#custom-info-wrapper {
    margin-top: 10px;
}

#custom-info-wrapper label {
    display: block;
    margin-bottom: 5px;
    font-weight: normal;
    font-size: 0.9em;
}

.permit-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 30px;
    padding-top: 20px;
}

.stamp-area {
    flex: 0 0 auto;
}

.stamp-area {
    width: 100px;
}

.stamp-image {
    width: 100px;
    height: auto;
}

.stamp {
    width: 80px;
    height: 80px;
    border: 3px double #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 9pt;
    font-weight: bold;
    color: #555;
    line-height: 1.3;
}

.signature-area {
    flex: 0 0 45%;
    text-align: center;
}

.signature-line {
    border-top: 1px solid #000;
    margin-bottom: 5px;
}

.signature-area p {
    margin: 0;
    font-size: 0.85em;
    color: #000;
}

/* Print Area - Not used anymore, kept for compatibility */
#print-area {
    display: none;
}

#fvd-print-frame {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .content-area {
        padding: 10px;
        padding-bottom: 80px;
    }
    
    .form-group input,
    .form-group select {
        padding: 10px;
    }
    
    .btn-primary {
        padding: 12px;
    }
    
    .modal-body {
        padding: 10px;
    }
    
    .preview-container {
        transform: scale(0.35);
        transform-origin: top center;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .preview-container {
        transform: scale(0.45);
        transform-origin: top center;
    }
}

@media (min-width: 769px) {
    .preview-container {
        transform: scale(0.55);
        transform-origin: top center;
    }
}

/* ============================================
   A4 Print Preview Styles (Druckvorschau)
   ============================================ */

.preview-container {
    margin-bottom: -400px; /* Kompensiert den Skalierungs-Freiraum */
}

.print-area-a4 {
    width: 210mm;
    height: 297mm;
    padding: 8mm;
    background: #fff;
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.print-area-a4 .half-page {
    height: 49%;
    width: 100%;
    display: flex;
    position: relative;
}

.print-area-a4 .bottom-half {
    margin-top: 2%;
}

.print-area-a4 .col {
    width: 50%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.print-area-a4 .col-left {
    padding-right: 3mm;
}

.print-area-a4 .col-right {
    padding-left: 3mm;
}

.print-area-a4 .rotated-content {
    transform: rotate(180deg);
}

/* Überschriften */
.print-area-a4 h2 {
    font-size: 11pt;
    margin: 0 0 3px 0;
    border-bottom: 1px solid #000;
    padding-bottom: 2px;
    font-weight: bold;
}

/* §4 Tabelle */
.print-area-a4 .table-s4 {
    width: 100%;
    border-collapse: collapse;
    font-size: 6.8pt;
}
.print-area-a4 .table-s4 th,
.print-area-a4 .table-s4 td {
    border: 1px solid #666;
    padding: 1.5px 3px;
    text-align: left;
    vertical-align: top;
    line-height: 1.15;
}
.print-area-a4 .table-s4 th {
    background-color: #eee;
    font-weight: bold;
    font-size: 7.5pt;
}
.print-area-a4 .table-s4 .col-nr {
    width: 22px;
    text-align: center;
    font-weight: bold;
}

/* §7 Tabelle */
.print-area-a4 .table-s7 {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 3px;
    font-size: 8pt;
}
.print-area-a4 .table-s7 th,
.print-area-a4 .table-s7 td {
    border: 1px solid #666;
    padding: 2px 3px;
    text-align: left;
    vertical-align: top;
}
.print-area-a4 .table-s7 th {
    background-color: #eee;
    font-weight: bold;
}

.print-area-a4 .protected-info {
    font-size: 7.5pt;
    margin-bottom: 3px;
}

.print-area-a4 .bremen-note {
    font-size: 7pt;
    font-weight: bold;
    margin-top: 3px;
    margin-bottom: 3px;
}

.print-area-a4 .highlight-box {
    border: 1px solid #000;
    padding: 4px 5px;
    background: #fdfdfd;
    font-size: 7.5pt;
    margin-top: 5px;
}
.print-area-a4 .highlight-box p {
    margin: 0;
}
.print-area-a4 .highlight-box .spin-rule {
    margin-top: 3px;
}

/* §5 Text */
.print-area-a4 .text-s5 {
    font-size: 8.5pt;
}
.print-area-a4 .text-s5 h2 {
    font-size: 11pt;
}
.print-area-a4 .text-s5 ul {
    padding-left: 14px;
    margin: 3px 0 6px 0;
}
.print-area-a4 .text-s5 li {
    margin-bottom: 3px;
    line-height: 1.2;
}
.print-area-a4 .text-s5 .section-title {
    margin-top: 5px;
    margin-bottom: 2px;
}
.print-area-a4 .text-s5 .homepage-note {
    border: 1px solid #000;
    padding: 6px;
    margin-top: 8px;
    text-align: center;
    font-weight: bold;
}

/* Gastkarte kompakt */
.print-area-a4 .permit-card-compact {
    width: 100%;
    height: 100%;
    padding: 2mm;
    border: 1.5px solid #000;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.print-area-a4 .permit-header-compact {
    text-align: center;
    border-bottom: 1px solid #000;
    padding-bottom: 2mm;
    margin-bottom: 2mm;
}
.print-area-a4 .permit-header-compact .permit-logo {
    max-height: 35px;
    display: block;
    margin: 0 auto 3px;
}
.print-area-a4 .permit-header-compact h1 {
    margin: 3px 0 1px;
    font-size: 12pt;
}
.print-area-a4 .permit-header-compact h2 {
    margin: 0;
    font-size: 9pt;
    font-weight: normal;
    border: none;
}
.print-area-a4 .permit-header-compact .permit-nr {
    margin-top: 2px;
    font-size: 8pt;
    color: #333;
}

.print-area-a4 .permit-data-section-compact {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 2mm;
}

.print-area-a4 .permit-data-compact {
    flex: 1;
    border-collapse: collapse;
    font-size: 7pt;
}
.print-area-a4 .permit-data-compact tr {
    border-bottom: 1px dotted #999;
}
.print-area-a4 .permit-data-compact td {
    padding: 2px 2px;
    vertical-align: top;
}
.print-area-a4 .permit-data-compact td.label {
    width: 70px;
    font-weight: bold;
}

.print-area-a4 .permit-qr-compact {
    flex-shrink: 0;
    width: 80px;
}
.print-area-a4 .qr-code-compact {
    width: 80px;
    height: 80px;
    border: 1px solid #ddd;
    padding: 2px;
}

.print-area-a4 .permit-warning {
    background: #ffeeee;
    border: 1.5px solid #cc0000;
    padding: 4px 6px;
    margin: 3px 0;
    font-size: 7pt;
}

.print-area-a4 .permit-info-box {
    background: #eeffee;
    border: 1.5px solid #00aa00;
    padding: 4px 6px;
    margin: 3px 0;
    font-size: 7pt;
}

.print-area-a4 .permit-rules-compact {
    font-size: 6.5pt;
    color: #333;
    margin: 3px 0;
}

.print-area-a4 .permit-footer-compact {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
    padding-top: 3mm;
}
.print-area-a4 .stamp-area-compact {
    width: 100px;
}
.print-area-a4 .stamp-image-compact {
    width: 100px;
    height: auto;
}
.print-area-a4 .signature-area-compact {
    width: 50%;
    text-align: center;
}
.print-area-a4 .signature-line-compact {
    border-top: 1px solid #000;
    margin-bottom: 2px;
}
.print-area-a4 .signature-image {
    max-width: 120px;
    max-height: 50px;
    margin-bottom: 2px;
}
.print-area-a4 .signature-area-compact p {
    margin: 0;
    font-size: 7pt;
}

/* Logo größer */
.print-area-a4 .permit-header-compact .permit-logo {
    max-height: 55px;
    display: block;
    margin: 0 auto 3px;
}

/* Autocomplete Dropdown */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    z-index: 1000;
    margin-top: 2px;
}

#fvd-app.dark .autocomplete-dropdown {
    background: #2c2c2c;
    border-color: #555;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

#fvd-app.dark .autocomplete-item {
    border-bottom-color: #444;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #f0f7ff;
}

#fvd-app.dark .autocomplete-item:hover {
    background: #3a3a3a;
}

.autocomplete-item .guest-name {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

#fvd-app.dark .autocomplete-item .guest-name {
    color: #e0e0e0;
}

.autocomplete-item .guest-address {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

#fvd-app.dark .autocomplete-item .guest-address {
    color: #aaa;
}

.autocomplete-item .guest-count {
    font-size: 11px;
    color: #4a9fd4;
    margin-top: 3px;
    font-weight: 500;
}

/* Druckformat Auswahl */
#inp-print-format {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

#print-buttons-a4,
#print-buttons-a5 {
    margin-top: 15px;
}

#print-buttons-a5 {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-a5 {
    flex: 1;
}

/* History Print Modal */
.modal-small {
    max-width: 350px;
}

.modal-small .modal-body {
    padding: 20px;
}

#history-print-buttons-a5 {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* A5 Preview Styles */
.print-area-a5 {
    width: 210mm;
    height: 148mm;
    padding: 6mm;
    background: #fff;
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.print-area-a5 .a5-page {
    width: 100%;
    height: 100%;
}

.print-area-a5 .a5-cols {
    display: flex;
    width: 100%;
    height: 100%;
}

.print-area-a5 .col {
    width: 50%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.print-area-a5 .col-left {
    padding-right: 3mm;
}

.print-area-a5 .col-right {
    padding-left: 3mm;
}

/* A5 Überschriften */
.print-area-a5 h2 {
    font-size: 10pt;
    margin: 0 0 2px 0;
    border-bottom: 1px solid #000;
    padding-bottom: 2px;
    font-weight: bold;
}

/* A5 §4 Tabelle */
.print-area-a5 .table-s4 {
    width: 100%;
    border-collapse: collapse;
    font-size: 6pt;
}
.print-area-a5 .table-s4 th,
.print-area-a5 .table-s4 td {
    border: 1px solid #666;
    padding: 1px 2px;
    text-align: left;
    vertical-align: top;
    line-height: 1.1;
}
.print-area-a5 .table-s4 th {
    background-color: #eee;
    font-weight: bold;
    font-size: 6.5pt;
}
.print-area-a5 .table-s4 .col-nr {
    width: 20px;
    text-align: center;
    font-weight: bold;
}

/* A5 §7 Tabelle */
.print-area-a5 .table-s7 {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2px;
    font-size: 7pt;
}
.print-area-a5 .table-s7 th,
.print-area-a5 .table-s7 td {
    border: 1px solid #666;
    padding: 1px 2px;
    text-align: left;
    vertical-align: top;
}
.print-area-a5 .table-s7 th {
    background-color: #eee;
    font-weight: bold;
}

.print-area-a5 .protected-info {
    font-size: 7pt;
    margin-bottom: 2px;
}

.print-area-a5 .bremen-note {
    font-size: 6pt;
    font-weight: bold;
    margin-top: 2px;
    margin-bottom: 2px;
}

.print-area-a5 .highlight-box {
    border: 1px solid #000;
    padding: 3px 4px;
    background: #fdfdfd;
    font-size: 6.5pt;
    margin-top: 4px;
}
.print-area-a5 .highlight-box p {
    margin: 0;
}
.print-area-a5 .highlight-box .spin-rule {
    margin-top: 2px;
}

/* A5 §5 Text */
.print-area-a5 .text-s5 {
    font-size: 7.5pt;
}
.print-area-a5 .text-s5 h2 {
    font-size: 10pt;
}
.print-area-a5 .text-s5 ul {
    padding-left: 12px;
    margin: 2px 0 4px 0;
}
.print-area-a5 .text-s5 li {
    margin-bottom: 2px;
    line-height: 1.15;
}
.print-area-a5 .text-s5 .section-title {
    margin-top: 4px;
    margin-bottom: 1px;
}
.print-area-a5 .text-s5 .homepage-note {
    border: 1px solid #000;
    padding: 4px;
    margin-top: 6px;
    text-align: center;
    font-weight: bold;
}

/* A5 Gastkarte kompakt */
.print-area-a5 .permit-card-compact {
    width: 100%;
    height: 100%;
    padding: 2mm;
    border: 1.5px solid #000;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.print-area-a5 .permit-header-compact {
    text-align: center;
    border-bottom: 1px solid #000;
    padding-bottom: 2mm;
    margin-bottom: 2mm;
}
.print-area-a5 .permit-header-compact .permit-logo {
    max-height: 55px;
    display: block;
    margin: 0 auto 3px;
}
.print-area-a5 .permit-header-compact h1 {
    margin: 2px 0 1px;
    font-size: 11pt;
}
.print-area-a5 .permit-header-compact h2 {
    margin: 0;
    font-size: 8pt;
    font-weight: normal;
    border: none;
}
.print-area-a5 .permit-header-compact .permit-nr {
    margin-top: 2px;
    font-size: 7pt;
    color: #333;
}

.print-area-a5 .permit-data-section-compact {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 2mm;
}

.print-area-a5 .permit-data-compact {
    flex: 1;
    border-collapse: collapse;
    font-size: 6.5pt;
}
.print-area-a5 .permit-data-compact tr {
    border-bottom: 1px dotted #999;
}
.print-area-a5 .permit-data-compact td {
    padding: 1px 2px;
    vertical-align: top;
}
.print-area-a5 .permit-data-compact td.label {
    width: 60px;
    font-weight: bold;
}

.print-area-a5 .permit-qr-compact {
    flex-shrink: 0;
    width: 70px;
}
.print-area-a5 .qr-code-compact {
    width: 70px;
    height: 70px;
    border: 1px solid #ddd;
    padding: 2px;
}

.print-area-a5 .permit-warning {
    background: #ffeeee;
    border: 1.5px solid #cc0000;
    padding: 3px 5px;
    margin: 2px 0;
    font-size: 6.5pt;
}

.print-area-a5 .permit-info-box {
    background: #eeffee;
    border: 1.5px solid #00aa00;
    padding: 3px 5px;
    margin: 2px 0;
    font-size: 6.5pt;
}

.print-area-a5 .permit-rules-compact {
    font-size: 6.5pt;
    color: #333;
    margin: 3px 0;
}

.print-area-a5 .permit-footer-compact {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
    padding-top: 3mm;
}
.print-area-a5 .stamp-area-compact {
    width: 100px;
}
.print-area-a5 .stamp-image-compact {
    width: 100px;
    height: auto;
}
.print-area-a5 .signature-area-compact {
    width: 50%;
    text-align: center;
}
.print-area-a5 .signature-line-compact {
    border-top: 1px solid #000;
    margin-bottom: 2px;
}
.print-area-a5 .signature-image {
    max-width: 120px;
    max-height: 50px;
    margin-bottom: 2px;
}
.print-area-a5 .signature-area-compact p {
    margin: 0;
    font-size: 7pt;
}

/* Logo gleich groß wie A4 */
.print-area-a5 .permit-header-compact .permit-logo {
    max-height: 55px;
    display: block;
    margin: 0 auto 3px;
}
