/* =====================================================================
   Verwaltungsbereich – ergänzt portal.css
   Nutzt ausschliesslich die dort definierten semantischen Tokens,
   funktioniert dadurch automatisch in hell und dunkel.
   ===================================================================== */

.admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 32px 80px;
}

/* --- Navigation ------------------------------------------------------ */

.admin-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.admin-nav a {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
}

.admin-nav a:hover {
  color: var(--text-primary);
  border-bottom-color: var(--akzent);
}

/* .icon-btn steht in portal.css – die öffentliche Seite verwendet
   dieselben Symbolknöpfe. */

/* --- Angemeldete Person (rechts in der Kopfzeile) -------------------- */

.benutzer {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 14px 3px 3px;
  border: 1px solid var(--border-stark);
  border-radius: 999px;
  background: var(--surface);
}

.benutzer-initialen {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--akzent);
  color: var(--akzent-kontrast);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.benutzer-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.benutzer-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.benutzer-rolle {
  font-size: 11px;
  color: var(--text-muted);
}

/* Auf schmalen Fenstern nur die Initialen zeigen */
@media (max-width: 900px) {
  .benutzer-text { display: none; }
  .benutzer { padding: 4px; }
}

/* --- Schaltflächen --------------------------------------------------- */

.btn-klein {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border-stark);
  border-radius: var(--radius-klein);
  cursor: pointer;
}

.btn-klein:hover { border-color: var(--akzent); color: var(--text-primary); }

.btn-gefahr {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #b3261e;
  background: transparent;
  border: 1px solid #b3261e;
  border-radius: var(--radius);
  cursor: pointer;
  margin-left: auto;   /* schiebt Löschen weg von Speichern */
}

.btn-gefahr:hover { background: #b3261e; color: #fff; }

button.btn { border: 0; cursor: pointer; font-family: inherit; }

/* --- Hinweise -------------------------------------------------------- */

.hinweis {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-stark);
  background: var(--surface);
  font-size: 14px;
  margin-bottom: 24px;
  border-left-width: 4px;
}

