/* ================================================================
   KORONA POS Kundenbestellungs-App – POS-optimiertes Styling v2.0
   Optimiert für Touch-Displays (Combase Kassen, 1024x768+)
   ================================================================ */

:root {
    --app-height: 100vh;
    --color-primary: #2e7d32;
    --color-primary-dark: #1b5e20;
    --color-primary-light: #4caf50;
    --color-danger: #c62828;
    --color-danger-light: #ef5350;
    --color-warning: #f57f17;
    --color-info: #1565c0;
    --color-bg: #f5f5f5;
    --color-card: #ffffff;
    --color-text: #212121;
    --color-text-secondary: #616161;
    --color-border: #e0e0e0;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    height: 100%;
    min-height: var(--app-height);
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    overflow: hidden;
}

.app-container {
    max-width: 960px;
    margin: 0 auto;
    min-height: var(--app-height);
    height: var(--app-height);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ================================================================
   HEADER
   ================================================================ */
.app-header {
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    color: white;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    font-size: 1.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.header-title {
    font-size: 1.12rem;
    opacity: 0.95;
    flex: 1;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.pos-context {
    font-size: 0.75rem;
    opacity: 0.8;
    white-space: nowrap;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #757575;
    transition: background 0.3s;
}
.status-dot.online { background: #69f0ae; box-shadow: 0 0 6px #69f0ae; }
.status-dot.offline { background: #ef5350; box-shadow: 0 0 6px #ef5350; }

/* ================================================================
   SUCHE
   ================================================================ */
.search-section {
    padding: 10px 10px 8px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.search-box {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    height: 100%;
    overflow: hidden;
}

.search-box h2 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--color-primary-dark);
}

.search-input-group {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 1.15rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.search-hint {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 22px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-height: 52px;
}

.btn-primary, .btn-search {
    background: var(--color-primary);
    color: white;
}
.btn-primary:hover, .btn-search:hover {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow);
}
.btn-primary:active, .btn-search:active {
    transform: scale(0.97);
}

.btn-back {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    padding: 8px 16px;
    font-size: 0.9rem;
}
.btn-back:hover { background: rgba(46,125,50,0.08); }

.btn-redeem {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 18px 32px;
    box-shadow: var(--shadow-lg);
    min-width: 100%;
    min-height: auto;
    width: 100%;
}
.btn-redeem:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(46,125,50,0.3);
}
.btn-redeem:active { transform: scale(0.97); }
.btn-redeem.btn-disabled {
    background: #9e9e9e;
    cursor: not-allowed;
    box-shadow: none;
}
.btn-redeem.btn-disabled:hover { transform: none; }

.btn-cancel {
    background: #d32f2f;
    color: white;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 12px 24px;
    width: 100%;
    min-height: auto;
}
.btn-cancel:hover { background: #b71c1c; }

/* ================================================================
   MELDUNGEN
   ================================================================ */
.message-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-top: 16px;
    font-size: 0.95rem;
    box-shadow: var(--shadow);
}

.error-box {
    background: #ffebee;
    border-left: 4px solid var(--color-danger);
    color: var(--color-danger);
}

.success-box {
    background: #e8f5e9;
    border-left: 4px solid var(--color-primary);
    color: var(--color-primary-dark);
}

.message-icon { font-size: 1.3rem; flex-shrink: 0; }
.btn-close {
    margin-left: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
    padding: 4px 8px;
}
.btn-close:hover { opacity: 1; }

/* ================================================================
   SUCHERGEBNISSE
   ================================================================ */
.results-area {
    margin-top: 20px;
}
.results-area h3 { margin-bottom: 12px; color: var(--color-text); }
.badge {
    background: var(--color-primary);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-left: 8px;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-card {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 14px 18px;
    cursor: pointer;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--color-primary);
    transition: all 0.2s;
}
.result-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-lg);
}
.result-card:active { transform: scale(0.99); }

.result-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.result-number { font-size: 1.1rem; font-weight: 700; }
.result-meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    flex-wrap: wrap;
}

/* ================================================================
   STATUS-TAGS
   ================================================================ */
