/* ============================================================
   Kooperationsplattform – style.css
   Richtung A: "Lavendel / Ruhig"
   Server-rendered, mobile-first, WCAG AA, kein JS, kein CDN.
   Einziges Symbol: 🦄 (Wortmarke). Regenbogen nur als feine Leiste.
   ============================================================ */

:root {
  /* Akzent */
  --accent: #6d3bbf;
  --accent-dark: #54299b;
  --accent-soft: #f1ecfa;
  --accent-softer: #f8f5fd;

  /* Text & Flächen */
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e4e2ec;
  --line-soft: #efedf4;
  --bg: #faf9fc;
  --surface: #ffffff;

  /* Status */
  --ok: #2e7d4f;
  --ok-bg: #e7f3ec;
  --warn: #9a6500;
  --warn-bg: #fbf2dd;
  --akut: #c0392b;
  --akut-bg: #fbe9e7;

  /* Form */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* Schatten – weich, niedrig */
  --shadow-sm: 0 1px 2px rgba(31, 36, 48, .05);
  --shadow: 0 2px 8px rgba(31, 36, 48, .06), 0 1px 2px rgba(31, 36, 48, .04);
  --shadow-md: 0 6px 20px rgba(84, 41, 155, .10);

  /* Regenbogen – dezent */
  --rainbow: linear-gradient(90deg,
    #c0392b 0%, #d98324 18%, #c9a227 36%,
    #2e7d4f 54%, #2d6fb3 72%, #6d3bbf 90%, #8e44ad 100%);

  --maxw: 1100px;
}

/* ---------- Reset / Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main, .wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(16px, 4vw, 28px);
}

h1, h2, h3 { line-height: 1.25; color: var(--ink); margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: clamp(1.4rem, 4vw, 1.75rem); }
h2 { font-size: clamp(1.15rem, 3vw, 1.35rem); margin-top: 1.4em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
small, .muted { color: var(--muted); }
.small { font-size: .85rem; }
.break { word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* Sichtbarer Fokus – global, barrierearm */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ---------- Kopf / Topbar ---------- */
.rainbow-strip {
  height: 3px;
  background: var(--rainbow);
  width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

/* zentrierte Inhaltszeile in der vollbreiten Leiste */
.topbar > .wrap {
  display: flex;
  align-items: center;
  gap: 8px 18px;
  flex-wrap: wrap;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px clamp(16px, 4vw, 28px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .5ch;
  font-weight: 750;
  font-size: 1.12rem;
  letter-spacing: -.015em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand .uni { font-size: 1.2rem; }            /* Einhorn als Wortmarke */
.brand:focus-visible { outline-offset: 4px; }

.topbar nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}
nav a {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: .94rem;
  font-weight: 550;
  line-height: 1.2;
  transition: background-color .12s ease, color .12s ease;
}
nav a:hover { background: var(--accent-soft); color: var(--accent-dark); }
nav a.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 650;
}

/* Abmelden-Bereich rechts */
.logout { margin-left: auto; display: flex; align-items: center; gap: .7rem; margin-bottom: 0; }
.who { color: var(--muted); font-size: .85rem; }

/* ---------- Karten ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 0 0 16px;
}
.card > h2:first-child,
.card > h3:first-child { margin-top: 0; }
.card.narrow { max-width: 400px; margin: 48px auto; }     /* Login / Einladung */
.card.hinweis { border-color: var(--accent); background: var(--accent-soft); }

/* Aufklappbare Karten */
details.card { padding: 0; overflow: hidden; }
details.card > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-radius: var(--radius);
  font-weight: 650;
  transition: background-color .12s ease;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after {
  content: "";
  margin-left: auto;
  width: 9px; height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s ease;
  flex: none;
}
details.card[open] > summary::after { transform: rotate(225deg); }
details.card > summary:hover { background: var(--accent-softer); }
details.card[open] > summary {
  border-bottom: 1px solid var(--line-soft);
  border-radius: var(--radius) var(--radius) 0 0;
}
details.card > summary .title { font-weight: 650; }
details.card > summary .sub { color: var(--muted); font-size: .9rem; font-weight: 500; }
/* Karten-Inhalt steht als direkte Geschwister der summary (kein .body-Wrapper) */
details.card[open] > :not(summary) { padding-left: 16px; padding-right: 16px; }
details.card[open] > summary + * { padding-top: 14px; }
details.card[open] > :last-child { padding-bottom: 16px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5ch;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.2;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .12s ease, box-shadow .12s ease, transform .04s ease;
}
button:hover, .btn:hover { background: var(--accent-dark); }
button:active, .btn:active { transform: translateY(1px); }

.btn.secondary, button.secondary, .secondary {
  background: var(--surface);
  color: var(--accent-dark);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.secondary:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

.btn.danger, button.danger, .danger {
  background: var(--akut);
  color: #fff;
}
.danger:hover { background: #a93226; }

button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Formulare ---------- */
form { margin: 0 0 1em; }
form:last-child { margin-bottom: 0; }
label {
  display: block;
  font-weight: 600;
  font-size: .92rem;
  color: var(--ink);
  margin: 0 0 12px;
}
label .muted { font-weight: 400; }
.field { margin-bottom: 16px; }
.field small { display: block; margin-top: 4px; color: var(--muted); }

input, select, textarea {
  font: inherit;
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #9aa0ad; }

input:hover, select:hover, textarea:hover { border-color: #cfccdb; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 59, 191, .16);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

/* Checkbox + label.check */
input[type="checkbox"], input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0 .45rem 0 0;
  accent-color: var(--accent);
  flex: none;
  display: inline-block;
  vertical-align: middle;
}
label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  margin: 0 0 12px;
}
label.check input { margin: 0; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 0 16px; }
legend { font-weight: 650; padding: 0 6px; color: var(--ink); }

/* kleine Inline-Formulare (Status setzen, Löschen …) nebeneinander */
form.inline { display: inline-block; margin: 0; }
form.inline-wrap { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: 0; }
form.inline-wrap input, form.inline-wrap select { width: auto; margin: 0; }

/* ---------- Hinweise / Fehler ---------- */
.fehler {
  color: #9c281b;
  background: var(--akut-bg);
  border: 1px solid #eccac6;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
  font-weight: 550;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .4ch;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: .01em;
  white-space: nowrap;
  background: var(--line-soft);
  color: var(--muted);
  border: 1px solid transparent;
}
.badge.ok   { background: var(--ok-bg);   color: #1f5c3a; }
.badge.none { background: #f0f1f4;        color: #5b6270; }
.badge.warn, .badge.mittel { background: var(--warn-bg); color: #7a5200; }
.badge.akut { background: var(--akut-bg); color: #9c281b; }
.badge.rolle{ background: var(--accent-soft); color: var(--accent-dark); }
.badge.hoch { background: #efe7fb; color: var(--accent-dark); border-color: #d9caf3; }

/* ---------- Dashboard / KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.kpi {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
a.kpi { text-decoration: none; color: var(--ink); transition: border-color .12s ease, box-shadow .12s ease; }
a.kpi:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.kpi .num {
  display: block;
  font-size: clamp(1.7rem, 5vw, 2.1rem);
  font-weight: 720;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}
.kpi .lbl {
  display: block;
  margin-top: 4px;
  font-size: .85rem;
  color: var(--muted);
  font-weight: 550;
}

/* ---------- Detail-Liste dl.kv ---------- */
dl.kv {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 6px 18px;
  margin: 0;
  font-size: .95rem;
}
dl.kv dt { color: var(--muted); font-weight: 550; }
dl.kv dd { margin: 0; color: var(--ink); }
dl.kv dd + dt, dl.kv dt + dd { border-top: 1px solid var(--line-soft); padding-top: 6px; }
dl.kv > dt:first-of-type, dl.kv > dt:first-of-type + dd { border-top: 0; padding-top: 0; }

/* ---------- Stellen-Chips & Jahr-Navigation ---------- */
.stellen-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.stellen-links a {
  display: inline-block;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 550;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.stellen-links a:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-dark); }
.stellen-links a.aktiv {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.jahr-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.jahr-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.jahr-nav a:hover { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent-soft); }
.jahr-nav strong { font-variant-numeric: tabular-nums; }

/* ---------- Kalender-Heatmap ---------- */
.cal {
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  width: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.cal caption { font-weight: 650; text-align: left; padding: 0 0 8px; }
.cal th {
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  padding: 2px 3px;
  background: none;
  border: 0;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}
.cal tbody th { text-align: right; padding-right: .5rem; }
.cal td {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid #fff;
  border-radius: 3px;
  background: #f3f2f7;
}
.cal td.frei      { background: var(--ok-bg); }
.cal td.frei.we   { background: #eceaf2; }
.cal td.oat       { background: #edc14d; }   /* keine OAT – Stelle sonst besetzt */
.cal td.abw       { background: #d8694f; }
.cal td.pad       { background: transparent; border: 0; }
.cal td.heute     { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Legenden-Swatches (inline) */
.cal-key {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 3px;
  vertical-align: middle;
  margin: 0 .25rem 0 .85rem;
}
.cal-key.abw   { background: #d8694f; }
.cal-key.oat   { background: #edc14d; }
.cal-key.frei  { background: var(--ok-bg); }
.cal-key.heute { background: #f3f2f7; outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: .94rem;
}
th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
thead th {
  background: var(--accent-softer);
  color: var(--ink);
  font-weight: 650;
  font-size: .85rem;
  letter-spacing: .01em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--accent-softer); }

/* ---------- Utilities ---------- */
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.stack > * + * { margin-top: 12px; }
.right { margin-left: auto; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 12px; }
.section-title h2 { margin: 0; }

/* ---------- Smartphone ---------- */
@media (max-width: 640px) {
  main, .wrap { padding-left: 14px; padding-right: 14px; }
  .topbar > .wrap { gap: 6px 10px; }
  .topbar nav { order: 3; width: 100%; gap: 4px; }
  .who { display: none; }
  .logout { margin-left: auto; }
  /* Datentabellen horizontal scrollbar machen (kein .table-wrap im Markup) */
  table:not(.cal) { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  td input, td select, td textarea { min-width: 7.5rem; }
}

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