/* Agenda (agenda.assistentt.de) — zurückhaltend, hell, eine Akzentfarbe.
   Systemschrift, keine Webfonts, keine externen Ressourcen. */

:root {
  --akzent: #EA661E;
  --akzent-dunkel: #C95412;
  --akzent-hell: #FDF0E8;
  --tinte: #1F2328;
  --grau-1: #57606A;
  --grau-2: #8B949E;
  --linie: #D8DDE3;
  --linie-hell: #EAEDF0;
  --flaeche: #F6F8FA;
  --weiss: #FFFFFF;
  --fehler: #B42318;
  --fehler-hell: #FEF3F2;
  --ok: #1A7F37;
  --radius: 8px;
  --schatten: 0 1px 2px rgba(31, 35, 40, .06), 0 8px 24px rgba(31, 35, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--weiss);
  color: var(--tinte);
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1 { font-size: 1.45rem; font-weight: 650; margin: 0 0 .35rem; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 0 0 .6rem; }
h3 { font-size: .95rem; font-weight: 650; margin: 0 0 .4rem; }
a { color: var(--akzent-dunkel); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: .4rem 0; }

/* ---------- Topbar ---------- */
.topbar {
  border-bottom: 1px solid var(--linie);
  background: var(--weiss);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 54px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--tinte); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto;
  background: var(--akzent);
  background-image: linear-gradient(#fff 0 0), linear-gradient(#fff 0 0), linear-gradient(#fff 0 0);
  background-size: 12px 2.4px, 12px 2.4px, 8px 2.4px;
  background-position: 5px 6px, 5px 10px, 5px 14px;
  background-repeat: no-repeat;
}
.brand-name { font-weight: 700; letter-spacing: .01em; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--grau-1);
  font-weight: 500;
}
.main-nav a:hover { color: var(--tinte); text-decoration: none; background: var(--flaeche); }
.main-nav a.aktiv { color: var(--akzent-dunkel); background: var(--akzent-hell); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tenant-switch {
  border: 1px solid var(--linie);
  background: var(--weiss);
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: .85rem;
  color: var(--grau-1);
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tenant-switch:hover { border-color: var(--grau-2); color: var(--tinte); }

/* ---------- Layout ---------- */
.main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .spacer { flex: 1; }
.untertitel { color: var(--grau-1); margin: 0; }
.zurueck { display: inline-block; margin-bottom: 10px; color: var(--grau-1); font-size: .88rem; }

.card {
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--weiss);
  padding: 18px;
  margin-bottom: 18px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 18px; }
.card-grid .card { margin-bottom: 0; }

.leer {
  color: var(--grau-1);
  padding: 22px;
  text-align: center;
  border: 1px dashed var(--linie);
  border-radius: var(--radius);
  background: var(--flaeche);
}

/* ---------- Banner / Toast ---------- */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--fehler-hell);
  border: 1px solid #F1B0AB;
  color: var(--fehler);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
}
.banner-close {
  margin-left: auto;
  border: 0; background: none; color: inherit;
  font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 2px;
}
.toast {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--tinte); color: #fff;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: .9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 60;
  max-width: min(92vw, 560px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--linie);
  border-radius: 6px;
  background: var(--weiss);
  color: var(--tinte);
  font: inherit;
  font-size: .9rem;
  font-weight: 550;
  padding: 7px 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--flaeche); text-decoration: none; }
.btn-primary { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.btn-primary:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); }
.btn-outline { border-color: var(--akzent); color: var(--akzent-dunkel); }
.btn-outline:hover { background: var(--akzent-hell); }
.btn-ghost { border-color: transparent; color: var(--grau-1); }
.btn-ghost:hover { color: var(--tinte); background: var(--flaeche); }
.btn-sm { padding: 4px 10px; font-size: .84rem; }
.btn-block { width: 100%; margin-top: 6px; }
.btn:disabled { opacity: .5; cursor: default; }

.icon-btn {
  border: 0; background: none; cursor: pointer;
  color: var(--grau-2); font: inherit; font-size: .9rem;
  padding: 2px 6px; border-radius: 4px;
}
.icon-btn:hover { color: var(--tinte); background: var(--flaeche); }

/* ---------- Formulare ---------- */
label { display: block; font-size: .85rem; font-weight: 550; color: var(--grau-1); margin: 12px 0 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%;
  border: 1px solid var(--linie);
  border-radius: 6px;
  background: var(--weiss);
  color: var(--tinte);
  font: inherit;
  padding: 7px 10px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--akzent);
  outline-offset: 0;
  border-color: var(--akzent);
}
textarea { resize: vertical; min-height: 70px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: .9rem; }
.check input { width: auto; accent-color: var(--akzent); }
.hinweis { font-size: .84rem; color: var(--grau-1); margin-top: 6px; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form > div { flex: 1 1 160px; }
.inline-form label { margin-top: 0; }

/* ---------- Tabellen / Listen ---------- */
.tabelle-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th {
  text-align: left;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--grau-2);
  font-weight: 600;
  padding: 6px 10px;
  border-bottom: 1px solid var(--linie);
  white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--linie-hell); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.klickbar { cursor: pointer; }
