*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
:root{--bg:#f4f4f2;--surface:#fff;--border:#e2e2de;--text:#1a1a18;--text-muted:#6b6b66;--green:#27500a;--green-bg:#eaf3de;--amber:#633806;--amber-bg:#faeeda;--red:#791f1f;--red-bg:#fcebeb;--radius:12px;--nav-h:64px;--top-h:52px}
html,body{height:100%;overflow:hidden}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:var(--bg);color:var(--text);font-size:15px}
.topbar{position:fixed;top:0;left:0;right:0;height:var(--top-h);background:var(--text);color:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 16px;z-index:100}
.topbar-title{display:flex;align-items:center;gap:8px;font-weight:600;font-size:16px}
.main{position:fixed;top:var(--top-h);bottom:var(--nav-h);left:0;right:0;overflow-y:auto;-webkit-overflow-scrolling:touch}
.tab{display:none;padding:16px 16px 24px}
.tab.active{display:block}
.bottom-nav{position:fixed;bottom:0;left:0;right:0;height:var(--nav-h);background:var(--surface);border-top:.5px solid var(--border);display:flex;z-index:100;padding-bottom:env(safe-area-inset-bottom)}
.nav-btn{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;background:none;border:none;color:var(--text-muted);font-size:10px;font-family:inherit;cursor:pointer;padding:8px 0}
.nav-btn.active{color:var(--text)}
.nav-btn.active svg{stroke-width:2.5}
.page-header{margin-bottom:16px}
.page-header h1{font-size:20px;font-weight:600}
.stats-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:16px}
.stat-card{background:var(--surface);border-radius:var(--radius);padding:14px;box-shadow:0 1px 3px rgba(0,0,0,.06)}
.stat-label{font-size:11px;color:var(--text-muted);margin-bottom:4px;text-transform:uppercase;letter-spacing:.3px}
.stat-value{font-size:28px;font-weight:600;line-height:1}
.stat-value.green{color:var(--green)}
.stat-value.amber{color:var(--amber)}
.stat-value.red{color:var(--red)}
.search-bar{display:flex;gap:8px;margin-bottom:12px}
.search-bar input{flex:1}
.search-bar select{width:120px}
.card{background:var(--surface);border-radius:var(--radius);padding:16px;margin-bottom:12px;box-shadow:0 1px 3px rgba(0,0,0,.06)}
.card-title{font-size:13px;font-weight:600;margin-bottom:12px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.3px}
.form-group{display:flex;flex-direction:column;gap:6px}
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px}
label{font-size:13px;font-weight:500;color:var(--text-muted)}
input[type=text],input[type=number],input[type=date],input[type=search],input[type=email],input[type=password],select,textarea{width:100%;padding:12px 14px;border:1.5px solid var(--border);border-radius:10px;font-size:16px;font-family:inherit;background:var(--surface);color:var(--text);outline:none;appearance:none;-webkit-appearance:none}
select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6b66' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 14px center;padding-right:36px}
input:focus,select:focus,textarea:focus{border-color:var(--text)}
textarea{resize:vertical;min-height:80px;line-height:1.5}
.btn-primary{background:var(--text);color:#fff;border:none;padding:14px 20px;border-radius:10px;font-size:15px;font-weight:500;cursor:pointer;font-family:inherit;display:inline-flex;align-items:center;justify-content:center;gap:6px;text-decoration:none}
.btn-primary:active{opacity:.85}
.btn-secondary{background:var(--surface);color:var(--text);border:1.5px solid var(--border);padding:13px 20px;border-radius:10px;font-size:15px;font-weight:500;cursor:pointer;font-family:inherit;display:inline-flex;align-items:center;justify-content:center;gap:6px;text-decoration:none}
.btn-danger{background:var(--red-bg);color:var(--red);border:none;padding:10px 16px;border-radius:10px;font-size:14px;font-weight:500;cursor:pointer;font-family:inherit}
.btn-full{width:100%}
.fab{position:fixed;bottom:calc(var(--nav-h) + 16px);right:16px;width:52px;height:52px;border-radius:50%;background:var(--text);color:#fff;border:none;font-size:28px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px rgba(0,0,0,.25);z-index:50}
.alert{padding:12px 16px;border-radius:10px;font-size:14px}
.alert-success{background:var(--green-bg);color:var(--green)}
.alert-error{background:var(--red-bg);color:var(--red)}
#alert-global{margin-bottom:12px}
.badge{display:inline-flex;align-items:center;gap:4px;font-size:12px;padding:4px 10px;border-radius:99px;font-weight:600;white-space:nowrap}
.badge-ok{background:var(--green-bg);color:var(--green)}
.badge-warn{background:var(--amber-bg);color:var(--amber)}
.badge-fail{background:var(--red-bg);color:var(--red)}
.badge-none{background:#ebebea;color:var(--text-muted)}
.list-container{display:flex;flex-direction:column;gap:10px}
.leiter-card{background:var(--surface);border-radius:var(--radius);padding:14px 16px;box-shadow:0 1px 3px rgba(0,0,0,.06)}
.leiter-card-top{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;margin-bottom:8px}
.leiter-card-id{font-weight:600;font-size:16px}
.leiter-card-meta{font-size:13px;color:var(--text-muted);display:flex;flex-direction:column;gap:3px}
.leiter-card-actions{display:flex;gap:8px;margin-top:12px;flex-wrap:wrap}
.leiter-card-actions button{flex:1;padding:10px 8px;font-size:13px;min-width:60px}
.empty{text-align:center;padding:3rem 1rem;color:var(--text-muted);font-size:15px}
.check-list{display:flex;flex-direction:column;gap:8px}
.check-item{display:flex;align-items:center;gap:12px;padding:12px;background:var(--bg);border-radius:10px;cursor:pointer;font-size:14px;line-height:1.4}
.check-item input[type=checkbox]{width:20px;height:20px;flex-shrink:0;cursor:pointer;accent-color:var(--text)}
/* i.O. / n.i.O. Prüfpunkte */
.pruef-punkt{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px;background:var(--bg);border-radius:10px;font-size:14px;line-height:1.4;transition:background .15s}
.pruef-punkt.is-nio{background:var(--red-bg)}
.pruef-text{flex:1}
.io-toggle{display:flex;gap:0;flex-shrink:0;border-radius:8px;overflow:hidden;border:1.5px solid var(--border)}
.io-btn{padding:8px 12px;border:none;background:var(--surface);color:var(--text-muted);font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;min-width:52px}
.io-btn.io.active{background:var(--green);color:#fff}
.io-btn.nio.active{background:var(--red);color:#fff}
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:200;display:flex;align-items:flex-end}
.modal{background:var(--surface);border-radius:20px 20px 0 0;padding:20px 16px;width:100%;max-height:90vh;overflow-y:auto;padding-bottom:calc(20px + env(safe-area-inset-bottom))}
.modal-handle{width:36px;height:4px;background:var(--border);border-radius:2px;margin:0 auto 16px}
.modal-title{font-size:18px;font-weight:600;margin-bottom:16px}
.detail-row{display:flex;justify-content:space-between;padding:10px 0;border-bottom:.5px solid var(--border);font-size:14px}
.detail-row:last-child{border-bottom:none}
.detail-row span:first-child{color:var(--text-muted)}
.pruef-entry{padding:12px;background:var(--bg);border-radius:10px;margin-bottom:8px}
.pruef-entry-header{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:6px}
.history-card{background:var(--surface);border-radius:var(--radius);padding:14px 16px;box-shadow:0 1px 3px rgba(0,0,0,.06)}
.history-header{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:6px}
.history-meta{font-size:13px;color:var(--text-muted)}
/* Admin */
.tab-sub{display:flex;gap:4px;margin-bottom:16px;border-bottom:.5px solid var(--border);padding-bottom:0}
.sub-btn{padding:8px 16px;font-size:14px;cursor:pointer;border:none;background:none;color:var(--text-muted);border-bottom:2px solid transparent;margin-bottom:-1px;font-family:inherit}
.sub-btn.active{color:var(--text);border-bottom-color:var(--text);font-weight:500}
.firma-card,.benutzer-card{background:var(--surface);border-radius:var(--radius);padding:14px 16px;box-shadow:0 1px 3px rgba(0,0,0,.06);display:flex;justify-content:space-between;align-items:center;gap:8px}
.firma-card-info,.benutzer-card-info{flex:1;min-width:0}
.firma-name,.benutzer-name{font-weight:600;font-size:15px}
.firma-meta,.benutzer-meta{font-size:12px;color:var(--text-muted);margin-top:3px}
.rolle-badge{font-size:11px;padding:3px 8px;border-radius:99px;font-weight:600}
.rolle-admin{background:#e8e0f8;color:#4a1d96}
.rolle-pruefer{background:#dbeafe;color:#1e40af}
.rolle-betrachter{background:#f1f5f9;color:#475569}
/* QR Modal */
.qr-img{width:200px;height:200px;display:block;margin:0 auto 12px}
