:root {
  --c-bg:        #F7F6F2;
  --c-surface:   #FFFFFF;
  --c-border:    #E2E0D8;
  --c-muted:     #A09E96;
  --c-text:      #1A1916;
  --c-sub:       #5A5854;
  --c-accent:    #2B6CB0;
  --c-accent-bg: #EBF2FA;
  --c-accent-t:  #1A4A80;
  --c-green:     #276749;
  --c-green-bg:  #EAF5EE;
  --c-green-t:   #1A4A30;
  --c-yellow:    #92600A;
  --c-yellow-bg: #FEF3DC;
  --c-red:       #9B1C1C;
  --c-red-bg:    #FDEAEA;
  --c-brand:     #1A1916;
  --c-purple:    #553C9A;
  --c-purple-bg: #F0EBFF;
  --radius-sm:   8px;
  --radius-md:   12px;
  --shadow:      0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-shell {
  width: 100%;
  margin: 0 auto;
  background: var(--c-bg);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100vh;
}

a { color: inherit; }

/* Topbar */
.topbar {
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  padding: 14px 16px 12px; display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-back { font-size: 22px; color: var(--c-accent); cursor: pointer; background: none; border: none; padding: 0; line-height: 1; margin-right: 2px; text-decoration: none; }
.topbar-content { flex: 1; min-width: 0; }
.topbar-title { font-size: 16px; font-weight: 600; color: var(--c-text); line-height: 1.2; }
.topbar-sub { font-size: 12px; color: var(--c-sub); margin-top: 1px; }
.topbar-logo { font-size: 20px; text-decoration: none; }

/* Content */
.content { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }

/* Cards */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-md); padding: 14px 16px; box-shadow: var(--shadow); }
.event-strip .meta-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--c-sub); padding: 3px 0; }
.event-strip .meta-row .icon { font-size: 15px; width: 18px; text-align: center; }

.share-strip { background: var(--c-accent-bg); border: 1px solid #C3D9F0; border-radius: var(--radius-md); padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.share-strip span { font-size: 13px; color: var(--c-accent-t); flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-btn { font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 20px; background: var(--c-accent); color: #fff; border: none; cursor: pointer; white-space: nowrap; }

.section-label { font-size: 11px; font-weight: 600; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.07em; padding: 4px 4px 2px; }

.fahrt-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-md); padding: 14px 16px; box-shadow: var(--shadow); }
.fahrt-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--c-accent-bg); color: var(--c-accent-t); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.avatar.g { background: var(--c-green-bg); color: var(--c-green-t); }
.avatar.y { background: var(--c-yellow-bg); color: var(--c-yellow); }
.avatar.p { background: var(--c-purple-bg); color: var(--c-purple); }
.fahrt-name { font-size: 14px; font-weight: 600; color: var(--c-text); }
.fahrt-meta { font-size: 12px; color: var(--c-sub); margin-top: 1px; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.badge-green  { background: var(--c-green-bg);  color: var(--c-green); }
.badge-yellow { background: var(--c-yellow-bg); color: var(--c-yellow); }
.badge-red    { background: var(--c-red-bg);    color: var(--c-red); }
.badge-gray   { background: #F0EEE9; color: var(--c-sub); border: 1px solid var(--c-border); }

.seats-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.seat-chip { font-size: 12px; padding: 4px 11px; border-radius: 20px; background: #E8E6E0; color: var(--c-text); border: 1px solid var(--c-border); font-weight: 500; }
.seat-chip.empty { border-style: dashed; color: var(--c-muted); background: transparent; font-weight: 400; }

.btn { display: block; width: 100%; padding: 11px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; border: none; transition: opacity 0.15s; text-decoration: none; }
.btn:active { opacity: 0.8; }
.btn-primary   { background: var(--c-accent); color: #fff; }
.btn-secondary { background: transparent; color: var(--c-accent); border: 1.5px solid var(--c-accent); }
.btn-danger    { background: transparent; color: var(--c-red); border: 1.5px solid var(--c-red); }
.btn-brand     { background: var(--c-brand); color: #fff; }
.btn-disabled  { background: #E8E6E0; color: var(--c-muted); cursor: default; }
.btn-sm { padding: 7px 12px; font-size: 12px; width: auto; display: inline-block; }

.add-fahrt { background: transparent; border: 1.5px dashed var(--c-border); border-radius: var(--radius-md); padding: 14px 16px; display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--c-accent); font-size: 14px; font-weight: 500; text-decoration: none; }
.add-fahrt .plus { width: 32px; height: 32px; border-radius: 50%; background: var(--c-accent-bg); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--c-accent); flex-shrink: 0; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--c-text); }
.form-hint  { font-size: 12px; color: var(--c-muted); }
.form-input, .form-textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--c-text);
  background: var(--c-surface); outline: none; font-family: inherit; transition: border-color 0.15s;
}
.form-input:focus, .form-textarea:focus { border-color: var(--c-accent); }
.form-textarea { resize: vertical; min-height: 72px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plaetze-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.plaetze-btn { width: 44px; height: 44px; border-radius: var(--radius-sm); border: 1.5px solid var(--c-border); background: var(--c-surface); font-size: 16px; font-weight: 600; color: var(--c-sub); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.12s; }
.plaetze-btn.sel { background: var(--c-accent); color: #fff; border-color: var(--c-accent); }
.check-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--c-surface); border: 1.5px solid var(--c-border); border-radius: var(--radius-sm); cursor: pointer; }
.check-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--c-accent); cursor: pointer; flex-shrink: 0; }
.check-row label { font-size: 14px; color: var(--c-text); cursor: pointer; }
.field-error { font-size: 12px; color: var(--c-red); }

