:root {
  --court: #8c1420;        /* SUTC-Bordeaux (Primärfarbe) */
  --court-dark: #6e0f18;   /* dunkles Bordeaux */
  --swoosh: #d62828;       /* Rot (Racket-Swoosh im Logo) */
  --accent: #e6b414;       /* Ballgelb */
  --accent-soft: #f7e9c2;  /* helles Gelb */
  --tint: #fbeef0;         /* sehr helles Bordeaux (Flächen/Hover) */
  --bg: #f6f4f4;
  --card: #ffffff;
  --text: #26202a;
  --muted: #75696d;
  --danger: #b71c1c;
  --ok: #2e7d4f;
  --radius: 16px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: #fff;
  color: var(--text);
  border-bottom: 3px solid var(--court);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 1.15rem; margin: 0; font-weight: 700; color: var(--court); }
.brand .logo { height: 40px; width: auto; display: block; }
.ball { font-size: 1.5rem; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-actions .who { font-size: .85rem; color: var(--muted); }

/* ---------- Layout ---------- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px 64px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 16px;
}
.section-head h2 { margin: 0; font-size: 1.25rem; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s ease, background .15s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--court); color: #fff; }
.btn.primary:hover { background: var(--court-dark); }
.btn.court   { background: var(--court-dark); color: #fff; }
.btn.ball    { background: var(--accent); color: #3a2f00; }
.btn.ghost   { background: transparent; color: var(--court); border: 1px solid #d9cccd; }
.btn.ghost.dark { border-color: #d9cccd; color: var(--text); }
.btn.danger  { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 7px 14px; font-size: .85rem; }
.btn.block { width: 100%; }

/* ---------- Cards / Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.card .photo {
  aspect-ratio: 4 / 3;
  background: #f1e9ea center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; color: #c6a9ad;
}
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .body h3 { margin: 0; font-size: 1.05rem; }
.card .desc { color: var(--muted); font-size: .9rem; margin: 0; flex: 1; }

.badge {
  align-self: flex-start;
  font-size: .78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.badge.free { background: #e3f4ea; color: var(--ok); }
.badge.out  { background: #fdeaea; color: var(--danger); }
.loan-info { font-size: .82rem; color: var(--muted); }
.loan-info b { color: var(--text); }
.card-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ---------- Auth / Forms ---------- */
.auth-wrap { max-width: 380px; margin: 6vh auto 0; }
.auth-logo { display: block; width: min(280px, 78%); margin: 0 auto 22px; }
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.panel h2 { margin-top: 0; }
label { display: block; font-size: .85rem; font-weight: 600; margin: 12px 0 4px; }
input, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #e2d7d8;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
input:focus, textarea:focus { outline: 2px solid var(--court); border-color: var(--court); }
.switch-link { text-align: center; margin-top: 14px; font-size: .9rem; color: var(--muted); }

/* ---------- PWA-Install ---------- */
.install-area { margin-top: 16px; }
.install-area:empty { margin-top: 0; }
.install-hint {
  background: var(--tint);
  border: 1px dashed #e6c9cd;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .88rem;
  color: var(--text);
  line-height: 1.5;
}
.install-hint b { color: var(--court-dark); }
.ios-share { font-size: 1rem; }
.switch-link a { color: var(--court-dark); font-weight: 600; cursor: pointer; text-decoration: underline; }
.form-error { color: var(--danger); font-size: .88rem; margin: 10px 0 0; min-height: 1.1em; }
.tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.tabs button {
  flex: 1; padding: 10px; border: none; border-radius: 12px; cursor: pointer;
  font-weight: 600; background: #f1e9ea; color: var(--muted);
}
.tabs button.active { background: var(--court); color: #fff; }

/* ---------- Dialog ---------- */
dialog {
  border: none; border-radius: var(--radius); padding: 22px;
  max-width: 420px; width: 92%; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ---------- Admin add form ---------- */
.admin-add { margin-bottom: 22px; }
.photo-pick { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.photo-preview {
  width: 64px; height: 64px; border-radius: 12px; background: #f1e9ea center/cover;
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #c6a9ad;
}

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.hidden { display: none !important; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty .ball { font-size: 2.4rem; display: block; margin-bottom: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--court-dark); color: #fff; padding: 12px 20px;
  border-radius: 999px; box-shadow: var(--shadow); font-weight: 600;
  z-index: 100; max-width: 90%;
}
.toast.err { background: var(--danger); }