.status-tag, .order-status-badge {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.status-open { background: #e3f2fd; color: #1565c0; }
.status-ready { background: #fff3e0; color: #e65100; }
.status-finalized { background: #e8f5e9; color: #2e7d32; }
.status-canceled { background: #fce4ec; color: #c62828; }
.status-unknown { background: #f5f5f5; color: #757575; }

/* ================================================================
   BESTELLDETAIL
   ================================================================ */
.order-detail-section {
    padding: 10px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.order-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.order-number-display {
    font-size: 1.8rem;
    font-weight: 700;
    flex: 1;
}

.order-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.customer-meta-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.meta-chip {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 10px 20px;
    font-size: 1.15rem;
    line-height: 1.3;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-card {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 8px 10px;
    box-shadow: var(--shadow);
}
.info-label {
    font-size: 0.68rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.info-value { font-size: 0.92rem; font-weight: 500; line-height: 1.25; }

.comment-compact {
    display: grid;
    gap: 2px;
}

.comment-key {
    font-weight: 600;
    color: var(--color-text-secondary);
}

.comment-extra,
.comment-plain {
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================================================================
   ANZAHLUNGEN
   ================================================================ */
.deposits-section {
    background: #fff8e1;
    border-radius: var(--radius);
    padding: 8px 10px;
    margin-bottom: 10px;
    border-left: 4px solid var(--color-warning);
}
.deposits-section h3 { font-size: 0.9rem; margin-bottom: 6px; }
.deposit-item {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 0.82rem;
}
.deposit-amount { font-weight: 600; color: var(--color-primary-dark); }

/* ================================================================
   ARTIKEL-LISTE (EINFACH)
   ================================================================ */
.order-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1.1rem;
}

.item-name {
    flex: 1;
    font-weight: 500;
}

.item-qty {
    font-weight: 600;
    color: var(--color-text-secondary);
    min-width: 50px;
    text-align: center;
}

.item-price {
    font-weight: 600;
    color: var(--color-primary-dark);
    min-width: 80px;
    text-align: right;
}

/* ================================================================
   SUMMEN-ANZEIGE
   ================================================================ */
.order-summary {
    background: var(--color-card);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 600;
}

.total-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary-dark);
}

/* ================================================================
   DETAIL LAYOUT: LISTE LINKS, SIDEBAR RECHTS
   ================================================================ */
#detailSection {
    height: calc(100vh - 120px);
    overflow: hidden;
    padding: 10px 0;
}

.order-card {
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 14px;
    align-items: start;
}

.order-header,
.customer-meta-bar,
.order-items,
#orderSummarySection,
.multi-order-section {
    grid-column: 1;
}

.detail-sidebar {
    grid-column: 2;
    position: sticky;
    top: 0;
    height: calc(100vh - 170px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#orderSummarySection {
    max-height: calc(100vh - 170px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
}

#orderSummarySection::-webkit-scrollbar {
    width: 18px;
}

#orderSummarySection::-webkit-scrollbar-track {
    background: #d8d8d8;
    border-radius: 10px;
}

#orderSummarySection::-webkit-scrollbar-thumb {
    background: #8f8f8f;
    border-radius: 10px;
    border: 3px solid #d8d8d8;
}

#orderSummarySection {
    scrollbar-width: auto;
    scrollbar-color: #8f8f8f #d8d8d8;
}

.order-summary {
    margin-bottom: 0;
    position: static;
    z-index: auto;
}

.order-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.order-actions-primary {
    order: 1;
}

.order-summary {
    order: 2;
}

.order-actions-secondary {
    order: 3;
    margin-top: 6px;
}

.quick-add-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-add-form .search-input {
    font-size: 1rem;
    padding: 12px 14px;
}

.order-actions .btn {
    width: 100%;
    min-width: 0;
}

/* ================================================================
   MULTI-ORDER ANZEIGE
   ================================================================ */
.order-group {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.order-group-redeemed {
    border-color: #d32f2f;
    background: #fff7f7;
}

.order-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 10px;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: visible;
}

.order-group-number {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-primary-dark);
    flex-shrink: 0;
}

.order-group-customer {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    flex: 1;
}

.order-status-badge {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    order: 1;
    min-width: 170px;
    justify-content: center;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.1;
    margin-right: 8px;
}

.slot-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.9;
}

.slot-time {
    font-size: 0.95rem;
    font-weight: 700;
}

.slot-deviation {
    font-size: 0.85rem;
    font-weight: 700;
}

/* Badge Farben basierend auf Abweichung – WICHTIG: Mehr spezifisch als .open */
.order-status-badge.badge-deviation-green {
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
    border-color: #a5d6a7 !important;
}

.order-status-badge.badge-deviation-red {
    background: #ffebee !important;
    color: #c62828 !important;
    border-color: #ef9a9a !important;
}

/* Alte Farben (nur wenn KEINE Abweichung vorhanden) */
.order-status-badge.open:not(.badge-deviation-green):not(.badge-deviation-red) {
    color: #1b5e20;
    background: #e8f5e9;
    border-color: #a5d6a7;
}

.order-status-badge.closed {
    color: #b71c1c;
    background: #ffebee;
    border-color: #ef9a9a;
}

.btn-remove-order {
    background: transparent;
    border: none;
    color: #d32f2f;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 6px 8px;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    line-height: 1;
    min-width: 46px;
    order: 4;
    margin-left: 4px;
}

.btn-remove-order:hover {
    background: rgba(198, 40, 40, 0.1);
    border-radius: 50%;
}

.order-group-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.order-item-header {
    display: grid;
    grid-template-columns: 56px minmax(120px, 1fr) 110px 90px 110px 120px;
    align-items: center;
    gap: 10px;
    padding: 4px 0 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
}

.order-item-row {
    display: grid;
    grid-template-columns: 56px minmax(120px, 1fr) 110px 90px 110px 120px;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}

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

.order-item-row .item-qty {
    text-align: left;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.order-item-row .item-name {
    text-align: left;
}

.order-item-header .item-unit-price,
.order-item-header .item-discount-pct,
.order-item-header .item-discount-amt,
.order-item-header .item-line-total,
.order-item-row .item-unit-price,
.order-item-row .item-discount-pct,
.order-item-row .item-discount-amt,
.order-item-row .item-line-total {
    text-align: right;
}

.order-item-row .item-unit-price,
.order-item-row .item-discount-pct,
.order-item-row .item-discount-amt,
.order-item-row .item-line-total {
    font-weight: 600;
    color: var(--color-primary-dark);
}

.order-group-subtotal {
    padding-top: 8px;
    padding-bottom: 0;
    border-top: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: right;
    color: var(--color-primary-dark);
}

.order-empty-state {
    background: var(--color-card);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 18px 16px;
    margin-bottom: 12px;
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    text-align: center;
}

/* ================================================================
   POSITIONS-TABELLE
   ================================================================ */
.order-items-section {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 10px;
    flex: 1;
    overflow-x: auto;
}

.order-items-section h3 { margin-bottom: 10px; font-size: 1.15rem; }

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.05rem;
}
.items-table th {
    background: #f5f5f5;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
    border-bottom: 2px solid var(--color-border);
}
.items-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.items-table tbody tr:hover { background: #fafafa; }

.col-qty { width: 60px; text-align: center; font-weight: 600; }
.col-product { min-width: 180px; }
.col-artnr { width: 100px; font-size: 0.85rem; color: var(--color-text-secondary); }
.col-price, .col-total { width: 100px; text-align: right; }
.col-total { font-weight: 600; }

.product-name { font-weight: 500; }
.product-desc { font-size: 0.8rem; color: var(--color-text-secondary); margin-top: 2px; }
.product-number { font-size: 0.8rem; color: var(--color-text-secondary); }

.total-row td {
    border-top: 2px solid var(--color-text);
    font-size: 1.2rem;
    padding-top: 12px;
}
.total-label { text-align: right; font-weight: 600; }
.total-value { text-align: right; font-weight: 700; font-size: 1.35rem; color: var(--color-primary-dark); }

.deposits-row td { font-size: 0.9rem; color: var(--color-warning); }
.deposits-value { color: var(--color-warning); font-size: 0.95rem !important; }
.remaining-row td { font-size: 1.05rem; }
.remaining-value { color: var(--color-primary-dark); }

/* ================================================================
   AKTIONS-BUTTONS
   ================================================================ */
.order-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: stretch;
    align-items: stretch;
    padding: 0;
    flex-wrap: nowrap;
}

.order-actions-primary {
    order: 1;
}

.order-actions-secondary {
    order: 2;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-add-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-add-form .search-input {
    font-size: 0.95rem;
    padding: 10px 12px;
    min-height: auto;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
}

.quick-add-form .btn-secondary {
    font-size: 1rem;
    padding: 10px 14px;
    min-height: auto;
}

/* ================================================================
   POS-API INFO
   ================================================================ */
.pos-api-info {
    text-align: center;
    font-size: 0.8rem;
    padding: 8px;
    color: var(--color-text-secondary);
}
.pos-api-ok { color: var(--color-primary); }
.pos-api-warn { color: var(--color-warning); }

/* ================================================================
   LOADING OVERLAY
   ================================================================ */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
    color: white;
    font-size: 1.1rem;
    margin-top: 16px;
    font-weight: 500;
}

/* ================================================================
   RESPONSIVE (kleine POS-Displays)
   ================================================================ */
@media (max-width: 768px) {
    .app-header { padding: 10px 14px; gap: 10px; }
    .header-logo { font-size: 1.1rem; }
    .header-title { font-size: 0.9rem; }
    .search-section { padding: 16px 12px; }
    .search-box { padding: 16px; }
    .search-box h2 { font-size: 1.1rem; }
    .search-input { font-size: 1rem; padding: 12px; }
    .search-input-group { flex-direction: column; }
    .order-info-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .order-detail-section { padding: 12px; }
    .items-table { font-size: 0.85rem; }
    .items-table th, .items-table td { padding: 8px 6px; }
    .col-artnr { display: none; } /* Artikelnummer auf kleinen Displays verstecken */
    .btn-redeem { font-size: 1rem; padding: 14px 24px; min-width: auto; width: 100%; }
    #detailSection {
        height: auto;
        overflow: visible;
    }
    .order-card {
        display: block;
        height: auto;
    }
    #orderSummarySection {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }
    .detail-sidebar,
    .order-summary,
    .order-actions,
    .order-actions-secondary {
        position: static;
        height: auto;
        margin-top: 0;
    }
    .order-actions { flex-direction: column; }
    .btn-cancel { width: 100%; }
}

/* Extra-kleine Displays (z.B. 800x600) */
@media (max-width: 480px) {
    .header-title { display: none; }
    .order-number-display { font-size: 1rem; }
    .info-card { padding: 8px 12px; }
    .order-info-grid { grid-template-columns: 1fr; }
    .meta-chip { width: 100%; }
    .col-price { display: none; }
}

/* ============================================================ */
/* SANDBOX MODE BANNER                                           */
/* ============================================================ */
.sandbox-banner {
    background: linear-gradient(135deg, #ff9800 0%, #ff5722 100%);
    border-bottom: 3px solid #d84315;
    padding: 12px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    animation: pulse-warning 2s infinite;
}

.sandbox-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sandbox-icon {
    font-size: 24px;
    animation: rotate-icon 3s infinite linear;
}

.sandbox-text {
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

@keyframes rotate-icon {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Anpassungen */
@media (max-width: 480px) {
    .sandbox-banner {
        padding: 10px;
    }
    .sandbox-content {
        font-size: 14px;
        gap: 10px;
    }
    .sandbox-icon {
        font-size: 20px;
    }
}

/* ================================================================
   MULTI-ORDER SECTION
   ================================================================ */
.multi-order-section {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 2px solid var(--color-info);
    border-radius: var(--radius);
    padding: 20px;
    margin: 20px 0;
}

.multi-order-section h3 {
    color: var(--color-info);
    font-size: 18px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.multi-order-section h3::before {
    content: '';
}

.multi-order-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.multi-order-item {
    background: white;
    border: 1px solid #90caf9;
    border-radius: 6px;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
}

.multi-order-item span {
    color: var(--color-text);
    font-weight: 500;
}

.btn-remove {
    background: var(--color-danger-light);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: var(--color-danger);
    transform: scale(1.1);
}

/* Secondary Button Styling */
.btn-secondary {
    background: linear-gradient(135deg, #64b5f6, #42a5f5);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    width: 100%;
    min-height: auto;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #42a5f5, #2196f3);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .multi-order-section {
        padding: 15px;
    }
    
    .multi-order-item {
        font-size: 14px;
        padding: 8px 12px;
    }
}

/* ================================================================
   SEARCH TABS & KUNDENSUCHE
   ================================================================ */
.search-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 3px solid var(--color-border);
}

.search-tab {
    flex: 1;
    padding: 18px 20px;
    font-size: 1.3rem;
    font-weight: 600;
    border: none;
    background: #f0f0f0;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-bottom: 4px solid transparent;
    margin-bottom: -3px;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    -webkit-tap-highlight-color: rgba(46,125,50,0.15);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    min-height: 56px;
}
.search-tab:hover,
.search-tab:active {
    color: var(--color-primary);
    background: #e8f5e9;
}
.search-tab.active {
    color: var(--color-primary-dark);
    border-bottom-color: var(--color-primary);
    background: white;
    font-weight: 700;
}

#searchSection {
    height: calc(var(--app-height) - 76px);
}

#customerSearchPane {
    display: block;
    text-align: left;
    max-height: 100%;
}

#customerSearchInput {
    font-size: 1rem !important;
    padding: 8px 10px !important;
    min-height: 42px !important;
}

#customerSearchForm button[type="submit"] {
    min-height: 42px !important;
    font-size: 0.9rem !important;
    padding: 6px 8px !important;
}

