:root{
  --bg:#f8fafc;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --primary:#2563eb;
  --primary-dark:#1d4ed8;
  --border:#e2e8f0;
  --shadow:0 10px 30px rgba(37,99,235,.08);
  --radius:22px;
}

*{ box-sizing:border-box; }

html{ -webkit-text-size-adjust:100%; }

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  background:linear-gradient(180deg,#eff6ff,#f8fafc 35%);
  color:var(--text);
  overflow-x:hidden;
}

a{ text-decoration:none; color:inherit; }

input,select,button,textarea{ font:inherit; }

button{ cursor:pointer; }

.app-shell{
  max-width:1100px;
  margin:0 auto;
  padding:16px;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:16px;
}

.topbar h1{
  margin:0;
  font-size:1.6rem;
  line-height:1.2;
}

.muted{ color:var(--muted); }

.topbar-actions{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 12px;
  background:#dbeafe;
  color:#1d4ed8;
  border-radius:999px;
  font-size:.9rem;
  font-weight:700;
}

.nav-grid,.grid{
  display:grid;
  gap:16px;
}

.nav-grid{
  grid-template-columns:repeat(auto-fit,minmax(130px,1fr));
  margin-bottom:16px;
}

.grid{
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
}

.single-col{ grid-template-columns:1fr; }

.admin-grid{
  grid-template-columns:minmax(280px,360px) 1fr;
}

.nav-card,.card{
  background:rgba(255,255,255,.94);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

.nav-card{
  padding:18px;
  font-weight:700;
  text-align:center;
}

.card{ padding:18px; }

.form-card label,
.details-form label{
  display:grid;
  gap:6px;
  margin-bottom:12px;
  font-weight:600;
}

.form-card input,
.form-card select,
.details-form input,
.details-form select,
.inline-form input,
.inline-form select,
textarea{
  width:100%;
  padding:12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
}

input:focus,
select:focus,
textarea:focus{
  outline:none;
  border-color:#93c5fd;
  box-shadow:0 0 0 4px rgba(37,99,235,.12);
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:var(--primary);
  color:#fff;
  padding:12px 16px;
  border:none;
  border-radius:14px;
  font-weight:700;
}

.btn:hover{ background:var(--primary-dark); }

.btn-secondary{
  background:#fff;
  color:var(--text);
  border:1px solid var(--border);
}

/* =========================
   ALERT SYSTEM (NEU FIX)
========================= */

.alert{
  padding:12px 14px;
  border-radius:14px;
  margin-bottom:12px;
  border:1px solid transparent;
}

/* ERFOLG = GRÜN */
.alert.success{
  background:#dcfce7;
  color:#166534;
  border-color:#bbf7d0;
}

/* FEHLER = ROT */
.alert.error{
  background:#fee2e2;
  color:#991b1b;
  border-color:#fecaca;
}

/* ========================= */

.info-box{
  padding:12px;
  border-radius:14px;
  background:#eff6ff;
  margin-bottom:12px;
}

.inline-form{
  display:flex;
  gap:12px;
  align-items:end;
  flex-wrap:wrap;
}

.inline-form label{
  min-width:180px;
  display:grid;
  gap:6px;
}

.stats-row{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
  gap:12px;
  margin:12px 0 18px;
}

.stats-row div{
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:16px;
  padding:12px;
}

.stats-row span,
.stats-row strong{
  display:block;
}

.table-wrap{
  width:100%;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}

table{
  width:100%;
  border-collapse:collapse;
}

th,td{
  padding:10px 8px;
  border-bottom:1px solid var(--border);
  text-align:left;
  vertical-align:top;
}

th{
  color:var(--muted);
  font-size:.92rem;
  font-weight:700;
}

.stack-list{
  display:grid;
  gap:12px;
}

.details-card{
  border:1px solid var(--border);
  border-radius:18px;
  padding:12px;
  background:#fff;
}

.details-card summary{
  cursor:pointer;
  font-weight:700;
}

.details-form{
  margin-top:14px;
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:12px;
  align-items:end;
}

/* Rest bleibt gleich (Mobile + Print) */