/* Schreibschrift für den Slogan (lokal, SIL Open Font License – siehe fonts/OFL.txt) */
@font-face {
  font-family: 'Great Vibes';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/great-vibes-latin.woff2) format('woff2');
}

:root {
  --bg: #1b1d1e;
  --surface: #25282a;
  --surface-2: #2e3235;
  --border: #3a3f42;
  --text: #eceeef;
  --muted: #9aa2a7;
  --brand: #4c9a2a;
  --brand-hover: #57ab32;
  --brand-text: #6cc045;
  --danger: #c0392b;
  --danger-hover: #d2463a;
  --neutral: #5d6366;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font: inherit; color: inherit; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
  background: linear-gradient(100deg, rgba(20, 36, 26, 0.94), rgba(27, 29, 30, 0.94) 60%, rgba(31, 58, 30, 0.94));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  color: var(--brand-text);
  text-decoration: none;
}

.brand img {
  height: 44px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
.brand span:last-child { color: #fff; }

/* ---------- Großer Header (Startseite) ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 16px 34px;
  background: linear-gradient(180deg, #1a2a1d 0%, #16201a 55%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.5vw, 16px);
  text-decoration: none;
}
.hero-word {
  font-size: clamp(1.9rem, 9vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
.hero-word.is-green { color: var(--brand-text); }
.hero-brand img {
  height: clamp(70px, 21vw, 104px);
  width: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55));
}
.hero-slogan {
  position: relative;
  margin: 6px 0 0;
  font-family: 'Great Vibes', 'Segoe Script', 'Brush Script MT', cursive;
  font-size: clamp(1.35rem, 6vw, 1.9rem);
  line-height: 1.2;
  color: #e6ecdf;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
.hero-logout { position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); right: 8px; color: #e6ecdf; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 24px; height: 24px; }

/* ---------- Layout ---------- */
.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px calc(32px + var(--safe-bottom));
}
.page.has-actionbar { padding-bottom: calc(110px + var(--safe-bottom)); }

.page-title {
  margin: 4px 0 18px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--brand-text);
}

.subtitle { margin: -12px 0 18px; color: var(--muted); font-size: 0.95rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.section-label {
  margin: 22px 0 10px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer { margin-top: 28px; text-align: center; font-size: 0.8rem; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.9rem; }

/* ---------- Menü ---------- */
.greeting {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  margin: 4px 0 20px;
}
.greeting .avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3f9a35, #23692a);
  color: #f2f5f0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.greeting .avatar svg { width: 32px; height: 32px; }
.greeting-text { flex: 1; min-width: 0; }
.greeting-hello { margin: 0; font-size: 1.6rem; line-height: 1.15; font-weight: 300; color: var(--text); }
.greeting-hello strong { font-weight: 800; }
.greeting-sub { margin: 4px 0 0; color: var(--muted); }
.role-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid;
}
.role-pill .ico svg { display: block; width: 18px; height: 18px; }
.role-pill.is-spiess { background: rgba(46, 125, 50, 0.22); border-color: rgba(76, 154, 42, 0.55); color: #e8f3e2; }
.role-pill.is-spiess .ico { color: #e8f3e2; }
.role-pill.is-admin { background: rgba(52, 84, 110, 0.25); border-color: rgba(98, 140, 175, 0.45); color: #9cc8ec; }

.menu { display: grid; gap: 12px; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--brand);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.menu-item:active { background: var(--surface-2); }
.menu-item.is-alert { border-left-color: var(--danger); }
.menu-item.is-admin { border-left-color: var(--neutral); }
.menu-item .menu-icon { font-size: 1.4rem; width: 28px; text-align: center; }
.menu-item .menu-text { flex: 1; }
.menu-item .chevron { color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 13px;
  background: var(--neutral);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}
.badge.is-alert { background: var(--danger); }
.badge.is-brand { background: var(--brand); }

/* ---------- Formulare ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 0.9rem; font-weight: 600; color: var(--muted); }

.input, .select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(76, 154, 42, 0.25); }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%239aa2a7' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.switch input { width: 52px; height: 30px; appearance: none; -webkit-appearance: none; background: var(--neutral); border-radius: 15px; position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(22px); }

/* ---------- Personen-Chips ---------- */
.chip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip .tick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex-shrink: 0;
  border: 2px solid var(--muted); border-radius: 6px;
}
.chip.is-checked { border-color: var(--brand); background: rgba(76, 154, 42, 0.14); }
.chip.is-checked .tick { background: var(--brand); border-color: var(--brand); }
.chip.is-checked .tick::after { content: "✓"; color: #fff; font-size: 14px; font-weight: 800; }

.link-btn { background: none; border: 0; padding: 0; color: var(--brand-text); font-weight: 600; cursor: pointer; }

/* ---------- Segment-Schalter ---------- */
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 14px; }
.segmented button { min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.segmented button.is-active { background: var(--brand); color: #fff; }

/* ---------- Listen ---------- */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .meta { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.list-item .amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list-item .rank { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface-2); font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
.list-item .rank.top { background: var(--brand); color: #fff; }
.list-item.is-selectable { cursor: pointer; }
.list-item.is-selected { background: rgba(76, 154, 42, 0.12); }
.list-item .meta-line { display: block; }
.del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(192, 57, 43, 0.45);
  border-radius: 10px;
  background: rgba(192, 57, 43, 0.12);
  color: #e57366;
  cursor: pointer;
}
.del-btn:active { background: rgba(192, 57, 43, 0.3); }
.del-btn:disabled { opacity: 0.5; }
.del-btn svg { width: 18px; height: 18px; }
.list-total { display: flex; justify-content: space-between; padding: 14px 16px; background: var(--surface-2); font-weight: 700; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 0.75rem; font-weight: 600; margin-left: 6px; vertical-align: middle; }
.tag.is-brand { background: rgba(76, 154, 42, 0.2); color: var(--brand-text); }

.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.hint { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: 0.9rem; margin-bottom: 14px; }

/* ---------- Aktionsleiste unten ---------- */
.actionbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: rgba(27, 29, 30, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}
.actionbar .inner { max-width: 520px; margin: 0 auto; display: flex; gap: 10px; }
.actionbar .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 30;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-success { border-color: var(--brand); }
.toast.is-error { border-color: var(--danger); }

/* ---------- Login ---------- */
.login-hero { text-align: center; margin: 28px 0 24px; }
.login-hero img { width: 96px; height: 96px; border-radius: 20px; background: #fff; object-fit: cover; box-shadow: var(--shadow); }
.login-hero h1 { margin: 16px 0 4px; font-size: 2rem; font-weight: 800; color: var(--brand-text); letter-spacing: -0.02em; }
.login-hero p { margin: 0; color: var(--muted); }

[hidden] { display: none !important; }
