*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface2: #f0f0f2;
  --border: #e0e0e5;
  --primary: #1a1a2e;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --brand-red: #e11d2e;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --text: #111827;
  --text-muted: #6b7280;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Layout ── */
#app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--primary);
  color: #fff;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand { font-family: Georgia, 'Times New Roman', serif; font-size: 22px; letter-spacing: -.5px; line-height: 1; display: flex; flex-direction: column; gap: 1px; }
.topbar-verein { font-family: system-ui, sans-serif; font-size: 10px; color: #94a3b8; letter-spacing: .02em; font-weight: 400; }
.topbar-brand .red { color: var(--brand-red); font-weight: 700; }
.topbar-brand .omat-topbar { color: #fff; font-weight: 300; }
.auth-logo h1 { font-family: Georgia, 'Times New Roman', serif; font-size: 42px; letter-spacing: -1px; font-weight: 400; }
.auth-logo h1 .red { color: var(--brand-red); font-weight: 700; }
.auth-logo h1 .omat-login { color: #1a1a2e; font-weight: 300; }
.auth-logo .wordmark-accent { display: block; width: 56px; height: 3px; background: var(--brand-red); border-radius: 2px; margin-top: 4px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.topbar-user { font-size: 13px; color: #94a3b8; }

.main { flex: 1; padding: 24px 20px; max-width: 640px; margin: 0 auto; width: 100%; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--primary);
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -14px;
  margin-bottom: 20px;
}

/* ── Auth ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo h1 { font-size: 26px; font-weight: 800; color: var(--primary); }
.auth-logo h1 span { color: var(--accent); }
.auth-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.auth-verein { font-size: 14px !important; font-weight: 600; color: var(--brand-red) !important; margin-top: 6px !important; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .9; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-full { width: 100%; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; line-height: 1; }

/* ── Navigation (bottom) ── */
.bottom-nav {
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  position: sticky;
  bottom: 0;
  z-index: 100;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px 12px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  transition: color .15s;
}
.nav-item.active { color: var(--accent); }
.nav-item svg { width: 22px; height: 22px; }

/* ── Receipt list ── */
.receipt-item {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.receipt-item:hover { border-color: var(--accent); background: #fafafe; }
.receipt-item-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.receipt-item-title { font-weight: 600; font-size: 15px; }
.receipt-item-amount { font-weight: 700; color: var(--accent); font-size: 16px; }
.receipt-item-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Badge / Status ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-paid { background: #dcfce7; color: #166534; }
.badge-new { background: var(--accent-light); color: var(--accent); }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.stat-value { font-size: 28px; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ── Toggle buttons ── */
.toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.toggle-btn {
  flex: 1;
  min-width: 48px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.toggle-btn:hover:not(.active) {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Photo upload ── */
.photo-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}
.photo-upload:hover { border-color: var(--accent); background: var(--accent-light); }
.photo-upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.photo-upload-icon { font-size: 22px; margin-bottom: 0; flex-shrink: 0; }
.photo-upload p { font-size: 13px; color: var(--text-muted); text-align: left; }
.photo-preview { width: auto; max-width: 100%; max-height: 72px; object-fit: cover; border-radius: var(--radius-sm); margin-top: 8px; display: none; }

/* ── Section heading ── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  margin-bottom: 8px;
  margin-top: 4px;
}
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Überweisung Toggle Card ── */
.ueberweisung-card {
  background: var(--accent-light);
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}
.ueberweisung-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: #cbd5e1;
  border-radius: 99px;
  cursor: pointer;
  transition: background .2s;
}
.slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* ── Empty state ── */
.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty svg { opacity: .3; margin-bottom: 12px; }
.empty p { font-size: 14px; }

/* ── Toast ── */
#toast-container { position: fixed; top: 70px; right: 16px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideIn .2s ease;
  max-width: 300px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 500; padding: 0;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 28px 24px 32px;
  width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 700; }

/* ── Cost preview ── */
.cost-preview {
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 16px 0;
}
.cost-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.cost-row:last-child { margin-bottom: 0; font-weight: 700; font-size: 16px; border-top: 1px solid #bfdbfe; padding-top: 8px; margin-top: 4px; }

/* ── Admin ── */
.admin-user-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.admin-user-info { display: flex; flex-direction: column; gap: 2px; }
.admin-user-name { font-weight: 600; }
.admin-user-meta { font-size: 12px; color: var(--text-muted); }

@media (max-width: 400px) {
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 28px 20px; }
}
