:root {
    --bg-cream: #F5F5DC;
    --royal-maroon: #800000;
    --gold: #D4AF37;
    --white: #FFFFFF;
    --charcoal: #333333;
}

* { box-sizing: border-box; font-family: 'Segoe UI', sans-serif; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg-cream); margin: 0; padding: 0; color: var(--charcoal); overflow-x: hidden; }

header { background: var(--royal-maroon); color: white; padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 1000; height: 60px; }
.header-left { font-weight: bold; font-size: 16px; letter-spacing: 1px; }
.status-container { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: #ff4444; border: 2px solid white; }
.status-dot.online { background: #00ff00; box-shadow: 0 0 8px #00ff00; }
.logout-btn { background: var(--gold); border: none; padding: 6px 12px; border-radius: 4px; font-size: 12px; font-weight: bold; color: var(--royal-maroon); cursor: pointer; }

#settings-btn { position: fixed; top: 15px; right: 15px; z-index: 9999; background: white; border: 2px solid var(--royal-maroon); border-radius: 50%; width: 45px; height: 45px; font-size: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 8px rgba(0,0,0,0.2); }

.view { display: none; padding: 20px; animation: fadeIn 0.3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Login & Console */
#login-page { padding: 40px 20px; text-align: center; max-width: 400px; margin: auto; display: block; }
#console-log { background: #1a1a1a; color: #00ff00; height: 120px; overflow-y: auto; text-align: left; padding: 12px; font-family: monospace; font-size: 11px; margin-top: 25px; border-radius: 10px; border: 2px solid var(--gold); }

/* Forms & Inputs */
.btn-main { background: var(--royal-maroon); color: white; border: none; width: 100%; padding: 15px; border-radius: 10px; font-size: 16px; cursor: pointer; font-weight: bold; }
.btn-main:disabled { background: #ccc; cursor: not-allowed; }
input, select, textarea { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 10px; font-size: 16px; margin-bottom: 15px; background: #fff; outline: none; }
.input-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.btn-icon { width: 50px; height: 50px; background: #eee; border: 1px solid #ddd; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; }

/* Design Cards Grid */
.design-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 15px; }
.design-card { background: white; border: 1px solid #ddd; border-radius: 10px; overflow: hidden; text-align: center; padding-bottom: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); cursor: pointer; position: relative; }
.design-card img { width: 100%; height: 90px; object-fit: cover; }
.design-card .info { font-size: 10px; padding: 3px; font-weight: bold; line-height: 1.2; }

/* Action Buttons on Card */
.del-design-btn { position: absolute; top: 5px; right: 5px; background: red; color: white; border: 1px solid white; width: 25px; height: 25px; border-radius: 50%; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }
.edit-design-btn { position: absolute; top: 5px; left: 5px; background: #2196f3; color: white; border: 1px solid white; width: 25px; height: 25px; border-radius: 50%; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }
.zoom-design-btn { position: absolute; top: 35px; right: 5px; background: rgba(0,0,0,0.6); color: white; border: 1px solid white; width: 25px; height: 25px; border-radius: 50%; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }

/* Stock List Styles */
.pending-list { margin-bottom: 20px; margin-top: 10px; }
.pending-item { 
    background: white; border: 1px solid #ddd; padding: 12px; border-radius: 8px; 
    margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); animation: fadeIn 0.3s ease;
}
.pending-item span { font-weight: bold; color: var(--royal-maroon); font-size: 18px; }
.pending-item small { color: grey; margin-left: 10px; font-size: 14px; }
.del-item-btn { 
    background: #ff4444; color: white; border: none; width: 35px; height: 35px; 
    border-radius: 50%; font-weight: bold; cursor: pointer; display: flex; 
    align-items: center; justify-content: center; font-size: 16px;
}

/* FAB */
.fab-btn {
    width: 70px; height: 70px; background: var(--royal-maroon); color: white; 
    border-radius: 50%; border: none; font-size: 35px; display: flex; 
    align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(128,0,0,0.4);
    margin: 20px auto; cursor: pointer; transition: transform 0.2s;
}
.fab-btn:active { transform: scale(0.9); }

/* Suggestion Box */
.suggestion-box { 
    background: #e3f2fd; color: #1565c0; padding: 8px 12px; 
    border-radius: 6px; font-size: 13px; font-weight: bold; 
    margin-top: -10px; margin-bottom: 15px; cursor: pointer; display: none; 
    border: 1px dashed #1565c0; text-align: center;
}
.suggestion-box:active { background: #bbdefb; }

/* Size Grid */
.size-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 15px; }
.size-btn { padding: 15px; background: white; border: 2px solid var(--royal-maroon); color: var(--royal-maroon); border-radius: 8px; font-weight: bold; font-size: 16px; cursor: pointer; }
.size-btn:active { background: var(--royal-maroon); color: white; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: none; align-items: center; justify-content: center; z-index: 5000; padding: 15px; }
.modal-content { background: white; border-radius: 20px; width: 100%; max-width: 450px; padding: 25px; max-height: 90vh; overflow-y: auto; text-align: center; position: relative; }

/* Post Save Action Buttons */
.action-row { display: flex; gap: 15px; margin-top: 20px; }
.btn-outline { background: white; border: 2px solid var(--royal-maroon); color: var(--royal-maroon); }

/* Existing Stock List */
.existing-stock-item { 
    display: flex; justify-content: space-between; align-items: center; 
    border-bottom: 1px solid #eee; padding: 10px 0; text-align: left;
}
.stock-meta { font-size: 12px; color: grey; }
.stock-id { font-weight: bold; color: var(--royal-maroon); font-size: 14px; }

#selected-info-box { background: #e3f2fd; color: #1565c0; padding: 12px; border-radius: 10px; font-weight: bold; margin-bottom: 15px; border: 1px solid #bbdefb; display: none; text-align: left; }
#loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(128, 0, 0, 0.95); z-index: 9999; display: none; align-items: center; justify-content: center; flex-direction: column; color: white; }
.loader-spinner { border: 5px solid #f3f3f3; border-top: 5px solid var(--gold); border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; margin-bottom: 20px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#install-btn { display: none; width: 100%; padding: 12px; background: #2196f3; color: white; border: none; border-radius: 10px; margin-bottom: 20px; font-weight: bold; cursor: pointer; }

/* Factory Stück Tile */
.pcs-item-tile { 
    background: white; border: 1px solid #eee; padding: 12px; 
    border-radius: 10px; margin-bottom: 8px; cursor: pointer; 
    display: flex; flex-direction: column; gap: 4px; 
}
.pcs-item-tile:active { background: #f9f9f9; }

/* ── BALANCER PRO STYLES ── */
.balancer-nav { display: flex; background: white; border-radius: 10px; margin-bottom: 15px; overflow: hidden; border: 1px solid #ddd; }
.balancer-nav-item { flex: 1; text-align: center; padding: 12px; font-weight: bold; color: grey; cursor: pointer; }
.balancer-nav-item.active { background: var(--royal-maroon); color: white; }

.list-card { background: white; border: 1px solid #ddd; border-radius: 10px; padding: 16px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.lc-title { font-size: 16px; font-weight: bold; color: var(--royal-maroon); }
.lc-meta { font-size: 12px; color: grey; margin-top: 4px; }
.badge { background: var(--gold); color: black; font-size: 12px; font-weight: bold; padding: 4px 10px; border-radius: 20px; text-align: center; }

.assign-group { background: white; border: 1px solid #ddd; border-radius: 10px; margin-bottom: 16px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.ag-hdr { display: flex; align-items: center; gap: 14px; padding: 14px; border-bottom: 1px solid #ddd; }
.ag-img { width: 56px; height: 64px; border-radius: 8px; object-fit: cover; }
.ag-title { font-weight: bold; font-size: 16px; color: var(--royal-maroon); }
.ag-sub { font-size: 12px; color: grey; margin-top: 2px; }
.ag-body { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; }

.sz-pill { background: var(--bg-cream); border: 1px solid #ddd; border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.sz-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sz-val { font-weight: bold; font-size: 16px; }
.sz-lim { font-size: 12px; color: var(--royal-maroon); font-weight: bold; background: rgba(128,0,0,0.1); padding: 2px 8px; border-radius: 10px; }
.sz-del { background: none; border: none; color: red; font-size: 14px; cursor: pointer; margin-top: 5px; text-align: right; }

.balancer-gal-card { background: white; border-radius: 10px; overflow: hidden; border: 1px solid #ddd; box-shadow: 0 2px 4px rgba(0,0,0,0.05); position: relative; cursor: pointer; display: flex; flex-direction: column; height: max-content; }
.balancer-gal-card img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; }
.balancer-gal-info { padding: 8px; text-align: center; }
.balancer-gal-info b { font-size: 13px; font-weight: 800; color: var(--royal-maroon); display: block; margin-bottom: 4px; line-height: 1.2; }
.balancer-gal-info span { font-size: 11px; color: grey; }

.sz-btn-bal { padding: 14px; border: 2px solid #ccc; background: white; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; transition: 0.2s; }
.sz-btn-bal.selected { border-color: var(--royal-maroon); background: rgba(128,0,0,0.05); }
.sz-lbl-bal { font-size: 16px; font-weight: bold; color: grey; }
.sz-btn-bal.selected .sz-lbl-bal { color: var(--royal-maroon); }
.qty-ctrl-bal { display: none; align-items: center; gap: 8px; }
.sz-btn-bal.selected .qty-ctrl-bal { display: flex; }
.qty-ctrl-bal button { background: var(--gold); color: black; border: none; width: 28px; height: 28px; border-radius: 6px; font-weight: bold; cursor: pointer; }
.qty-ctrl-bal input { width: 36px; background: transparent; border: none; color: black; font-weight: bold; font-size: 16px; text-align: center; outline: none; }