#customerSearchForm button[type="button"] {
    width: 42px !important;
    height: 42px !important;
    font-size: 0.85rem !important;
}

#touchKeyboard {
    padding: 3px !important;
    margin-bottom: 4px !important;
}

#kbLetters td,
#kbNumbers td {
    height: 36px !important;
    font-size: 0.88rem !important;
}

#custResultsWrap button {
    width: 52px !important;
    height: 48px !important;
    font-size: 0.72rem !important;
    line-height: 1.05 !important;
    padding: 0 3px !important;
}

#customerResults {
    max-height: calc(var(--app-height) - 390px) !important;
}

.customer-results {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.customer-empty {
    text-align: center;
    padding: 24px;
    color: var(--color-text-secondary);
    font-size: 1rem;
}

.customer-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.customer-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.customer-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text);
}

.customer-company {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.customer-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.customer-meta-item {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.customer-no-orders {
    padding: 10px 0 2px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-style: italic;
}

.customer-orders-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin-top: 8px;
    margin-bottom: 6px;
}

.customer-orders-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.customer-order-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: #f8faf8;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--color-border);
    transition: background 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: rgba(46,125,50,0.15);
    touch-action: manipulation;
    min-height: 56px;
}
.customer-order-row:hover,
.customer-order-row:active {
    background: #e8f5e9;
    box-shadow: var(--shadow);
}
.customer-order-row.order-finalized {
    opacity: 0.55;
    background: #f5f5f5;
}
.customer-order-row.order-canceled {
    opacity: 0.4;
    background: #fef0f0;
}

