/* =========================================================
   BASICS
   ========================================================= */
:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, sans-serif;
  min-height: 100vh;
}

/* =========================================================
   LOGIN / NICHT EINGELOGGT (HINTERGRUND + LOGIN LINKS UNTEN)
   ========================================================= */

.bg {
  /* Hintergrundbild */
  background-image: url("/static/bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,.60), rgba(0,0,0,.20));
  z-index: 0;
}

.shell {
  position: relative;
  min-height: 100vh;
  padding: clamp(16px, 3vw, 32px);
  z-index: 1;
}

.login-card {
  position: absolute;
  left: clamp(16px, 3vw, 36px);
  bottom: clamp(16px, 3vw, 36px);

  width: min(420px, calc(100vw - 2 * clamp(16px, 3vw, 36px)));
  background: rgba(12, 14, 18, 0.74);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 18px 18px 14px;
  box-shadow: 0 18px 55px rgba(0,0,0,.45);
  backdrop-filter: blur(10px);
  color: #fff;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(120,170,255,.9);
  box-shadow: 0 0 20px rgba(120,170,255,.35);
}

.title { font-weight: 800; font-size: 18px; }
.subtitle { opacity: .75; font-size: 13px; margin-top: 1px; }

.login-card label { display: grid; gap: 6px; margin: 12px 0; font-size: 13px; }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  color: #fff;
  outline: none;
}
.login-card input:focus { border-color: rgba(120,170,255,0.75); }

.login-card button {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 0;
  background: rgba(120,170,255,0.92);
  color: #0b1020;
  font-weight: 800;
  cursor: pointer;
}

.error {
  margin: 6px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,70,70,0.18);
  border: 1px solid rgba(255,70,70,0.30);
}

.footnote {
  margin-top: 10px;
  font-size: 12px;
  opacity: .65;
}

/* Mobile: Login bleibt unten, aber mit Rand */
@media (max-width: 520px) {
  .login-card { left: 16px; right: 16px; width: auto; }
}

/* =========================================================
   APP / EINGELOGGT (DASHBOARD-LOOK, SIDEBAR LINKS)
   ========================================================= */

.app {
  background: #2f343a;
  color: #e9eef5;
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 270px;
  background: #2a2f35;
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brandrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brandicon { font-size: 18px; }
.brandname { font-weight: 800; font-size: 14px; }
.brandsub { font-size: 12px; opacity: .7; margin-top: 2px; }

.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.userdot {
  width: 10px; height: 10px; border-radius: 999px;
  background: rgba(120,170,255,.95);
  box-shadow: 0 0 16px rgba(120,170,255,.35);
}
.username { font-weight: 700; font-size: 13px; }
.userrole { font-size: 12px; opacity: .7; margin-top: 2px; }

.nav { padding: 10px 8px; overflow: auto; }

.navgroup {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .6;
  margin: 12px 10px 6px;
}

.navitem, .navsub {
  display: block;
  padding: 9px 10px;
  margin: 4px 6px;
  border-radius: 10px;
  color: #e9eef5;
  text-decoration: none;
  opacity: .9;
}

.navitem:hover, .navsub:hover { background: rgba(255,255,255,0.06); }
.navitem.active, .navsub.active {
  background: rgba(120,170,255,.16);
  border: 1px solid rgba(120,170,255,.25);
}

.navdetails { margin: 4px 6px; border-radius: 10px; }
.navsummary {
  list-style: none;
  cursor: pointer;
  padding: 9px 10px;
  border-radius: 10px;
  opacity: .9;
}
.navsummary:hover { background: rgba(255,255,255,0.06); }
.navdetails[open] .navsummary { background: rgba(255,255,255,0.04); }

.logoutform { margin: 14px 6px 10px; }
.logoutbtn {
  width: 100%;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.logoutbtn:hover { background: rgba(255,255,255,0.10); }

.sidebarfoot {
  margin-top: auto;
  padding: 12px 14px;
  font-size: 12px;
  opacity: .6;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: #2f343a;
}

.pagetitle { font-weight: 800; font-size: 16px; }
.pagesub { font-size: 12px; opacity: .7; margin-top: 2px; }

.idletimer {
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
}

.content { padding: 16px; }

.kpirow {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.kpi {
  border-radius: 8px;
  padding: 14px;
  border: 1px solid rgba(0,0,0,0.15);
  box-shadow: 0 10px 28px rgba(0,0,0,0.25);
  min-height: 72px;
}
.kpi-num { font-size: 26px; font-weight: 900; }
.kpi-label { margin-top: 8px; font-weight: 700; opacity: .95; }

.kpi-blue { background: #169cb0; }
.kpi-green { background: #23a046; }
.kpi-yellow { background: #f2b705; color: #1b1b1b; }
.kpi-red { background: #d63b44; }

.grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.card {
  background: #3a4047;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 12px;
  min-height: 160px;
  color: #e9eef5;
}

.cardtitle {
  font-weight: 800;
  font-size: 13px;
  opacity: .95;
  margin-bottom: 10px;
}

.placeholder {
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 16px;
  opacity: .75;
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
}

.listrows .row {
  display: flex;
  justify-content: space-between;
  padding: 10px 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.listrows .row:first-child { border-top: 0; }

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(120,170,255,.2);
  border: 1px solid rgba(120,170,255,.25);
  font-weight: 800;
}

.table {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  overflow: hidden;
}
.trow {
  display: grid;
  grid-template-columns: 1.2fr .8fr 1fr 1fr;
  gap: 10px;
  padding: 10px 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.thead {
  background: rgba(0,0,0,0.18);
  font-weight: 800;
  border-top: 0;
}

@media (max-width: 1100px) {
  .kpirow { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .sidebar { width: 220px; }
}

@media (max-width: 680px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
}
