/* Gemeinsames Fundament der Gutachten-Erfassung.
   EINZIGE Quelle fuer Farben, Radien, Komponenten – die Seiten-Stylesheets
   (styles.css, photos.css) enthalten nur noch Seitenspezifisches.
   Liegt VOR der Anmeldeschranke, damit auch Login/Passwortwechsel es nutzen. */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c2530;
  --muted: #5b6b7a;
  --line: #d7dde3;
  --accent: #2f6f4f;
  --accent-ink: #ffffff;
  --error: #b23b3b;
  --ok: #2f6f4f;
  --warn: #8a6116;
  --warn-bg: #fdf1dc;
  --warn-line: #ecd9ae;
  --radius: 12px;
  --radius-klein: 8px;
  --schatten: 0 6px 24px rgba(28, 37, 48, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

/* --- Kopfzeile (App-Shell, gerendert von shell.js) ------------------------- */
.shell-kopf {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 50;
}
.shell-marke {
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.shell-marke span { color: var(--accent); }
.shell-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.shell-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 999px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.shell-nav a.aktiv { background: #e4f0ea; color: var(--accent); }
.shell-nav a:hover { color: var(--accent); }
.shell-kontext {
  background: #e4f0ea;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.shell-rechts {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.shell-nutzer { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-abmelden {
  color: var(--error);
  text-decoration: none;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: var(--radius-klein);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.shell-abmelden:hover { background: #f9eeee; }
@media (max-width: 560px) {
  .shell-nutzer { display: none; }
  /* Auf dem Telefon: eine Zeile, Navigation seitlich rollbar statt umbrechend */
  .shell-kopf { flex-wrap: nowrap; gap: 8px; padding: 8px 10px; }
  .shell-marke { font-size: 0.9rem; }
  .shell-nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .shell-nav::-webkit-scrollbar { display: none; }
  .shell-nav a { padding: 8px 9px; font-size: 0.86rem; }
  .shell-abmelden { padding: 8px 6px; font-size: 0.86rem; }
}

/* --- Bausteine -------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--schatten);
}

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill.on, .pill.eingetragen, .pill.freigegeben { background: #e4f0ea; color: var(--ok); }
.pill.off, .pill.fehler { background: #f1e3e3; color: var(--error); }
.pill.offen { background: #e8eef4; color: #3a5c7a; }
.pill.uebernommen { background: var(--warn-bg); color: var(--warn); }
.pill.demo { background: #ece6f5; color: #5a4a86; }
.pill.punkte { background: var(--warn-bg); color: var(--warn); }

button, .knopf {
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-klein);
  cursor: pointer;
  min-height: 44px;
}
button.primary, .knopf.primary { color: var(--accent-ink); background: var(--accent); }
button.secondary, .knopf.secondary { background: #eef1f4; color: var(--ink); border: 1px solid var(--line); }
button.gefahr, .knopf.gefahr { background: #f1e3e3; color: var(--error); border: 1px solid #e3cccc; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-klein);
  padding: 10px 12px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.msg { font-size: 0.9rem; min-height: 1.2em; }
.msg.err, .status.err { color: var(--error); }
.msg.ok, .status.ok { color: var(--ok); }
.muted { color: var(--muted); }

.warnung {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn);
  border-radius: var(--radius-klein);
  padding: 10px 12px;
  font-size: 0.88rem;
}

/* --- Toast (kurze Rueckmeldung unten) ---------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 28px rgba(28, 37, 48, 0.25);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
  max-width: min(92vw, 480px);
  text-align: center;
}
.toast.sichtbar { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--error); }

/* --- Bottom-Sheet (Eingaben statt prompt()) ---------------------------------- */
.sheet-hintergrund {
  position: fixed;
  inset: 0;
  background: rgba(28, 37, 48, 0.4);
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 560px;
  box-shadow: 0 -8px 30px rgba(28, 37, 48, 0.2);
}
.sheet h3 { margin: 0 0 4px; font-size: 1.02rem; }
.sheet .sheet-hinweis { color: var(--muted); font-size: 0.86rem; margin: 0 0 12px; }
.sheet input, .sheet textarea { width: 100%; }
.sheet .sheet-knoepfe { display: flex; gap: 10px; margin-top: 14px; }
.sheet .sheet-knoepfe button { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

/* --- Erfolgsdialog (mittig, z. B. nach dem Speichern) ------------------------ */
.dialog-hintergrund {
  position: fixed;
  inset: 0;
  background: rgba(28, 37, 48, 0.45);
  z-index: 160;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dialog {
  background: var(--card);
  border-radius: 16px;
  padding: 26px 22px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(28, 37, 48, 0.3);
}
.dialog-haken {
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 999px; background: #e4f0ea; color: var(--ok);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800;
}
.dialog h3 { margin: 0 0 6px; font-size: 1.1rem; }
.dialog .dialog-az {
  font-size: 1.35rem; font-weight: 800; color: var(--accent);
  font-variant-numeric: tabular-nums; margin: 2px 0 4px;
}
.dialog .dialog-hinweis { color: var(--muted); font-size: 0.9rem; margin: 0 0 18px; }
.dialog .dialog-knoepfe { display: flex; flex-direction: column; gap: 10px; }
.dialog .dialog-knoepfe .knopf, .dialog .dialog-knoepfe button { width: 100%; }
