/* Datei: /app.css */
:root { --primary: #2563eb; --primary-hover: #1d4ed8; --bg-body: #f3f4f6; --bg-surface: #ffffff; --border: #e5e7eb; --text-main: #111827; --text-muted: #6b7280; --danger: #dc2626; --success: #16a34a; --radius: 12px; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg-body); color: var(--text-main); margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* Wrapper für Mobile Ansicht */
#app-container { max-width: 500px; margin: 0 auto; min-height: 100vh; background: var(--bg-body); position: relative; display: flex; flex-direction: column; overflow-x: hidden; }

/* Login Screen */
#login-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; padding: 20px; background: var(--bg-surface); }
.login-box { width: 100%; max-width: 320px; text-align: center; }
.form-group { margin-bottom: 16px; text-align: left; width: 100%; box-sizing: border-box; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; color: var(--text-muted); }

/* Box-Sizing erzwingt, dass Felder NIE breiter als der Bildschirm werden */
.form-group input, .form-group select, input#library-search { 
    width: 100% !important; padding: 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 16px; box-sizing: border-box; outline: none; transition: 0.2s; background: var(--bg-surface); color: var(--text-main); box-shadow: 0 1px 3px rgba(0,0,0,0.05); appearance: none; 
}
.form-group input:focus, .form-group select:focus, input#library-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; font-size: 16px; font-weight: 600; border: none; border-radius: 10px; cursor: pointer; transition: 0.2s; width: 100%; box-sizing: border-box; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 6px rgba(37,99,235,0.2); }
.btn-primary:active { transform: scale(0.98); }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline:active { background: var(--bg-body); }
.icon-btn { border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; transition: 0.2s; background: transparent; padding: 8px; }
.icon-btn:active { opacity: 0.7; background: var(--bg-body); }

/* Main App Views */
.app-view { display: none; flex: 1; padding: 20px; padding-bottom: 90px; overflow-y: auto; overflow-x: hidden; width: 100%; box-sizing: border-box; }
.app-view.active { display: block; }

/* Header & Status */
.app-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.app-header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.status-card { background: var(--bg-surface); padding: 24px; border-radius: var(--radius); text-align: center; box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 24px; border: 1px solid var(--border); }
.status-indicator { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--text-muted); margin-bottom: 10px; }
.status-indicator.active { background: #16a34a; box-shadow: 0 0 10px #16a34a; animation: pulse 2s infinite; }
.status-indicator.pause { background: #f59e0b; box-shadow: 0 0 10px #f59e0b; }
@keyframes pulse { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(22, 163, 74, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Scanner UI */
#reader { width: 100%; border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; border: 2px solid var(--border); }
#reader button { background: var(--primary); color: white; border: none; padding: 10px 15px; border-radius: 6px; font-weight: bold; margin: 10px 0; }
#reader select { padding: 10px; border-radius: 6px; border: 1px solid var(--border); margin-bottom: 10px; width: 100%; }

/* History List */
.history-list { list-style: none; padding: 0; margin: 0; }
.history-item { background: var(--bg-surface); padding: 16px; border-radius: var(--radius); margin-bottom: 10px; border: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
.history-time { font-size: 14px; color: var(--text-muted); }
.history-job { font-weight: 600; font-size: 15px; margin-top: 4px; }

/* Bottom Navigation */
.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; width: 100%; background: var(--bg-surface); border-top: 1px solid var(--border); justify-content: space-around; padding: 10px 0 20px 0; z-index: 100; }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-muted); text-decoration: none; font-size: 12px; font-weight: 500; cursor: pointer; width: 33%; }
.nav-item.active { color: var(--primary); }

.msg { padding: 12px; border-radius: 6px; font-size: 14px; margin-bottom: 15px; text-align: center; }
.msg-error { background: #fef2f2; color: var(--danger); border: 1px solid #f87171; }

/* Modals & Formulare perfektioniert! */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9999; justify-content: center; align-items: center; padding: 15px; box-sizing: border-box; }
.modal-content { background: var(--bg-surface); padding: 25px 20px; border-radius: 16px; width: 100%; max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); max-height: 90vh; overflow-y: auto; box-sizing: border-box; text-align: left; }
.modal-content h2 { margin-top: 0; font-size: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 10px; color: var(--text-main); }

.modal-content div[style*="display: flex"], .modal-content div[style*="display:flex"] { gap: 15px !important; width: 100%; box-sizing: border-box; margin-bottom: 5px; }
.modal-content .form-group { margin-bottom: 15px; flex: 1; min-width: 0; }

/* Kunden Autocomplete */
.autocomplete-suggestions { list-style: none; padding: 0; margin: 4px 0 0 0; border: 1px solid var(--border); border-radius: 10px; max-height: 180px; overflow-y: auto; display: none; background: white; position: absolute; top: 100%; left: 0; width: 100%; box-sizing: border-box; z-index: 100000; box-shadow: 0 10px 20px rgba(0,0,0,0.15); }
.autocomplete-suggestions li { padding: 14px 15px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 15px; color: var(--text-main); transition: background 0.2s; }
.autocomplete-suggestions li:last-child { border-bottom: none; }
.autocomplete-suggestions li:active { background: var(--bg-body); }

/* Print Container */
#print-container { display: none; background: white; position: absolute; top: 0; left: 0; width: 100%; min-height: 100vh; z-index: 100000; box-sizing: border-box; padding: 20px; }
@media print {
    body * { visibility: hidden; }
    #print-container, #print-container * { visibility: visible; }
    #print-container { display: block !important; position: absolute; left: 0; top: 0; width: 100%; }
    #app-container, .bottom-nav { display: none !important; }
}

/* CHRIS FIX: Neues Design für die Tätigkeiten (Kacheln statt Dropdown) */
.task-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.task-btn { background: var(--bg-body); border: 1px solid var(--border); border-radius: 8px; padding: 14px 8px; text-align: center; font-size: 15px; font-weight: 600; color: var(--text-main); cursor: pointer; transition: 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.task-btn:active { transform: scale(0.96); background: var(--border); }