/* Ticket App – Apple-inspiriertes Design. Kein Build-Schritt nötig. */

:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --sep: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --accent-text: #0066cc;
  --red: #ff3b30;
  --red-soft: rgba(255, 59, 48, 0.1);
  --green: #34c759;
  --green-soft: rgba(52, 199, 89, 0.14);
  --orange: #ff9500;
  --nav-bg: rgba(251, 251, 253, 0.72);
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.02), 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.03), 0 18px 50px rgba(0, 0, 0, 0.1);
  --radius: 18px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Inter, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --fill: rgba(120, 120, 128, 0.24);
    --fill-strong: rgba(120, 120, 128, 0.36);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #6e6e73;
    --sep: rgba(255, 255, 255, 0.1);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --accent-text: #409cff;
    --red: #ff453a;
    --red-soft: rgba(255, 69, 58, 0.16);
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, 0.16);
    --orange: #ff9f0a;
    --nav-bg: rgba(22, 22, 23, 0.72);
    --shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.6);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; letter-spacing: -0.03em; line-height: 1.1; }
h1 { font-size: clamp(32px, 5vw, 48px); font-weight: 700; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 14px; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); letter-spacing: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; border-radius: 8px; }

/* ── Navigation (Milchglas) ─────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--sep);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto; height: 52px;
  padding: 0 max(22px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; font-size: 18px; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-icon {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(160deg, #3b9bff, #0058d6); color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.brand-icon svg { width: 17px; height: 17px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a, .nav-links button {
  font: inherit; font-size: 14px; letter-spacing: -0.01em; color: var(--text);
  background: none; border: 0; cursor: pointer;
  padding: 6px 12px; border-radius: 980px; opacity: 0.85;
}
.nav-links a:hover, .nav-links button:hover { background: var(--fill); text-decoration: none; opacity: 1; }
.nav-links a.active { background: var(--fill); opacity: 1; font-weight: 500; }
.nav-links form { margin: 0; }

/* ── Layout ─────────────────────────────────────────────── */
.container { max-width: 1180px; margin: 0 auto; padding: 36px max(22px, env(safe-area-inset-left)) 80px; }
.container.narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; letter-spacing: -0.01em; }
.stack > * + * { margin-top: 24px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ── Karten ─────────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-body { padding: 24px 26px; }
.card-head { padding: 20px 26px 0; }
.card-head p { margin-top: 4px; }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; color: var(--text-2); margin: 0 0 10px 16px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
  min-height: 38px; padding: 8px 18px; border-radius: 980px; border: 0;
  cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background-color 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--fill); color: var(--text); }
.btn-secondary:hover { background: var(--fill-strong); }
.btn-plain { background: none; color: var(--accent-text); padding-inline: 10px; }
.btn-plain:hover { background: var(--accent-soft); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-lg { min-height: 50px; font-size: 17px; padding: 12px 28px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }

.segmented { display: inline-flex; background: var(--fill); border-radius: 980px; padding: 3px; }
.segmented a {
  display: grid; place-items: center; min-width: 34px; height: 32px; padding: 0 12px;
  border-radius: 980px; color: var(--text); font-size: 15px; font-weight: 500;
}
.segmented a:hover { background: var(--surface); text-decoration: none; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.segmented svg { width: 16px; height: 16px; }

/* ── Formulare ──────────────────────────────────────────── */
.field { display: block; }
.field + .field, .field + .field-row, .field-row + .field, .field-row + .field-row { margin-top: 18px; }
.field-row > .field + .field { margin-top: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.label { display: block; font-size: 14px; font-weight: 500; color: var(--text-2); margin: 0 0 7px 2px; letter-spacing: -0.01em; }
.label .opt { font-weight: 400; color: var(--text-3); }
.input, textarea.input, select.input {
  -webkit-appearance: none; appearance: none; width: 100%;
  font: inherit; font-size: 17px; color: var(--text);
  background: var(--surface); border: 1px solid var(--fill-strong); border-radius: var(--radius-sm);
  padding: 12px 14px; min-height: 48px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.45; }
.input-code { font-family: var(--mono); font-size: 26px; letter-spacing: 0.35em; text-align: center; }
.input.is-invalid { border-color: var(--red); }
.error { color: var(--red); font-size: 14px; margin: 7px 0 0 2px; }
.hint { color: var(--text-2); font-size: 14px; margin: 7px 0 0 2px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 28px; flex-wrap: wrap; }

/* iOS-Schalter */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; padding: 4px 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; flex: none; width: 51px; height: 31px; border-radius: 31px;
  background: var(--fill-strong); transition: background 0.2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.4, 1);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--accent-soft); }