.co-number {
    font-weight: 700;
    font-size: 1.15rem;
    min-width: 120px;
}
.co-status {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    flex: 1;
}
.co-items {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}
.co-total {
    font-weight: 700;
    font-size: 1.15rem;
    min-width: 80px;
    text-align: right;
}

/* Sidebar Kundensuche Button */
.btn-customer-search-sidebar {
    font-size: 0.9rem;
    padding: 10px 14px;
    background: #f0f7f0;
    border: 1px solid var(--color-primary);
    color: var(--color-primary-dark);
    font-weight: 600;
}
.btn-customer-search-sidebar:hover,
.btn-customer-search-sidebar:active {
    background: #e0f0e0;
}

/* ================================================================
   KUNDENSUCHE – Touch-optimiertes Layout
   Muss NACH allen globalen Styles stehen (wegen Spezifität)
   ================================================================ */
#customerSearchPane {
    display: block !important;
    padding: 8px 0;
    text-align: left;
}

.cust-search-bar {
    display: block;
    margin-bottom: 8px;
    width: 100%;
}

.cust-search-bar .search-hint {
    display: block;
    margin-top: 6px;
    text-align: center;
    width: 100%;
    clear: both;
}

.cust-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

input.cust-input {
    flex: 1;
    font-size: 1.4rem;
    padding: 14px 18px;
    min-height: 56px;
    border: 2px solid var(--color-primary);
    caret-color: var(--color-primary);
    min-width: 0;
}