.magic-info { background: var(--c-accent-bg); border: 1px solid #C3D9F0; border-radius: var(--radius-md); padding: 14px 16px; display: flex; gap: 10px; align-items: flex-start; }
.magic-info .icon { font-size: 20px; flex-shrink: 0; }
.magic-info p { font-size: 13px; color: var(--c-accent-t); line-height: 1.5; }

.confirm-box { text-align: center; padding: 28px 16px; }
.confirm-icon { font-size: 48px; margin-bottom: 12px; }
.confirm-title { font-size: 20px; font-weight: 700; color: var(--c-text); margin-bottom: 8px; }
.confirm-sub { font-size: 14px; color: var(--c-sub); line-height: 1.6; margin-bottom: 20px; }

.info-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--c-border); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--c-muted); font-weight: 500; flex-shrink: 0; }
.info-value { color: var(--c-text); font-weight: 500; text-align: right; }
.divider { height: 1px; background: var(--c-border); margin: 4px 0; }
.warn-box { background: var(--c-red-bg); border: 1px solid #F5C0C0; border-radius: var(--radius-md); padding: 14px 16px; font-size: 13px; color: var(--c-red); line-height: 1.5; }

/* KPI Strip */
.kpi-hidden { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.kpi-visible { opacity: 1; transform: translateY(0); }
.kpi-strip {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 1px; background: var(--c-border);
  border: 1px solid var(--c-border); border-radius: var(--radius-md);
  overflow: hidden; margin: 0 16px 20px;
}
.kpi-cell { background: var(--c-surface); padding: 14px 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.kpi-num { font-size: 24px; font-weight: 800; color: var(--c-text); line-height: 1; letter-spacing: -0.03em; }
.kpi-label { font-size: 10px; color: var(--c-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-trend { font-size: 11px; color: var(--c-green); font-weight: 600; }

/* Landing */
.landing-hero { padding: 28px 20px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.logo-mark { font-size: 44px; margin-bottom: 12px; display: block; }
.landing-title { font-size: 27px; font-weight: 800; color: var(--c-text); line-height: 1.15; margin-bottom: 8px; }
.landing-sub { font-size: 14px; color: var(--c-sub); line-height: 1.6; margin-bottom: 20px; }
.landing-steps { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 16px; text-align: left; width: 100%; }
.step-row { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--c-border); }
.step-row:last-child { border-bottom: none; }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--c-brand); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.step-text { font-size: 13px; color: var(--c-text); line-height: 1.5; }
.step-text strong { font-weight: 600; }

.event-link-form { display: none; flex-direction: column; gap: 8px; width: 100%; margin-top: 10px; }
.event-link-form.visible { display: flex; }

/* Footer / Coffee */
.coffee-strip { font-size: 12px; color: var(--c-muted); text-align: center; padding: 10px 16px; border-top: 1px solid var(--c-border); background: var(--c-surface); }
.coffee-strip a { color: var(--c-accent); text-decoration: none; }
.footer-links { display: flex; justify-content: center; gap: 12px; font-size: 11px; padding: 8px 16px; background: var(--c-surface); border-top: 1px solid var(--c-border); }
.footer-links a { color: var(--c-muted); text-decoration: none; }
.footer-version { font-size: 10px; color: #CCC; text-align: center; padding: 4px 16px 8px; background: var(--c-surface); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; background: var(--c-surface); border-top: 1px solid var(--c-border); }
.footer-bottom .footer-links { border: none; padding: 0; background: none; gap: 10px; }
.footer-bottom .footer-version { padding: 0; background: none; white-space: nowrap; }

/* Static pages */
.static-content { padding: 16px; font-size: 13px; color: var(--c-sub); line-height: 1.7; display: flex; flex-direction: column; gap: 12px; }
.static-content h2 { font-size: 15px; font-weight: 700; color: var(--c-text); margin-top: 4px; }
.static-content p { margin: 0; }
.hcaptcha-mock { background: var(--c-bg); border: 1.5px solid var(--c-border); border-radius: var(--radius-sm); padding: 14px 16px; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--c-sub); }
.hcaptcha-mock .hc-box { width: 24px; height: 24px; border: 2px solid var(--c-border); border-radius: 4px; flex-shrink: 0; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; }

/* Superadmin */
.admin-topbar { background: var(--c-brand); padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.admin-topbar-title { font-size: 15px; font-weight: 600; color: #fff; }
.admin-topbar-sub { font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 1px; }
.admin-content { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: #F0EEE8; }
.admin-section { font-size: 10px; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.08em; padding: 4px 2px 2px; }
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-md); padding: 14px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.kpi-card-num { font-size: 28px; font-weight: 800; color: var(--c-text); line-height: 1; letter-spacing: -0.03em; }
.kpi-card-label { font-size: 11px; color: var(--c-muted); font-weight: 500; }
.kpi-card-trend { font-size: 11px; font-weight: 600; }
.trend-up   { color: var(--c-green); }
.trend-down { color: var(--c-red); }
.chart-bar-wrap { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-md); padding: 14px 16px; box-shadow: var(--shadow); }
.chart-title { font-size: 13px; font-weight: 600; color: var(--c-text); margin-bottom: 12px; }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 64px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; }
.bar { width: 100%; border-radius: 3px 3px 0 0; background: var(--c-accent); opacity: 0.7; transition: opacity 0.15s; min-height: 3px; }
.bar:hover { opacity: 1; }
.bar-label { font-size: 9px; color: var(--c-muted); white-space: nowrap; }
.admin-table { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow); }
.admin-table-head { display: grid; grid-template-columns: 1fr 80px 60px; padding: 8px 12px; background: #F7F6F2; border-bottom: 1px solid var(--c-border); }
.admin-table-head span { font-size: 10px; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.admin-table-row { display: grid; grid-template-columns: 1fr 80px 60px; padding: 10px 12px; border-bottom: 1px solid var(--c-border); align-items: center; }
.admin-table-row:last-child { border-bottom: none; }
.admin-table-row span { font-size: 12px; color: var(--c-text); }
.admin-table-row .sub { font-size: 11px; color: var(--c-muted); }
.pill { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.pill-green  { background: var(--c-green-bg); color: var(--c-green); }
.pill-gray   { background: #EEE; color: var(--c-muted); }
.pill-daily  { background: var(--c-green-bg); color: var(--c-green); }
.pill-weekly { background: var(--c-accent-bg); color: var(--c-accent); }
.pill-monthly{ background: var(--c-yellow-bg); color: var(--c-yellow); }
.pill-yearly { background: var(--c-purple-bg); color: var(--c-purple); }
.backup-row { display: grid; grid-template-columns: 1fr 70px 50px 32px; padding: 10px 12px; border-bottom: 1px solid var(--c-border); align-items: center; gap: 4px; }
.backup-row:last-child { border-bottom: none; }
.backup-row span { font-size: 12px; color: var(--c-text); }
.backup-row .sub { font-size: 11px; color: var(--c-muted); }
.pin-btn { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--c-border); background: var(--c-bg); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pin-btn.pinned { background: var(--c-yellow-bg); border-color: var(--c-yellow); }
.admin-actions { display: flex; gap: 8px; }
.admin-login { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; padding: 32px 24px; gap: 16px; }
.admin-login-title { font-size: 20px; font-weight: 700; color: var(--c-text); }
.admin-login-sub { font-size: 13px; color: var(--c-muted); text-align: center; }
.cron-log { font-size: 11px; font-family: monospace; color: #a8ff78; line-height: 1.8; background: #1A1916; border: none; white-space: pre-wrap; word-break: break-word; }
.logout-btn { margin-left: auto; background: rgba(255,255,255,0.15); border: none; color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; }

.alert { border-radius: var(--radius-md); padding: 12px 14px; font-size: 13px; line-height: 1.5; }
.alert-error { background: var(--c-red-bg); color: var(--c-red); border: 1px solid #F5C0C0; }
.alert-success { background: var(--c-green-bg); color: var(--c-green); border: 1px solid #B9DEC5; }

@media (min-width: 480px) {
  body { background: #D4D0C8; align-items: center; padding: 32px 16px 48px; }
  .app-shell { max-width: 420px; min-height: auto; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow-md); }
}