tr.klickbar:hover td { background: var(--flaeche); }
td.aktionen { text-align: right; white-space: nowrap; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: .76rem;
  font-weight: 600;
  border: 1px solid var(--linie);
  color: var(--grau-1);
  background: var(--flaeche);
  white-space: nowrap;
}
.badge-akzent { background: var(--akzent-hell); border-color: #F3C6A8; color: var(--akzent-dunkel); }
.badge-dunkel { background: var(--tinte); border-color: var(--tinte); color: #fff; }

/* ---------- Phasen-Stepper ---------- */
.stepper { display: flex; gap: 0; flex-wrap: wrap; margin: 14px 0 4px; }
.step {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--linie);
  background: var(--weiss);
  color: var(--grau-1);
  font: inherit; font-size: .9rem; font-weight: 550;
  cursor: pointer;
}
.step:first-child { border-radius: 6px 0 0 6px; }
.step:last-child { border-radius: 0 6px 6px 0; }
.step + .step { margin-left: -1px; }
.step .nr {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--linie-hell); color: var(--grau-1);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .76rem; font-weight: 650;
}
.step.aktiv { background: var(--akzent-hell); border-color: var(--akzent); color: var(--akzent-dunkel); z-index: 1; }
.step.aktiv .nr { background: var(--akzent); color: #fff; }
.step:disabled { cursor: default; opacity: .75; }

/* ---------- TOP-Liste ---------- */
.top-item { border-bottom: 1px solid var(--linie-hell); padding: 12px 0; }
.top-item:last-child { border-bottom: 0; }
.top-zeile { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.top-nr { font-weight: 700; color: var(--akzent-dunkel); white-space: nowrap; }
.top-titel { font-weight: 600; }
.top-zeile .aktionen { margin-left: auto; white-space: nowrap; }
.top-beschreibung { color: var(--grau-1); font-size: .9rem; margin: 2px 0 0 0; }
.top-protokoll { margin-top: 10px; }
.top-protokoll textarea { font-size: .9rem; }

/* ---------- Dashboard ---------- */
.schritt-karte { border-left: 3px solid var(--akzent); }
.schritt-warum { color: var(--grau-1); font-size: .9rem; }
.weitere-schritte { margin: 6px 0 0; padding-left: 1.2em; color: var(--grau-1); font-size: .92rem; }
.kennzahlen { display: flex; gap: 26px; flex-wrap: wrap; }
.kennzahl .wert { font-size: 1.5rem; font-weight: 700; }
.kennzahl .label { font-size: .82rem; color: var(--grau-1); }

/* ---------- Protokoll-Vorschau ---------- */
.protokoll-vorschau { background: var(--flaeche); border-radius: var(--radius); padding: 16px 18px; font-size: .92rem; }
.protokoll-vorschau h3 { margin-top: 14px; }
.protokoll-vorschau h3:first-child { margin-top: 0; }
.pflicht-fehlt { color: var(--fehler); font-size: .9rem; margin: 8px 0 0; padding-left: 1.2em; }

.link-box {
  display: flex; gap: 8px; align-items: center;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
}
.link-box code {
  flex: 1;
  font-size: .82rem;
  overflow-x: auto;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--linie); margin-bottom: 16px; }
.tab {
  border: 0; background: none; font: inherit; font-size: .92rem; font-weight: 550;
  color: var(--grau-1); padding: 8px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--tinte); }
.tab.aktiv { color: var(--akzent-dunkel); border-bottom-color: var(--akzent); }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--flaeche);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--weiss);
  border: 1px solid var(--linie);
  border-radius: 12px;
  box-shadow: var(--schatten);
  padding: 28px;
}
.auth-brand { display: flex; align-items: center; gap: 9px; justify-content: center; margin-bottom: 18px; }
.auth-card h1 { font-size: 1.15rem; text-align: center; margin-bottom: 4px; }
.auth-msg { color: var(--fehler); font-size: .88rem; text-align: center; min-height: 1.2em; margin: 4px 0; }
.auth-switch { text-align: center; font-size: .88rem; color: var(--grau-1); margin-top: 16px; }
.invite-banner {
  background: var(--akzent-hell);
  border: 1px solid #F3C6A8;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: .9rem;
  margin-bottom: 12px;
}
.tenant-list { margin: 12px 0; }
.tenant-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--weiss);
  padding: 10px 14px;
  margin-bottom: 8px;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.tenant-item:hover { border-color: var(--akzent); background: var(--akzent-hell); }
.tenant-item .rolle { margin-left: auto; }
.tenant-new-head { margin-top: 18px; font-size: .9rem; color: var(--grau-1); }

/* ---------- Modal ---------- */
.modal-wrap {
  position: fixed; inset: 0;
  background: rgba(31, 35, 40, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 16px;
  z-index: 50;
  overflow-y: auto;
}
.modal {
  width: 100%; max-width: 520px;
  background: var(--weiss);
  border-radius: 12px;
  box-shadow: var(--schatten);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 0;
}
.modal-head h2 { margin: 0; }
.modal-close {
  border: 0; background: none; font-size: 1.3rem; line-height: 1;
  color: var(--grau-2); cursor: pointer; padding: 2px 6px;
}
.modal-close:hover { color: var(--tinte); }
.modal-body { padding: 4px 20px 4px; }
.modal-body label:first-child { margin-top: 8px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 20px 18px;
}
.modal-msg {
  margin: 10px 20px 0;
  background: var(--fehler-hell);
  border: 1px solid #F1B0AB;
  color: var(--fehler);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: .88rem;
}
.modal-warnung {
  background: var(--fehler-hell);
  border: 1px solid #F1B0AB;
  color: var(--fehler);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: .9rem;
  margin-top: 10px;
}

/* ---------- Responsiv ---------- */
@media (max-width: 720px) {
  .topbar-inner { padding: 8px 14px; }
  .main { padding: 18px 14px 48px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .main-nav { order: 3; width: 100%; padding-bottom: 6px; }
  .topbar-right { margin-left: auto; }
  .stepper { flex-direction: column; }
  .step { border-radius: 0; }
  .step:first-child { border-radius: 6px 6px 0 0; }
  .step:last-child { border-radius: 0 0 6px 6px; }
  .step + .step { margin-left: 0; margin-top: -1px; }
}