#customerSearchForm {
    display: block;
    width: 100%;
}

button.cust-search-btn {
    min-width: 130px;
    font-size: 1.2rem;
    min-height: 56px;
    padding: 12px 20px;
}

button.cust-clear-btn {
    min-width: 56px;
    width: 56px;
    min-height: 56px;
    font-size: 1.4rem;
    padding: 8px;
    background: #9e9e9e;
    color: white;
    border: none;
    border-radius: var(--radius);
}

button.cust-clear-btn:hover,
button.cust-clear-btn:active {
    background: #757575;
}

/* Touch-Tastatur */
.touch-keyboard {
    display: block !important;
    background: #eceff1;
    border-radius: 8px;
    padding: 6px;
    margin-bottom: 10px;
    border: 1px solid #cfd8dc;
    width: 100%;
    overflow: hidden;
}

.kb-row {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: row;
    flex-direction: row;
    gap: 4px;
    margin-bottom: 4px;
    -webkit-justify-content: center;
    justify-content: center;
    width: 100%;
    clear: both;
}

.kb-row:last-child {
    margin-bottom: 0;
}

.kb-key {
    flex: 1 1 0;
    max-width: 72px;
    min-height: 48px;
    font-size: 1.15rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: #fff;
    color: var(--color-text);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transition: background 0.1s, transform 0.08s;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0.08);
    padding: 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kb-key:active {
    background: #e0e0e0;
    transform: scale(0.95);
}

