:root {
  --bg:        #e8e9eb;   /* neutrales Hellgrau um den Rahmen */
  --frame:     #ffffff;   /* Inhaltsfläche */
  --ink:       #14161a;   /* Fast-Schwarz (Haupt-Textfarbe) */
  --ink-soft:  #6f747c;   /* gedämpftes Grau */
  --line:      #ececee;
  --sidebar:   #121317;   /* fast-schwarze Leiste */
  --sidebar-2: #202228;   /* Hover in der Leiste */
  --sidebar-tx:#9a9ea7;   /* gedämpfter Leisten-Text */
  --brand-tile:#f0e9d6;   /* warme Creme-Kachel fürs Logo (wie Referenz) */
  --dark:      #14161a;   /* Buttons / aktive Elemente = schwarz */
  --dark-2:    #2b2e35;

  --ok:        #1f9d64;
  --ok-bg:     #e8f6ee;
  --err:       #c0392b;
  --err-bg:    #fbeceb;

  /* Pastell-Kacheln (Dashboard) – ohne Blau */
  --tile-lav:   #ece9fb;
  --tile-mint:  #e3f3ea;
  --tile-cream: #f6efda;
  --tile-grey:  #eef0f2;

  --radius:      16px;
  --radius-lg:   22px;
  --radius-pill: 999px;
  --shadow:      0 10px 34px rgba(15,18,25,.10);
  --shadow-sm:   0 3px 14px rgba(15,18,25,.06);
  --font:        system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

/* ---------- Schwebender Rahmen ---------- */
.shell {
  display: flex;
  min-height: 100vh;
  background: var(--frame);
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-tx);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  color: #fff; text-decoration: none;
  font-size: 16px; font-weight: 650;
  padding: 6px 6px 20px;
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--brand-tile); color: var(--ink); font-size: 19px;
  flex-shrink: 0;
}
.brand-mark.has-logo { background: #fff; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-label {
  font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  color: #6b6f78; margin: 20px 12px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  color: var(--sidebar-tx); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: var(--sidebar-2); color: #fff; }
.nav-item.active { background: #fff; color: var(--ink); font-weight: 600; }
.nav-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; font-size: 16px; opacity: .95;
}

/* Fuß der Sidebar: User oben, Abmelden darunter */
.sidebar-foot {
  border-top: 1px solid #24262c;
  margin-top: 12px; padding-top: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; min-width: 0;
}
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden;
  background: var(--dark-2); color: #fff; font-weight: 650; font-size: 14px;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-name {
  color: #e6e8ec; font-size: 14px; font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.logout-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  color: var(--sidebar-tx); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.logout-item:hover { background: var(--sidebar-2); color: #fff; }

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

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 26px 34px 10px;
}
.topbar h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }

.content { padding: 18px 34px 36px; max-width: 900px; }

.lead { font-size: 15px; color: var(--ink-soft); margin-top: 0; }
.hint { font-size: 13px; color: var(--ink-soft); margin-top: 20px; }

/* ---------- Kacheln (Dashboard) ---------- */
.cards { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.card {
  display: flex; flex-direction: column; gap: 16px;
  width: 190px; padding: 22px;
  background: var(--tile-grey);
  border-radius: 20px; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, box-shadow .14s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card:nth-child(4n+1) { background: var(--tile-lav); }
.card:nth-child(4n+2) { background: var(--tile-mint); }
.card:nth-child(4n+3) { background: var(--tile-cream); }
.card:nth-child(4n+4) { background: var(--tile-grey); }
.card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 13px;
  background: rgba(255,255,255,.75); font-size: 22px;
}
.card-title { font-weight: 650; font-size: 15px; }

/* ---------- Panel & Forms ---------- */
.panel {
  background: var(--frame); border: 1px solid var(--line);
  border-radius: 20px; padding: 26px; max-width: 480px;
  box-shadow: var(--shadow-sm);
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 550; }
input[type=text], input[type=password] {
  font: inherit; padding: 11px 14px;
  border: 1px solid #e2e4e8; border-radius: 12px; background: #f7f8f9;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
input:focus {
  outline: none; border-color: var(--ink); background: #fff;
  box-shadow: 0 0 0 3px rgba(20,22,26,.12);
}

.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 11px 20px; border-radius: var(--radius-pill);
  border: 1px solid #e2e4e8; background: #fff; color: var(--ink);
  text-decoration: none; display: inline-block;
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.primary:hover { background: var(--dark-2); border-color: var(--dark-2); }
.btn.ghost { background: transparent; }
.btn-block { width: 100%; text-align: center; }

/* ---------- Alerts ---------- */
.alert { padding: 13px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 16px; }
.alert.success { background: var(--ok-bg); color: #14603e; border: 1px solid #bfe6cf; }
.alert.error   { background: var(--err-bg); color: #8f2318; border: 1px solid #f3c6c1; }
.alert.info    { background: #f2f3f5; color: #3a3f47; border: 1px solid #e2e4e8; }

.preview-line { display: flex; justify-content: space-between; padding: 4px 0; }
.preview-label { color: var(--ink-soft); }
code { background: #f0f1f3; padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* ---------- Login ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
  background: radial-gradient(120% 120% at 50% 0%, #23262d 0%, #121317 60%);
}
.login-card {
  background: var(--frame); padding: 36px; border-radius: 22px;
  width: 340px; box-shadow: 0 28px 70px rgba(0,0,0,.45);
}
.login-brand {
  font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 11px;
}
.login-brand .brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--brand-tile); color: var(--ink); font-size: 22px;
}
.login-brand .brand-mark.has-logo { background: #fff; box-shadow: var(--shadow-sm); }
.login-sub { color: var(--ink-soft); font-size: 14px; margin: 12px 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 15px; }
.login-form label { font-weight: 600; }
.login-form .btn { margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .shell { flex-direction: column; min-height: 100vh; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .nav-label { display: none; }
  .sidebar-foot {
    border-top: 0; margin: 0; padding: 0; flex-direction: row; align-items: center;
    width: 100%; justify-content: space-between;
  }
  .topbar { padding: 18px 20px 8px; }
  .content { padding: 14px 20px 24px; }
  .card { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