/* Datei-Ablage */
.dropzone {
  position: relative; display: block; text-align: center; cursor: pointer;
  border: 2px dashed var(--fill-strong); border-radius: var(--radius);
  padding: 30px 20px; background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone-icon { width: 46px; height: 46px; margin: 0 auto 10px; color: var(--accent); }
.dropzone-title { font-weight: 600; }
.dropzone-files { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.dropzone-files li { font-size: 14px; background: var(--surface); padding: 5px 12px; border-radius: 980px; box-shadow: var(--shadow); }

/* ── Hinweise ───────────────────────────────────────────── */
.flash {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 12px 18px; margin: 0 auto 24px; width: fit-content; max-width: 100%;
  font-size: 15px; font-weight: 500;
  animation: flash-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.flash .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; flex: none; }
.flash .dot svg { width: 13px; height: 13px; }
.flash.is-hiding { opacity: 0; transform: translateY(-8px); transition: 0.3s; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } }
.alert { border-radius: var(--radius-sm); padding: 12px 16px; font-size: 15px; }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-info { background: var(--accent-soft); color: var(--accent-text); }

/* ── Kalender ───────────────────────────────────────────── */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.cal-title { font-size: clamp(30px, 4.5vw, 44px); font-weight: 700; }
.cal-title span { font-weight: 400; color: var(--red); }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays div { padding: 12px 10px 8px; font-size: 13px; font-weight: 600; color: var(--text-2); text-align: right; }
.cal-grid { gap: 1px; background: var(--sep); border-top: 1px solid var(--sep); }
.cal-day { background: var(--surface); min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; container-type: inline-size; }
.cal-layout > * { min-width: 0; }
.cal-day.is-weekend { background: color-mix(in srgb, var(--surface) 96%, var(--text) 4%); }
.cal-day.is-outside .cal-daynum { color: var(--text-3); }
.cal-daynum {
  align-self: flex-end; display: grid; place-items: center;
  min-width: 28px; height: 28px; padding: 0 6px; border-radius: 980px;
  font-size: 15px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums;
}
.cal-daynum:hover { background: var(--fill); text-decoration: none; }
.cal-day.is-today .cal-daynum { background: var(--red); color: #fff; font-weight: 600; }
.cal-events { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chip {
  display: flex; align-items: center; gap: 5px; min-width: 0;
  font-size: 12.5px; line-height: 1.3; letter-spacing: -0.01em;
  padding: 3px 6px; border-radius: 6px; color: var(--text);
}
.chip:hover { background: var(--fill); text-decoration: none; }
.chip-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.chip-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-time { flex: none; color: var(--text-2); font-variant-numeric: tabular-nums; }
.chip.is-allday { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.chip.is-allday .chip-dot { display: none; }
.chip-ticket { flex: none; width: 13px; height: 13px; color: var(--accent); }
.chip.is-allday .chip-ticket { color: inherit; }
@container (max-width: 150px) { .chip-time { display: none; } }
.cal-more { font-size: 12px; color: var(--text-2); padding: 0 6px; }

/* Liste "Demnächst" */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 18px; color: var(--text);
  position: relative;
}
.list-item + .list-item::before { content: ""; position: absolute; top: 0; left: 76px; right: 0; border-top: 1px solid var(--sep); }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.datebadge {
  flex: none; width: 46px; text-align: center; border-radius: 11px; overflow: hidden;
  background: var(--surface-2); line-height: 1;
}
.datebadge .m { display: block; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; text-transform: uppercase; padding: 3px 0; letter-spacing: 0.04em; }
.datebadge .d { display: block; font-size: 21px; font-weight: 600; padding: 5px 0 6px; font-variant-numeric: tabular-nums; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { flex: none; width: 8px; color: var(--text-3); }
.empty { text-align: center; padding: 38px 24px; color: var(--text-2); }
.empty svg { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--text-3); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600;
  padding: 3px 10px; border-radius: 980px; background: var(--accent-soft); color: var(--accent-text);
}
.badge svg { width: 13px; height: 13px; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-gray { background: var(--fill); color: var(--text-2); }

/* ── Event-Detail ───────────────────────────────────────── */
.event-hero { padding: 30px 30px 26px; }
.event-hero h1 { font-size: clamp(28px, 4vw, 40px); }
.meta { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.meta-row { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 16px; }
.meta-row svg { width: 18px; height: 18px; flex: none; margin-top: 3px; color: var(--text-3); }
.notes { white-space: pre-wrap; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--sep); color: var(--text); font-size: 16px; }

.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.ticket-card { display: flex; flex-direction: column; }
.ticket-preview {
  position: relative; display: block; aspect-ratio: 1 / 1.1; background: var(--surface-2);
  border-bottom: 1px solid var(--sep);
}
.ticket-preview iframe, .ticket-preview img { width: 100%; height: 100%; border: 0; object-fit: contain; background: #fff; }
.ticket-preview .wallet {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
  background: linear-gradient(160deg, #1d1d1f, #3a3a3c); color: #fff;
}
.ticket-preview .wallet svg { width: 54px; height: 54px; margin: 0 auto 12px; }
.ticket-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.ticket-label { font-weight: 600; font-size: 17px; word-break: break-word; }
.ticket-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ticket-actions .btn { min-height: 34px; padding: 6px 14px; font-size: 14px; }
.ticket-actions .btn-icon { width: 34px; padding: 0; }
details.rename summary { list-style: none; cursor: pointer; }
details.rename summary::-webkit-details-marker { display: none; }
details.rename form { display: flex; gap: 8px; margin-top: 10px; }
details.rename .input { min-height: 38px; padding: 7px 12px; font-size: 15px; }

/* ── Login ──────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 400px; text-align: center; }
.auth-logo {
  width: 76px; height: 76px; margin: 0 auto 22px; border-radius: 19px; display: grid; place-items: center;
  background: linear-gradient(160deg, #3b9bff, #0058d6); color: #fff;
  box-shadow: 0 10px 30px rgba(0, 88, 214, 0.35);
}
.auth-logo svg { width: 42px; height: 42px; }
.auth-card h1, .auth-title { font-size: 34px; margin-bottom: 26px; }
.auth-card .lead { color: var(--text-2); margin: 8px 0 30px; }
.auth-card form { text-align: left; }
.auth-card .card-body { padding: 28px; }
.auth-foot { margin-top: 22px; font-size: 13px; color: var(--text-3); }
.auth-card details { margin-top: 20px; text-align: center; }
.auth-card details summary { color: var(--accent-text); cursor: pointer; font-size: 15px; }

/* ── Einstellungen ──────────────────────────────────────── */
.settings-section + .settings-section { margin-top: 36px; }
.qr { background: #fff; padding: 14px; border-radius: 14px; width: fit-content; margin: 4px 0 16px; }
.qr svg { width: 180px; height: 180px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; background: var(--surface-2); padding: 16px 20px; border-radius: var(--radius-sm); font-family: var(--mono); font-size: 15px; }
.device-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); }
.device-icon svg { width: 22px; height: 22px; }
.list-item form { margin: 0; }

/* ── Responsiv ──────────────────────────────────────────── */
@media (max-width: 960px) {
  .cal-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .container { padding-top: 22px; }
  .nav-links a, .nav-links button { padding: 6px 9px; }
  .nav-links .hide-sm { display: none; }
  .brand-text { display: none; }
  .nav-links { gap: 0; }
  .nav-links a, .nav-links button { font-size: 14px; padding: 6px 8px; }
  .cal-weekdays div { text-align: center; padding: 10px 0 6px; font-size: 12px; }
  .cal-day { min-height: 62px; padding: 4px 2px; align-items: center; position: relative; }
  .cal-daynum::after { content: ""; position: absolute; inset: 0; }
  .cal-events { pointer-events: none; }
  .cal-daynum { align-self: center; font-size: 15px; min-width: 32px; height: 32px; }
  .cal-events { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 3px; }
  .cal-events .chip { padding: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
  .cal-events .chip > * { display: none; }
  .cal-events .chip.is-allday { background: var(--accent); }
  .cal-more { display: none; }
  .event-hero { padding: 24px 22px 22px; }
  .card-body { padding: 20px; }
  .card-head { padding: 18px 20px 0; }
  .tickets { grid-template-columns: 1fr; }
}