.hinweis-ok      { border-left-color: #2e7d32; }
.hinweis-warnung { border-left-color: #ed6c02; }
.hinweis-fehler  { border-left-color: #b3261e; }

/* --- Tabelle --------------------------------------------------------- */

.tabelle {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 14px;
}

.tabelle th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.tabelle td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.tabelle tr:last-child td { border-bottom: 0; }
.tabelle tbody tr:hover   { background: var(--surface-hover); }
.tabelle tr[hidden]       { display: none; }
.tabelle .rechts          { text-align: right; white-space: nowrap; }

/* --- Marken ---------------------------------------------------------- */

.marke {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border-stark);
  color: var(--text-muted);
  vertical-align: middle;
}

.typ-stadt        { border-color: var(--akzent); color: var(--akzent); }
.typ-campus       { border-style: dotted; }
.typ-partnerfirma { border-style: dashed; }
.status-an        { border-color: #2e7d32; color: #2e7d32; }
.status-aus       { border-color: #b3261e; color: #b3261e; }
.status-wartet    { border-color: #ed6c02; color: #ed6c02; }

/* --- Formulare direkt in einer Tabellenzeile -------------------------- */
/* Benutzerverwaltung: Rolle und Status lassen sich in der Liste ändern,
   ohne dass man dafür eine eigene Seite öffnen muss. Die Felder stehen
   deshalb nebeneinander statt untereinander wie im grossen Formular. */

.zeilen-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}

.zeilen-form + .zeilen-form { margin-left: 8px; }

.zeilen-form select {
  width: auto;
  min-width: 150px;
  padding: 4px 8px;
  font-size: 13px;
  margin: 0;
}

.zeilen-form .schalter { margin: 0; }
.zeilen-form .schalter > span { font-size: 13px; }

.bearbeiten-link {
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 8px;
  color: var(--text-muted);
}

/* --- Statistik ------------------------------------------------------- */

.zeitraum {
  display: inline-flex;
  border: 1px solid var(--border-stark);
  border-radius: var(--radius-klein);
  overflow: hidden;
  margin-bottom: 24px;
}

.zeitraum a {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--surface);
  border-right: 1px solid var(--border-stark);
}

.zeitraum a:last-child { border-right: 0; }
.zeitraum a:hover      { color: var(--text-primary); }
.zeitraum a.aktiv      { background: var(--akzent); color: var(--akzent-kontrast); }

.kennzahlen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.kennzahl {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.kennzahl-wert {
  display: block;
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.kennzahl-text {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Monatsverlauf – reine CSS-Säulen, keine Diagrammbibliothek nötig */
.verlauf {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 190px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.verlauf-monat {
  flex: 1;
  min-width: 34px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.verlauf-saeule {
  width: 100%;
  background: var(--akzent);
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: opacity .15s ease;
}

.verlauf-monat:hover .verlauf-saeule { opacity: .75; }

.verlauf-zahl {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  order: -1;            /* Zahl über die Säule */
}

.verlauf-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Balken in der Tabelle */
.balken-spalte { width: 180px; }

.balken {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--akzent);
  min-width: 2px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  text-decoration: none;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border-stark);
  border-radius: 999px;
}

.chip:hover { border-color: var(--akzent); color: var(--text-primary); }

/* --- Wappen ---------------------------------------------------------- */

/* Nicht mehr auf .tabelle beschränkt: dieselbe Klasse steht inzwischen auch
   vor Überschriften (admin/partnerzugriffe.php) – ohne diesen Rahmen käme
   dort die volle Bildgrösse zum Zug. */
.wappen-mini {
  width: 26px;
  height: 30px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 8px;
}

.tabelle .wappen-platzhalter {
  display: inline-block;
  width: 26px;
  margin-right: 8px;
}

/* Name-Zelle mit Wappen: Wappen links fix, Name umbricht bündig daneben
   statt unter das Wappen zu fliessen. */
.name-zelle {
  display: flex;
  align-items: center;
  gap: 8px;
}
.name-zelle .wappen-mini,
.name-zelle .wappen-platzhalter {
  flex-shrink: 0;
  margin-right: 0;
}
.name-zelle strong {
  min-width: 0;
  line-height: 1.3;
}

.wappen-zeile {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.wappen-vorschau {
  width: 96px;
  height: 108px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border-stark);
  border-radius: var(--radius-klein);
  background: var(--bg);
  overflow: hidden;
}

.wappen-vorschau img {
  max-width: 88px;
  max-height: 100px;
  object-fit: contain;
}

.wappen-leer {
  font-size: 11px;
  text-align: center;
  color: var(--text-muted);
  line-height: 1.3;
}

.wappen-felder { flex: 1; min-width: 0; }
.wappen-felder label:last-child { margin-bottom: 0; }

.formular input[type="file"] {
  width: 100%;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 0;
}

@media (max-width: 720px) {
  .wappen-zeile { flex-direction: column; }
}

/* --- Formular -------------------------------------------------------- */

.formular { max-width: 760px; }

.formular fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 24px 24px;
  margin: 0 0 20px;
}

.formular legend {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--akzent);
  padding: 0 8px;
}

.formular legend small {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--text-muted);
}

.formular label {
  display: block;
  margin-bottom: 16px;
}

.formular label > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.formular input[type="text"],
.formular input[type="number"],
.formular input[type="date"],
.formular select,
.formular textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border-stark);
  border-radius: var(--radius-klein);
}

.formular textarea { resize: vertical; }

.formular input:focus,
.formular select:focus,
.formular textarea:focus {
  outline: none;
  border-color: var(--akzent);
}

.formular small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.formular .fehler {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-style: normal;
  color: #b3261e;
}

.hat-fehler input,
.hat-fehler select,
.hat-fehler textarea { border-color: #b3261e; }

.schalter {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.schalter input { width: auto; }
.schalter > span { margin: 0 !important; font-weight: 500 !important; }

.zweispaltig,
.dreispaltig { display: grid; gap: 16px; }
.zweispaltig { grid-template-columns: 1fr 1fr; }
.dreispaltig { grid-template-columns: 1fr 1fr 1fr; }

.formular details { margin-top: 8px; }

.formular summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.aktionen {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

@media (max-width: 720px) {
  .admin-main { padding: 24px 16px 60px; }
  .admin-nav  { padding: 0 16px; }
  .zweispaltig, .dreispaltig { grid-template-columns: 1fr; }
  .tabelle { display: block; overflow-x: auto; }
}

/* --- Hilfe ------------------------------------------------------------ */

.hilfe-toc {
  margin: 0 0 32px;
}

.hilfe-abschnitt {
  scroll-margin-top: 16px;
  max-width: 760px;
}

.hilfe-abschnitt > .lead {
  margin-bottom: 18px;
}

.hilfe-abschnitt ol,
.hilfe-abschnitt ul {
  padding-left: 22px;
  margin: 0 0 16px;
}

.hilfe-abschnitt li {
  margin-bottom: 8px;
  line-height: 1.55;
}

.hilfe-abschnitt li ol,
.hilfe-abschnitt li ul {
  margin-top: 8px;
}

.hilfe-abschnitt p {
  line-height: 1.55;
  margin: 0 0 14px;
}

.hilfe-kasten {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 0 0 20px;
}

.hilfe-kasten summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
}

.hilfe-kasten[open] summary {
  margin-bottom: 12px;
}

.hilfe-kasten summary::marker,
.hilfe-kasten summary::-webkit-details-marker {
  color: var(--akzent);
}
