/* =========================================================================
   Ticketsystem Gymnasium Landsberg – Design-Fundament (Tokens + Komponenten)
   Gemeinsame Basis für Buchungsseite (app.css) und Admin-Portal (admin.css).
   Keine externen Abhängigkeiten. Mobile first.
   ========================================================================= */
:root {
  --c-primary: #00549f;
  --c-primary-dark: #003f78;
  --c-primary-soft: #e6f0f9;
  --c-accent: #f5a623;
  --c-accent-dark: #b36f00;
  --c-accent-soft: #fff4dd;
  --c-gold: #c9a227;
  --c-ink: #17202e;
  --c-text: #2a3444;
  --c-muted: #5d6878;
  --c-line: #dde3ec;
  --c-bg: #f3f5f9;
  --c-card: #ffffff;
  --c-ok: #1a7f43;
  --c-ok-soft: #e4f6ea;
  --c-warn: #9a5b00;
  --c-warn-soft: #fff3d6;
  --c-err: #b3261e;
  --c-err-soft: #fdeceb;
  --grad: linear-gradient(135deg, var(--c-primary) 0%, #2b6cb0 45%, var(--c-accent) 100%);
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --tap: 36px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  color: var(--c-text); background: var(--c-bg);
}
h1, h2, h3, h4 { color: var(--c-ink); line-height: 1.3; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.375rem; } h2 { font-size: 1.125rem; } h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
a { color: var(--c-primary); }
a:hover { color: var(--c-primary-dark); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--c-muted); }
.small { font-size: .8125rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.container--narrow { max-width: 760px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row--between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid--2 { grid-template-columns: 1fr 1fr; } .grid--3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Card ---------- */
.card { background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card--flush { padding: 0; overflow: hidden; }
.card__head { padding: 12px 16px; border-bottom: 1px solid var(--c-line); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.card__body { padding: 16px; }
@media (max-width: 480px) { .card, .card__body { padding: 16px; } .card--flush { padding: 0; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-size: .875rem; font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap;
  background: var(--c-primary); color: #fff; transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--c-primary-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .55; cursor: not-allowed; }
.btn--accent { background: var(--c-accent); color: #2b1d00; }
.btn--accent:hover { background: #e29510; color: #2b1d00; }
.btn--ghost { background: #fff; color: var(--c-primary); border-color: var(--c-line); }
.btn--ghost:hover { background: var(--c-primary-soft); color: var(--c-primary-dark); }
.btn--danger { background: var(--c-err); }
.btn--danger:hover { background: #8f1d17; }
.btn--danger-ghost { background: #fff; color: var(--c-err); border-color: #f1c4c0; }
.btn--danger-ghost:hover { background: var(--c-err-soft); color: var(--c-err); }
.btn--sm { min-height: 30px; padding: 4px 10px; font-size: .8125rem; }
.btn--lg { min-height: 42px; padding: 10px 20px; font-size: .9375rem; }
.btn--block { display: flex; width: 100%; }
.btn svg { width: 1.1em; height: 1.1em; flex: none; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 12px; }
.field > label, .label { display: block; font-weight: 550; font-size: .8125rem; color: var(--c-ink); margin-bottom: 4px; }
.field .hint { display: block; font-size: .82rem; color: var(--c-muted); margin-top: 4px; }
.field .error { display: block; font-size: .85rem; color: var(--c-err); margin-top: 4px; font-weight: 600; }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: 7px 10px; font: inherit; color: var(--c-ink);
  background: #fff; border: 1px solid #c9d1dc; border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(0, 84, 159, .2); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--c-err); box-shadow: 0 0 0 3px rgba(179, 38, 30, .12); }
.input--pin { font-family: var(--mono); font-size: 1.125rem; letter-spacing: .35em; text-align: center; max-width: 180px; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: var(--tap); padding: 8px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 3px 0 0; flex: none; accent-color: var(--c-primary); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; color: var(--c-ink); padding: 0; margin-bottom: 8px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 550; line-height: 1.5; background: #eef1f6; color: var(--c-text); white-space: nowrap; }
.badge--ok { background: var(--c-ok-soft); color: var(--c-ok); }
.badge--warn { background: var(--c-warn-soft); color: var(--c-warn); }
.badge--err { background: var(--c-err-soft); color: var(--c-err); }
.badge--info { background: var(--c-primary-soft); color: var(--c-primary-dark); }
.badge--vip { background: linear-gradient(135deg, #1b2233, #0d1220); color: #f3d98b; border: 1px solid #c9a227; letter-spacing: .06em; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 10px; padding: 10px 12px; font-size: .875rem; border-radius: var(--radius-sm); border: 1px solid var(--c-line); background: #fff; }
.alert--ok { background: var(--c-ok-soft); border-color: #b5e2c4; color: #0f5a2e; }
.alert--warn { background: var(--c-warn-soft); border-color: #f0d28a; color: #6b3f00; }
.alert--err { background: var(--c-err-soft); border-color: #f1c4c0; color: #8a1c16; }
.alert--info { background: var(--c-primary-soft); border-color: #bcd6ee; color: var(--c-primary-dark); }
.alert strong { color: inherit; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.table th, .table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--c-line); vertical-align: middle; }
.table th { font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); background: #f8fafc; white-space: nowrap; }
.table tbody tr:hover { background: #f8fafc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Progress ---------- */
.progress { height: 6px; background: #e7ebf1; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--c-primary); border-radius: 999px; transition: width .4s; }
.progress--ok > span { background: var(--c-ok); }
.progress--warn > span { background: var(--c-accent); }
.progress--err > span { background: var(--c-err); }

/* ---------- Modal (native <dialog>) ---------- */
dialog.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: var(--shadow-lg); color: var(--c-text); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .55); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--c-line); }
.modal__head h2, .modal__head h3 { margin: 0; }
.modal__body { padding: 16px; overflow: auto; }
.modal__foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--c-line); background: #f8fafc; }
.modal__close { background: none; border: 0; font-size: 1.6rem; line-height: 1; width: var(--tap); height: var(--tap); border-radius: 50%; cursor: pointer; color: var(--c-muted); }
.modal__close:hover { background: #eef1f6; }

/* ---------- Misc ---------- */
.divider { border: 0; border-top: 1px solid var(--c-line); margin: 20px 0; }
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--c-muted); font-size: .8125rem; }
.kv dd { margin: 0; font-weight: 500; color: var(--c-ink); overflow-wrap: anywhere; }
.brandbar { height: 3px; background: var(--grad); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print { .no-print { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }

/* ---------- Touch-Geraete: groessere Bedienflaechen, 16px in Feldern (kein iOS-Zoom) ---------- */
@media (pointer: coarse) {
  :root { --tap: 44px; }
  .input, .select, .textarea { font-size: 16px; }
  .btn--sm { min-height: 36px; }
  .check input { width: 20px; height: 20px; margin-top: 1px; }
}
