:root{
  --bg:#10140E;--side:#141912;--panel:#161B13;--card:#181E15;--card2:#1D2419;--sel:#232C1E;
  --line:#263021;--line2:#2C3626;--text:#E9EDE2;--muted:#A3AD96;--soft:#C5CDB9;
  --accent:#D4A64A;--accent2:#E8C27A;--moss:#8DB36A;--night:#9FB6D8;--day:#C9DDB0;--warn:#E08A6E;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--text);font:15px/1.45 Inter,system-ui,sans-serif}
a{color:var(--accent)}a:hover{color:var(--accent2)}
button{font:inherit;color:inherit}
h1,h2,h3{font-family:"Space Grotesk",sans-serif;margin:0}
svg{flex:none}
.shell{display:flex;flex-wrap:wrap;min-height:100vh}
.side{flex:1 1 220px;max-width:250px;padding:26px 16px;background:var(--side);border-right:1px solid var(--line);display:flex;flex-direction:column;gap:26px;position:sticky;top:0;height:100vh}
.brand{display:flex;align-items:center;gap:10px;padding:0 8px;font-family:"Space Grotesk",sans-serif;font-size:19px;font-weight:700}
.navlinks{display:flex;flex-direction:column;gap:4px}
.navlinks a{display:flex;align-items:center;gap:12px;padding:11px 12px;border-radius:10px;color:var(--soft);text-decoration:none}
.navlinks a svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.navlinks a.on{background:var(--sel);color:#F2E3BF;font-weight:600}
.runbox{margin-top:auto;padding:14px;border-radius:12px;background:#1B2218;border:1px solid var(--line);font-size:13px;display:flex;flex-direction:column;gap:6px}
.runbox .dot{width:8px;height:8px;border-radius:50%;background:var(--moss);display:inline-block}
.runbox .dot.busy{background:var(--accent);animation:pulse 1.2s infinite}
@keyframes pulse{50%{opacity:.35}}
.view{flex:999 1 560px;min-width:0;padding:30px 38px 70px;display:flex;flex-direction:column;gap:22px}
.head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:14px}
.head h1{font-size:33px;font-weight:700;letter-spacing:-.3px}
.sub{color:var(--muted)}
.btn{height:42px;padding:0 16px;border-radius:10px;border:1px solid var(--line2);background:var(--card);color:var(--text);display:inline-flex;align-items:center;gap:8px;cursor:pointer;text-decoration:none;font-size:14px}
.btn:hover{border-color:#4A5641;color:var(--text)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#1C1606;font-weight:600}
.btn.primary:hover{background:var(--accent2)}
.btn:disabled{opacity:.5;cursor:default}
.btn svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.panel{padding:18px;border-radius:14px;background:var(--panel);border:1px solid var(--line)}
.filters{display:flex;flex-direction:column;gap:12px}
.fbox>summary{list-style:none;display:none;width:max-content}
.fbox>summary::-webkit-details-marker{display:none}
.frow{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.flabel{color:var(--muted);font-size:13px;width:76px}
.sel{height:38px;padding:0 12px;border-radius:9px;border:1px solid var(--line2);background:var(--card2);color:var(--text);font-size:14px}
.seg{display:flex;flex-wrap:wrap;gap:4px;padding:4px;border-radius:11px;background:var(--bg);border:1px solid var(--line)}
.seg button{height:34px;padding:0 13px;border-radius:8px;border:none;background:transparent;color:var(--soft);font-size:14px;cursor:pointer}
.seg button.on{background:var(--accent);color:#1C1606;font-weight:600}
.chips{display:flex;flex-wrap:wrap;gap:8px;flex:1;min-width:0}
.chip{height:36px;padding:0 10px 0 8px;border-radius:9px;font-size:13.5px;cursor:pointer;display:inline-flex;align-items:center;gap:8px;border:1px solid #3F4B36;background:#222B1D;color:var(--text)}
.chip.off{border:1px dashed var(--line2);background:transparent;color:#8A9480}
.chip .box{width:16px;height:16px;border-radius:4px;display:flex;align-items:center;justify-content:center;background:var(--accent)}
.chip.off .box{background:transparent;border:1.5px solid #4A5641}
.chip .box svg{width:11px;height:11px;fill:none;stroke:#1C1606;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round}
.chip.off .box svg{display:none}
.linkbtn{height:34px;padding:0 8px;border:none;background:transparent;color:var(--accent);font-size:13px;cursor:pointer}
.tag{padding:1px 6px;border-radius:5px;font-size:10.5px;font-weight:600;letter-spacing:.3px;border:1px solid #3A4533;color:var(--muted);white-space:nowrap}
.tag.doerr{border-color:var(--accent);color:var(--accent2)}
.day{display:flex;flex-direction:column;gap:14px}
.dayhead{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:8px 20px;padding-bottom:10px;border-bottom:1px solid #222A1D}
.dayhead h2{font-size:20px;font-weight:600}
.dayhead h2 small{color:var(--muted);font-weight:500;font-size:15px;margin-left:8px}
.ctx{display:flex;flex-wrap:wrap;gap:16px;color:var(--muted);font-size:13px}
.ctx span{display:inline-flex;align-items:center;gap:6px}
.ctx svg{width:15px;height:15px;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:16px}
.card{display:flex;flex-direction:column;border-radius:12px;overflow:hidden;background:var(--card);border:1px solid var(--line);color:var(--text);text-decoration:none;cursor:pointer;transition:border-color .12s,transform .12s}
.card:hover{border-color:var(--accent);transform:translateY(-2px);color:var(--text)}
.thumb{position:relative;aspect-ratio:16/9;background:#0B0E09;overflow:hidden}
.thumb img,.thumb video{width:100%;height:100%;object-fit:cover;display:block;pointer-events:none}
.rot{transform:rotate(180deg)}
.badge{position:absolute;padding:3px 8px;border-radius:6px;background:rgba(10,13,8,.8);font-size:12px;font-weight:600}
.badge.ph{left:8px;top:8px}.badge.len{right:8px;bottom:8px;font-weight:500}
.nov{position:absolute;inset:0;display:none;align-items:center;justify-content:center;color:var(--muted);font-size:12px;text-align:center;padding:10px}
.meta{display:flex;flex-direction:column;gap:6px;padding:11px 13px 13px}
.meta .r1{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
.meta .t{font-family:"Space Grotesk",sans-serif;font-size:19px;font-weight:600}
.meta .cam{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:13px;text-align:right}
.meta .w{color:var(--muted);font-size:12.5px}
.ph-Nacht{color:var(--night)}.ph-Tag{color:var(--day)}.ph-Morgendämmerung,.ph-Abenddämmerung{color:var(--accent2)}
.empty{color:var(--muted);text-align:center;padding:60px 20px}
.more{align-self:center}
/* Lightbox */
.lb{position:fixed;inset:0;background:#070906;display:none;z-index:2000;flex-direction:column}
.lb.open{display:flex}
.lb .bar{display:flex;align-items:center;gap:10px;padding:12px 16px;flex-wrap:wrap}
.lb .bar .title{flex:1;min-width:200px;font-weight:600}
.lb .bar .title small{color:var(--muted);font-weight:400;margin-left:8px}
.lb .stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;position:relative}
.lb .stage video,.lb .stage img{max-width:100%;max-height:100%}
.lb .nav{position:absolute;top:50%;transform:translateY(-50%);width:48px;height:64px;border:none;border-radius:8px;background:rgba(0,0,0,.45);color:#fff;font-size:28px;cursor:pointer}
.lb .prev{left:10px}.lb .next{right:10px}
.lb .err{color:var(--muted);text-align:center;max-width:480px;padding:20px;display:none}
.lb .info{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;padding:12px 16px 18px}
.ibox{padding:11px 12px;border-radius:12px;background:var(--card);border:1px solid var(--line);display:flex;flex-direction:column;gap:3px}
.ibox .k{color:var(--muted);font-size:12px}.ibox .v{font-weight:600}.ibox .s{color:var(--muted);font-size:12px}
/* Statistik */
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:14px}
.kpi{padding:18px;border-radius:14px;background:var(--card);border:1px solid var(--line);display:flex;flex-direction:column;gap:6px}
.kpi .k{color:var(--muted);font-size:13px}.kpi .v{font-family:"Space Grotesk",sans-serif;font-size:30px;font-weight:700}.kpi .s{color:var(--muted);font-size:13px}
.kpi .s.up{color:#A9CB8A}
.insight{display:flex;gap:14px;align-items:flex-start;padding:16px 18px;border-radius:14px;background:#1E2416;border:1px solid #3A3A22;line-height:1.5}
.insight svg{width:22px;height:22px;fill:none;stroke:var(--accent);stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;margin-top:1px}
.sec{display:flex;flex-direction:column;gap:14px}
.sec h2{font-size:19px;font-weight:600}
.two{display:grid;grid-template-columns:repeat(auto-fit,minmax(360px,1fr));gap:14px}
.hm{overflow-x:auto}
.hm .rows{min-width:720px;display:flex;flex-direction:column;gap:3px}
.hm .row{display:grid;grid-template-columns:34px repeat(24,minmax(0,1fr));gap:3px;align-items:center}
.hm .cell{height:26px;border-radius:4px}
.hm .band{height:8px;border-radius:2px}
.hm .lab{color:var(--muted);font-size:12px}
.hm .hl{color:var(--muted);font-size:11px;text-align:center}
.legend{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;color:var(--muted);font-size:12.5px}
.legend i{display:inline-block;width:16px;height:10px;border-radius:2px;margin-right:5px;vertical-align:middle}
.bars{display:grid;gap:8px;align-items:end}
.vbar{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:5px;height:100%}
.vbar span.b{width:100%;border-radius:5px 5px 2px 2px;background:#7E97BC;min-height:2px}
.vbar span.v{font-size:12px;color:var(--soft)}
.hbar{display:grid;grid-template-columns:120px 1fr 40px;gap:10px;align-items:center;font-size:13.5px}
.hbar .track{height:12px;border-radius:6px;background:#1F271B;overflow:hidden}
.hbar .fill{height:100%;border-radius:6px;background:var(--accent)}
.hbar .n{text-align:right;color:var(--soft)}
.trend{display:grid;gap:3px;align-items:end;height:140px}
.trend span{border-radius:3px 3px 1px 1px;background:#5E7746;min-height:2px}
.minis{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.mini{padding:12px;border-radius:10px;background:#1B2218;display:flex;flex-direction:column;gap:3px}
.mini .k{color:var(--muted);font-size:12.5px}.mini .v{font-family:"Space Grotesk",sans-serif;font-size:22px;font-weight:600}.mini .s{color:var(--muted);font-size:12px}
.map{height:420px;border-radius:12px;overflow:hidden;border:1px solid var(--line);background:#0B0E09}
.leaflet-container{font:inherit}
.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#1B2218;color:var(--text)}
.leaflet-popup-content a{color:var(--accent)}
/* Kameras */
.cams{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:16px}
.camcard{border-radius:14px;overflow:hidden;background:var(--card);border:1px solid var(--line);display:flex;flex-direction:column;color:var(--text);text-decoration:none}
.camcard:hover{border-color:var(--accent);color:var(--text)}
.camcard .thumb{aspect-ratio:16/8}
.status{position:absolute;left:10px;top:10px;display:flex;align-items:center;gap:7px;padding:4px 10px;border-radius:999px;background:rgba(10,13,8,.85);font-size:12.5px;font-weight:600}
.status i{width:8px;height:8px;border-radius:50%}
.camcard .body{padding:14px 16px 16px;display:flex;flex-direction:column;gap:10px}
.camcard .r1{display:flex;justify-content:space-between;align-items:center;gap:10px}
.camcard h2{font-size:19px;font-weight:600;display:flex;align-items:center;gap:8px}
.stats3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.stats3 div{padding:10px;border-radius:10px;background:var(--card2);display:flex;flex-direction:column;gap:3px}
.stats3 .k{color:var(--muted);font-size:12px}.stats3 .v{font-weight:600}
.loc{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:13px}
.loc.missing{color:var(--accent2)}
.toggles{display:flex;gap:16px;flex-wrap:wrap;font-size:14px;color:var(--soft)}
.toggles label{display:flex;align-items:center;gap:7px;cursor:pointer}
.toggles input{accent-color:var(--accent);width:17px;height:17px}
.field{display:flex;flex-direction:column;gap:6px}
.field label{color:var(--muted);font-size:13px}
.input{height:42px;padding:0 12px;border-radius:10px;border:1px solid var(--line2);background:var(--card2);color:var(--text);font-size:15px}
.placelist{display:flex;flex-direction:column;gap:8px}
.placeitem{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;background:var(--card2);font-size:14px}
.placeitem .s{color:var(--muted);font-size:12.5px}
.note{color:var(--muted);font-size:13px}
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);background:#2A3324;border:1px solid #3F4B36;padding:10px 16px;border-radius:10px;z-index:3000;font-size:14px}
@media (max-width:760px){
  .side{position:fixed;bottom:0;left:0;right:0;top:auto;height:auto;max-width:none;flex-direction:row;padding:6px 6px calc(6px + env(safe-area-inset-bottom));z-index:1000;border-right:none;border-top:1px solid var(--line)}
  .brand,.runbox{display:none}
  .navlinks{flex-direction:row;width:100%;justify-content:space-around}
  .navlinks a{flex-direction:column;gap:3px;font-size:11px;padding:6px 8px}
  .navlinks a.on{background:transparent;color:var(--accent)}
  .view{padding:18px 14px 96px;gap:16px}
  .head h1{font-size:27px}
  .grid{grid-template-columns:1fr 1fr;gap:10px}
  .meta{padding:8px 9px 10px}.meta .t{font-size:16px}.meta .w{display:none}
  .meta .r1{flex-direction:column;align-items:flex-start;gap:2px}.meta .cam{text-align:left}
  .flabel{display:none}
  .fbox>summary{display:inline-flex;margin-bottom:10px}
  .head .btn{height:40px}
  .two{grid-template-columns:1fr}
  .hbar{grid-template-columns:90px 1fr 34px}
  .map{height:320px}
}
/* Tiererkennung */
.chip.sp{padding:0 10px}
.chip.sp .cnt{font-size:11.5px;color:var(--muted);font-variant-numeric:tabular-nums}
.chip.sp.on{background:var(--accent);border-color:var(--accent);color:#1C1606;font-weight:600}
.chip.sp.on .cnt{color:#3A2E0C}
.chip.sp.dim:not(.on){color:#8A9480}
.badge.sp{right:8px;top:8px;background:rgba(212,166,74,.92);color:#1C1606}
.badge.sp.dim{background:rgba(10,13,8,.8);color:var(--soft);font-weight:500}
.switch{display:inline-flex;align-items:center;gap:8px;cursor:pointer;font-size:13.5px;color:var(--soft);height:36px;padding-right:6px}
.switch input{position:absolute;opacity:0;width:1px;height:1px}
.switch .sl{width:36px;height:20px;border-radius:10px;background:#3A4533;position:relative;transition:background .15s;flex:none}
.switch .sl::after{content:"";position:absolute;left:2px;top:2px;width:16px;height:16px;border-radius:50%;background:#C9CFBF;transition:transform .15s}
.switch input:checked+.sl{background:var(--accent)}
.switch input:checked+.sl::after{transform:translateX(16px);background:#1C1606}
.switch input:focus-visible+.sl{outline:2px solid var(--accent2);outline-offset:2px}
.switch.big{font-size:15px;color:var(--text);font-weight:600}
.spbox select{margin-top:6px;height:32px;font-size:13px}
.prog{height:8px;border-radius:4px;background:var(--bg);border:1px solid var(--line);overflow:hidden}
.prog span{display:block;height:100%;background:var(--accent);transition:width .4s}
.mono{font-family:ui-monospace,Consolas,monospace;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.h3{font-size:15px;margin:14px 0 2px;font-weight:600}
.spgroups{display:flex;flex-direction:column;gap:12px}
.spgroup .gname{font-size:12.5px;color:var(--muted);text-transform:uppercase;letter-spacing:.4px;display:flex;align-items:center;gap:6px;margin-bottom:6px}
.spgroup .gname .linkbtn{height:24px;text-transform:none;letter-spacing:0}
button.hbar{width:100%;background:none;border:none;color:inherit;font:inherit;cursor:pointer;padding:2px 4px;border-radius:6px;text-align:left}
button.hbar:hover{background:rgba(255,255,255,.03)}
button.hbar.on{outline:1px solid var(--accent)}
.chip.hide-empty .cnt{font-size:11.5px;color:var(--muted);font-variant-numeric:tabular-nums}
.chip.hide-empty:not(.off) .cnt{color:var(--soft)}
.vsep{width:1px;align-self:stretch;margin:4px 2px;background:var(--line2,#3A4533)}
/* Zeitraum-Abruf */
.syncbox{display:flex;flex-direction:column;gap:10px;padding:14px;border:1px solid var(--line);border-radius:12px;background:var(--bg)}
.syncbox .r1{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}
.syncbox .mini .v small{font-size:13px;color:var(--muted);font-weight:500}
.syncform{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap}
.syncform .field{min-width:160px}
.syncform .quick{display:flex;gap:2px;padding-bottom:4px}
/* Live-View */
.liveov{position:fixed;inset:0;background:rgba(5,7,4,.86);z-index:5000;display:flex;align-items:center;justify-content:center;padding:16px}
.livebox{width:min(1100px,100%);background:var(--panel);border:1px solid var(--line);border-radius:16px;overflow:hidden;display:flex;flex-direction:column}
.livehead,.livefoot{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:12px 14px;flex-wrap:wrap}
.livevid{position:relative;background:#000;aspect-ratio:16/9}
.livevid video{width:100%;height:100%;display:block;background:#000}
.livemsg{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;text-align:center;padding:24px;color:var(--text);background:rgba(0,0,0,.55)}
.livemsg.err{color:#E9A38B}
.livemsg.err .spin{display:none}
.livebadge{font-size:12px;font-weight:600;padding:2px 8px;border-radius:999px;background:#3A4533;color:var(--soft);margin-left:6px}
.livebadge.on{background:#B23A2E;color:#fff}
.iconbtn{background:none;border:none;color:var(--soft);cursor:pointer;padding:6px;border-radius:8px;display:inline-flex}
.iconbtn:hover{background:rgba(255,255,255,.06)}
.spin{width:34px;height:34px;border-radius:50%;border:3px solid rgba(255,255,255,.15);border-top-color:var(--accent);animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
#camLive{display:inline-flex;align-items:center;align-self:flex-end}
/* Anmeldung & Benutzer */
body.loggedout .side{display:none}
body.loggedout .shell{grid-template-columns:1fr}
.loginwrap{min-height:80vh;display:flex;align-items:center;justify-content:center;padding:20px}
.loginbox{width:min(400px,100%);padding:26px;display:flex;flex-direction:column;gap:14px}
.userlist{display:flex;flex-direction:column;gap:8px}
.useritem{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--bg)}
.userline a{color:var(--accent2,#D4A64A)}
.btn.danger{background:#5A2219;border-color:#7A2E22;color:#F3D2C8}
.btn.danger:hover{background:#6E2A1F}
.btn[disabled]{opacity:.5;cursor:not-allowed}
/* Auswahl im Archiv */
.selecting .card{position:relative}
.selecting .card::after{content:"";position:absolute;top:8px;left:8px;width:22px;height:22px;border-radius:6px;border:2px solid #fff;background:rgba(0,0,0,.35);box-shadow:0 1px 4px rgba(0,0,0,.4)}
.selecting .card.picked{outline:2px solid var(--accent);outline-offset:-2px}
.selecting .card.picked::after{background:var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231C1606' stroke-width='3'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center/16px no-repeat;border-color:var(--accent)}
.selbar{position:fixed;left:50%;transform:translateX(-50%);bottom:18px;z-index:70;display:flex;align-items:center;gap:16px;flex-wrap:wrap;background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:10px 14px;box-shadow:0 8px 30px rgba(0,0,0,.5);max-width:calc(100% - 24px)}
