:root{--bg:#0d1520;--panel:#172332;--panel2:#1d2c3d;--text:#edf5ff;--muted:#99aabd;--line:#2d4257;--green:#39d98a;--yellow:#ffcc66;--red:#ff6b6b;--blue:#58a6ff}*{box-sizing:border-box}body{margin:0;font-family:Arial,sans-serif;background:linear-gradient(180deg,#09111a,#111c28);color:var(--text);min-height:100vh}.topbar{position:sticky;top:0;z-index:10;background:rgba(13,21,32,.95);border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;padding:12px 24px;backdrop-filter:blur(8px)}.brand{display:flex;align-items:center;gap:12px;color:var(--text);text-decoration:none;font-weight:700}.brand img{width:48px;height:48px;border-radius:50%;object-fit:cover}.brand small{display:block;color:var(--muted);font-weight:400;margin-top:3px}.topbar nav{display:flex;gap:8px}.topbar nav a,.button{color:var(--text);text-decoration:none;padding:9px 13px;border:1px solid var(--line);border-radius:9px}.page{max-width:1440px;margin:auto;padding:24px}.headline{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:20px}.headline h1{margin:0 0 5px;font-size:30px}.headline p{margin:0;color:var(--muted)}.summary-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:14px;margin-bottom:22px}.summary,.panel,.camera-card{background:linear-gradient(145deg,var(--panel2),var(--panel));border:1px solid var(--line);border-radius:16px;box-shadow:0 12px 30px rgba(0,0,0,.18)}.summary{padding:18px}.summary b{font-size:23px;display:block}.summary span{color:var(--muted);font-size:13px}.camera-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(310px,1fr));gap:18px;margin-bottom:22px}.camera-card{padding:15px;color:var(--text);text-decoration:none}.camera-card img,.image-panel img{width:100%;aspect-ratio:16/9;object-fit:cover;border-radius:11px;background:#07101a}.card-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:12px}.card-head h2{font-size:17px;margin:0}.pill,.big-status{padding:7px 10px;border-radius:999px;font-size:12px;font-weight:700}.online,.maintenance{color:var(--green)}.pending{color:var(--yellow)}.offline{color:var(--red)}.pill.online,.pill.maintenance{background:rgba(57,217,138,.14)}.pill.pending{background:rgba(255,204,102,.15)}.pill.offline{background:rgba(255,107,107,.15)}.facts{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:12px}.facts span{font-size:12px;color:var(--muted)}.facts b{display:block;color:var(--text);margin-top:3px}.placeholder{display:grid;place-items:center;aspect-ratio:16/9;border:1px dashed var(--line);border-radius:11px;color:var(--muted)}.panel{padding:20px;margin-bottom:20px}.detail-grid{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(320px,.8fr);gap:20px}.status-list>div{display:flex;justify-content:space-between;gap:15px;padding:11px 0;border-bottom:1px solid var(--line)}.status-list span{color:var(--muted)}.actions{display:flex;flex-wrap:wrap;gap:9px;margin-top:18px}button,.button{background:#26394d;color:var(--text);border:1px solid #3c5671;padding:10px 14px;border-radius:9px;cursor:pointer}.primary,.success{background:#177a50;border-color:#2aaa72}.danger-button{background:#9f2d2d;border-color:#d15454}.form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:18px;margin:18px 0}.form-grid label{display:flex;flex-direction:column;gap:8px;color:var(--muted)}input,select{width:100%;padding:10px;background:#0f1b28;color:var(--text);border:1px solid var(--line);border-radius:8px}.check{flex-direction:row!important;align-items:center}.check input{width:auto}.danger{border-color:#763b3b}.pending{margin-top:18px;padding:14px;background:rgba(255,204,102,.08);border:1px solid #66562d;border-radius:10px}.pending code{display:block;white-space:pre-wrap;color:#f3dfad;margin:8px 0}.flash{padding:13px 16px;border-radius:10px;margin-bottom:16px}.flash.success{background:rgba(57,217,138,.13);border:1px solid #287d59}.flash.error{background:rgba(255,107,107,.13);border:1px solid #8c3b3b}.login-card{max-width:430px;margin:80px auto;background:var(--panel);border:1px solid var(--line);padding:25px;border-radius:16px}.login-card label{display:flex;flex-direction:column;gap:7px;margin:14px 0}.events>div{display:grid;grid-template-columns:170px 70px 1fr;gap:12px;padding:9px 0;border-bottom:1px solid var(--line)}.events time{color:var(--muted)}@media(max-width:800px){.detail-grid{grid-template-columns:1fr}.topbar{align-items:flex-start}.facts{grid-template-columns:1fr}.events>div{grid-template-columns:1fr}.headline{align-items:flex-start;flex-direction:column}}

/* V3.0.1: nur aktive Kameras und große, unbeschnittene Bilder */
.gallery-headline{max-width:1220px;margin-left:auto;margin-right:auto}
.active-counter{display:inline-flex;align-items:center;padding:10px 15px;border-radius:999px;background:rgba(57,217,138,.14);color:var(--green);font-weight:700;border:1px solid rgba(57,217,138,.28)}
.gallery-grid{display:grid;grid-template-columns:1fr;gap:28px;max-width:1220px;margin:0 auto 28px}
.gallery-card{background:linear-gradient(145deg,var(--panel2),var(--panel));border:1px solid var(--line);border-radius:18px;box-shadow:0 16px 40px rgba(0,0,0,.24);padding:18px;overflow:hidden}
.gallery-card-head{margin-bottom:14px}
.gallery-card-head h2{font-size:21px}
.gallery-image-link{display:block;border-radius:13px;overflow:hidden;background:#07101a;text-decoration:none}
.gallery-card img{display:block;width:100%;height:auto;max-height:none;object-fit:contain;border-radius:13px;background:#07101a}
.gallery-footer{display:flex;justify-content:space-between;gap:20px;align-items:center;padding:14px 2px 2px;color:var(--muted)}
.gallery-footer b{color:var(--text)}
.gallery-hint{font-size:13px}
.empty-gallery{max-width:900px;margin:40px auto;text-align:center;padding:45px 25px}
.empty-gallery p{color:var(--muted)}
.dashboard-camera-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(500px,1fr));gap:22px;margin-bottom:22px}
.dashboard-camera-card img{width:100%;height:auto;aspect-ratio:auto;object-fit:contain;background:#07101a;border-radius:11px}
@media(max-width:800px){.active-counter{align-self:flex-start}.gallery-card{padding:12px}.gallery-card-head h2{font-size:17px}.gallery-footer{align-items:flex-start;flex-direction:column;gap:6px}.dashboard-camera-grid{grid-template-columns:1fr}}

/* V3.0.3: öffentliche Livebilder, geschütztes Dashboard, etwas kleinere Bilder */
.gallery-grid{
  grid-template-columns:repeat(auto-fit,minmax(420px,1fr));
  max-width:1180px;
  gap:22px;
  justify-items:center;
}
.gallery-card{
  width:100%;
  max-width:860px;
  padding:15px;
}
.gallery-card img{
  width:100%;
  height:auto;
  max-height:520px;
  object-fit:contain;
}
.gallery-card-head h2{font-size:19px}
.gallery-footer{font-size:14px}
@media(max-width:700px){
  .gallery-grid{grid-template-columns:1fr;gap:16px}
  .gallery-card{max-width:100%;padding:10px}
  .gallery-card img{max-height:none}
  .topbar{padding:10px 12px}
  .topbar nav{flex-wrap:wrap;justify-content:flex-end}
}

/* V3.0.4: finales Live-Layout mit automatischer Kartengroesse */
body{
  background:linear-gradient(180deg,#172635 0%,#203447 52%,#182a3a 100%);
}
.page{max-width:1500px}
.gallery-headline{max-width:1320px}
.gallery-grid{
  max-width:1320px;
  width:100%;
  align-items:start;
  justify-content:center;
}
.gallery-card{
  max-width:none;
  background:linear-gradient(145deg,#263b50,#1f3245);
  box-shadow:0 16px 36px rgba(0,0,0,.20);
}
.gallery-image-link{
  width:100%;
  aspect-ratio:4/3;
  background:#142331;
}
.gallery-card img{
  width:100%;
  height:100%;
  max-height:none;
  aspect-ratio:4/3;
  object-fit:cover;
  object-position:center;
  background:#142331;
}
.gallery-grid.cameras-1{
  grid-template-columns:minmax(0,1000px);
}
.gallery-grid.cameras-2,
.gallery-grid.cameras-3,
.gallery-grid.cameras-4{
  grid-template-columns:repeat(2,minmax(0,1fr));
}
.gallery-grid.cameras-3 .gallery-card:last-child{
  grid-column:1 / -1;
  width:calc(50% - 11px);
  justify-self:center;
}
@media(max-width:900px){
  .gallery-grid.cameras-1,
  .gallery-grid.cameras-2,
  .gallery-grid.cameras-3,
  .gallery-grid.cameras-4{
    grid-template-columns:1fr;
  }
  .gallery-grid.cameras-3 .gallery-card:last-child{
    grid-column:auto;
    width:100%;
  }
}

/* V3.0.5: Livebild etwas kleiner und vollstaendig sichtbar */
.gallery-grid.cameras-1{
  grid-template-columns:minmax(0,900px);
}
.gallery-grid.cameras-1 .gallery-card{
  width:100%;
  max-width:900px;
  justify-self:center;
}
.gallery-grid.cameras-1 .gallery-image-link{
  aspect-ratio:auto;
  display:flex;
  justify-content:center;
  align-items:center;
  background:#142331;
}
.gallery-grid.cameras-1 .gallery-card img{
  width:auto;
  max-width:100%;
  height:auto;
  max-height:480px;
  aspect-ratio:auto;
  object-fit:contain;
}
@media(max-width:900px){
  .gallery-grid.cameras-1 .gallery-card{
    max-width:100%;
  }
  .gallery-grid.cameras-1 .gallery-card img{
    width:100%;
    max-height:none;
  }
}
/* Kamerabilder im Dashboard und auf der Detailseite begrenzen */

.dashboard-camera-card img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

.image-panel img {
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: 12px;
}