.kb-key-wide {
    flex: 1.6 1 0;
    max-width: 110px;
    background: #cfd8dc;
    font-size: 1.3rem;
}

.kb-key-space {
    flex: 3 1 0;
    max-width: 220px;
}

.kb-key-go {
    flex: 2.5 1 0;
    max-width: 180px;
    background: var(--color-primary);
    color: white;
    font-size: 1.1rem;
}

.kb-key-go:active {
    background: var(--color-primary-dark);
}

/* Ergebnis-Bereich mit Scroll-Buttons */
.cust-results-area {
    display: block;
    margin-top: 6px;
    width: 100%;
}

.cust-results-scroll-wrap {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.cust-scroll-btn {
    width: 52px;
    flex-shrink: 0;
    font-size: 1.8rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    background: var(--color-primary);
    color: white;
    cursor: pointer;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-height: 60px;
    min-width: 52px;
}

.cust-scroll-btn:active {
    background: var(--color-primary-dark);
}

.cust-results-list {
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 480px);
    min-height: 60px;
    scroll-behavior: smooth;
}

.cust-msg {
    padding: 16px;
    text-align: center;
    font-size: 1.1rem;
    color: var(--color-text-secondary);
}

.cust-msg-err {
    color: var(--color-danger);
}

/* Kunden-Karte */
.cust-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 10px;
    overflow: hidden;
}

.cust-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f5f5f5;
    border-bottom: 1px solid var(--color-border);
    font-size: 1.05rem;
    flex-wrap: wrap;
}

.cust-detail {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.cust-count {
    margin-left: auto;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-primary);
    white-space: nowrap;
}

.cust-order-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    margin: 5px 6px;
    border-radius: 6px;
    background: #f8faf8;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.12s;
    touch-action: manipulation;
    min-height: 50px;
}

.cust-order-btn:active {
    background: #e8f5e9;
}

.cust-order-num {
    font-weight: 700;
    font-size: 1rem;
    min-width: 100px;
}

.cust-order-slot {
    color: #1565c0;
    font-weight: 600;
    font-size: 0.9rem;
}

.cust-order-status {
    margin-left: auto;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* Keyboard-Buttons (table-basiert) */
button.kb {
    width: 100%;
    min-height: 52px;
    font-size: 1.2rem;
    font-weight: 600;
    border: 1px solid #bdbdbd;
    border-radius: 6px;
    background: #fff;
    color: #212121;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    padding: 8px 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

button.kb:active {
    background: #c8e6c9;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}
