:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --sidebar: #1f2937;
  --sidebar-hover: #374151;
  --sidebar-active: #2563eb;
  --text: #111827;
  --text-muted: #6b7280;
  --text-on-dark: #e5e7eb;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --error-bg: #fee2e2;
  --error-text: #991b1b;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --radius: 8px;
  --sidebar-width: 250px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }

/* ---- Layout: Sidebar links, Inhalt rechts ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--sidebar);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.content-body { padding: 2rem; }

/* ---- Brand ---- */
.brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1rem; }
.brand-center { justify-content: center; padding: 0 0 1.5rem; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius);
  background: var(--primary); color: #fff; font-weight: 700; letter-spacing: .5px;
}
.brand-text { font-weight: 600; line-height: 1.15; }
.brand-text small { font-weight: 400; font-size: .8rem; color: #9ca3af; }
.auth .brand-text { color: var(--text); }
.auth .brand-text small { color: var(--text-muted); }

/* ---- Navigation ---- */
.nav { display: flex; flex-direction: column; padding: .5rem .75rem; gap: 2px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .75rem; border-radius: var(--radius);
  color: var(--text-on-dark); font-weight: 500;
}
.nav-link:hover { background: var(--sidebar-hover); }
.nav-link.is-active { background: var(--sidebar-active); color: #fff; }
.nav-icon { width: 1.1rem; text-align: center; opacity: .8; font-size: .85rem; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); }
.user-name { display: block; font-size: .9rem; margin-bottom: .5rem; color: #9ca3af; }

/* ---- Buttons ---- */
.btn {
  display: inline-block; padding: .55rem 1rem; border-radius: var(--radius);
  border: 1px solid transparent; font: inherit; font-weight: 500; cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-on-dark); border-color: rgba(255,255,255,.2); width: 100%; }
.btn-ghost:hover { background: var(--sidebar-hover); }
.btn-block { width: 100%; }

/* ---- Cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }

/* ---- Messages ---- */
.messages { padding: 1rem 2rem 0; }
.message { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .75rem; }
.message-error { background: var(--error-bg); color: var(--error-text); }
.message-success { background: var(--success-bg); color: var(--success-text); }

/* ---- Login ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2rem; box-shadow: 0 10px 30px rgba(0,0,0,.06);
}
.auth-card label { display: block; font-size: .9rem; font-weight: 500; margin: .75rem 0 .3rem; }
.auth-card input[type="text"], .auth-card input[type="password"] {
  width: 100%; padding: .6rem .75rem; border: 1px solid #d1d5db; border-radius: var(--radius); font: inherit;
}
.auth-card input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.auth-card .btn-block { margin-top: 1.25rem; }

/* ---- Responsive ---- */
@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .content-header, .content-body { padding: 1rem; }
}
