:root{
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --focus: #2563eb;

  --primary: #111827;
  --primaryText: #ffffff;

  --danger: #dc2626;
  --dangerBg: #fee2e2;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.4;
}

.page{
  min-height: 100%;
  display: grid;
  place-items: start center;
  padding: 28px 16px;
}

.card{
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(17,24,39,.06);
  overflow: hidden;
}

.card__header{
  padding: 18px 20px 10px;
  border-bottom: 1px solid var(--border);
}

.card__header h1{
  margin: 8px 0 6px;
  font-size: 20px;
  letter-spacing: .2px;
}

.subtitle{
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.back{
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
.back:hover{ color: var(--text); }

.form{
  padding: 18px 20px 20px;
  display: grid;
  gap: 14px;
}

.field{
  display: grid;
  gap: 6px;
}

label{
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.hint{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select{
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
select:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 4px var(--ring);
}

select{ padding-right: 34px; }

input:focus,
select:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.field--inline{
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
}

.actions{
  display: flex;
  gap: 10px;
  margin-top: 2px;
}

.btn{
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover{ filter: brightness(.98); }
.btn:focus{
  outline: none;
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
  border-color: rgba(37,99,235,.55);
}

.btn--primary{
  background: var(--primary);
  color: var(--primaryText);
  border-color: var(--primary);
}

.btn--ghost{
  background: transparent;
}

.divider{
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0 0;
}

.danger{
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #fecaca;
  background: var(--dangerBg);
}

.btn--danger{
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

/* Switch (schlicht) */
.switch{
  position: relative;
  width: 46px;
  height: 28px;
  display: inline-block;
}
.switch input{
  opacity: 0;
  width: 0; height: 0;
}
.switch__track{
  position: absolute;
  inset: 0;
  background: #e5e7eb;
  border-radius: 999px;
  transition: .2s ease;
  border: 1px solid var(--border);
}
.switch__track::after{
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 999px;
  transform: translateY(-50%);
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  transition: .2s ease;
}
.switch input:checked + .switch__track{
  background: rgba(17,24,39,.92);
  border-color: rgba(17,24,39,.92);
}
.switch input:checked + .switch__track::after{
  left: 21px;
}

:root{
  --bg:#f6f7f9;
  --card:#fff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --ring: rgba(37,99,235,.14);

  --primary:#111827;
  --primaryText:#ffffff;

  --danger:#dc2626;
  --dangerSoft:#fee2e2;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.45;
}

.page{
  min-height:100%;
  display:grid;
  place-items:start center;
  padding:28px 16px;
}

.card{
  width:100%;
  max-width:900px;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:0 10px 30px rgba(17,24,39,.06);
  overflow:hidden;
}

.card__header{
  padding:18px 20px 12px;
  border-bottom:1px solid var(--border);
}
.card__header h1{
  margin:10px 0 6px;
  font-size:20px;
  letter-spacing:.2px;
}
.subtitle{margin:0;color:var(--muted);font-size:13px}

.card__content{padding:18px 20px 22px}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
  flex-wrap:wrap;
}

.back, .link{
  color:var(--muted);
  text-decoration:none;
  font-size:13px;
  display:inline-flex;
  gap:8px;
  align-items:center;
}
.back:hover,.link:hover{color:var(--text)}

.btn{
  appearance:none;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  padding:10px 12px;
  border-radius:10px;
  font-weight:700;
  font-size:14px;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.btn:hover{filter:brightness(.98)}
.btn:focus{outline:none;box-shadow:0 0 0 4px var(--ring);border-color:rgba(37,99,235,.55)}
.btn--primary{background:var(--primary);border-color:var(--primary);color:var(--primaryText)}
.btn--ghost{background:transparent}

/* Table */
.table-wrap{
  border:1px solid var(--border);
  border-radius:12px;
  overflow:auto; /* horizontal scroll on small screens */
  background:#fff;
}

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:720px; /* damit Spalten nicht zu eng werden */
}

thead th{
  text-align:left;
  font-size:12px;
  color:var(--muted);
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
  background:#fafafa;
  border-bottom:1px solid var(--border);
  padding:12px 14px;
  white-space:nowrap;
}

tbody td{
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  font-size:14px;
  vertical-align:middle;
}

tbody tr:hover{background:#fbfbfb}
tbody tr:last-child td{border-bottom:none}

/* Small badges for yes/no */
.badge{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  border:1px solid var(--border);
  background:#fff;
}
.badge--yes{border-color:rgba(17,24,39,.35)}
.badge--no{color:var(--muted)}

/* Action column */
.td-actions{
  width:1%;
  white-space:nowrap;
}

.icon-btn{
  width:36px;
  height:36px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#fff;
  display:inline-grid;
  place-items:center;
  cursor:pointer;
  text-decoration:none;
}
.icon-btn:hover{filter:brightness(.98)}
.icon-btn:focus{outline:none;box-shadow:0 0 0 4px var(--ring);border-color:rgba(37,99,235,.55)}
.icon{
  width:18px;
  height:18px;
  display:block;
}

/* Footer spacing */
.footer-links{margin-top:14px}

/* Sticky first column (User) on horizontal scroll */
.table-wrap{
  overflow:auto;          /* muss scrollen können */
  -webkit-overflow-scrolling: touch;
}

.admin-table{
  border-collapse: separate; /* wichtig für sticky + borders */
  border-spacing: 0;
}

/* 1. Spalte (th + td) klebt links */
.admin-table th:first-child,
.admin-table td:first-child{
  position: sticky;
  left: 0;
  z-index: 2;            /* über anderen Zellen */
  background: #fff;      /* damit beim Scrollen nix durchscheint */
}

/* Header der 1. Spalte soll über allem liegen */
.admin-table thead th:first-child{
  z-index: 3;
  background: #fafafa;   /* wie dein Header */
}

/* schöner Trenner rechts an der sticky Spalte */
.admin-table th:first-child,
.admin-table td:first-child{
  box-shadow: 1px 0 0 var(--border);
}

.alert{
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 14px;
}

.alert--success{
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #065f46;
}

.alert--error{
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.filters{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 14px;
}

@media (max-width: 640px){
  .filters{ grid-template-columns: 1fr; }
}

/* ===== Sticky 1. + 2. Spalte (MG-ID & Name) ===== */
.table-wrap{
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table{
  border-collapse: separate;
  border-spacing: 0;
}

/* 1. Spalte (MG-ID) sticky links */
.admin-table th:nth-child(1),
.admin-table td:nth-child(1){
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 1px 0 0 var(--border);
}

/* Header-Zellen über allem */
.admin-table thead th:nth-child(1){
  z-index: 4;
  background: #fafafa;
}
.admin-table thead th:nth-child(2){
  z-index: 4;
  background: #fafafa;
}

/* Hover-Farbe für sticky Zellen mitziehen */
.admin-table tbody tr:hover td:nth-child(1),
.admin-table tbody tr:hover td:nth-child(2){
  background:#fbfbfb;
}

/* Optional: feste Breite der sticky Spalten (macht left-Wert stabil) */
.admin-table th:nth-child(1),
.admin-table td:nth-child(1){
  min-width: 120px;
}
.admin-table th:nth-child(2),
.admin-table td:nth-child(2){
  min-width: 220px;
}

/* Buttons untereinander */
.actions--stack{
  flex-direction: column;
  align-items: stretch;
}
.actions--stack .btn{
  width: 100%;
  justify-content: center; /* optional */
}

.divider{ border:none; border-top:1px solid var(--border); margin:14px 0; }

.alert{
  padding:12px 14px; border-radius:12px; border:1px solid var(--border);
  font-weight:700; font-size:13px; margin-bottom:14px;
}
.alert--success{ background:#ecfdf5; border-color:#bbf7d0; color:#065f46; }
.alert--error{ background:#fef2f2; border-color:#fecaca; color:#991b1b; }

.actions--stack{
  flex-direction: column;
  align-items: stretch;
}
.actions--stack .btn{
  width: 100%;
  justify-content: center;
}

