/* Theater Auw – Abendkasse
   Nur Systemschriften, keine externen Anfragen. */

:root {
  --ink: #17161a;
  --ink-soft: #232126;
  --cream: #f7f5f1;
  --white: #ffffff;
  --border: #e3ded6;
  --muted: #6f6a66;
  --red: #b3241f;
  --red-dark: #8d1a16;
  --gold: #b9903c;
  --green: #1f7a4d;
  --green-dark: #145c39;
  --blue: #2d6ca2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 22, 26, 0.06), 0 6px 18px rgba(23, 22, 26, 0.07);
  --container: 1120px;
}

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink-soft);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: 1.9rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0.4rem 0; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: rgba(23, 22, 26, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; padding-bottom: 3rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.block { display: block; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.87rem; margin: 0.7rem 0 0; }
.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* --- Kopf / Fuss --------------------------------------------------------- */
.site-header { background: var(--ink); color: var(--cream); }
.site-header .container { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; flex-wrap: wrap; }
.site-header__logo { display: flex; flex-direction: column; color: var(--cream); line-height: 1.1; }
.site-header__logo strong { letter-spacing: 0.02em; }
.site-header__logo span { font-size: 0.72rem; color: #c8c1b8; text-transform: uppercase; letter-spacing: 0.16em; }
.site-nav { margin-left: auto; display: flex; gap: 1rem; flex-wrap: wrap; }
.site-nav a { color: #ded8d0; font-size: 0.93rem; padding: 0.25rem 0; }
.site-nav a.is-active { color: var(--white); border-bottom: 2px solid var(--red); }
.site-header__user { display: flex; align-items: center; gap: 0.75rem; color: #c8c1b8; font-size: 0.88rem; }
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; color: var(--muted); font-size: 0.85rem; }

.offline-banner {
  background: #7a3d00;
  color: #fff8ee;
  text-align: center;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* --- Hero --------------------------------------------------------------- */
.hero { padding: 2rem 0 1rem; }
.hero__kicker { margin: 0 0 0.35rem; font-size: 0.9rem; color: var(--muted); }
.hero__lead { margin: 0.4rem 0 0; color: var(--muted); }

/* --- Karten ------------------------------------------------------------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem;
}
.card > h2 { margin-bottom: 0.9rem; }
.card--danger { border-color: #e6c9c7; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.subhead { margin: 1.5rem 0 0.5rem; }

/* --- Formulare ---------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.8rem; }
.field--grow { flex: 1 1 18rem; }
.field label, .label { font-size: 0.87rem; font-weight: 700; }
input[type="text"], input[type="number"], input[type="password"], input[type="search"],
input[type="file"], textarea, select {
  width: 100%;
  min-height: 42px;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: inherit;
  font: inherit;
}
select { min-width: 12rem; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(179, 36, 31, 0.3);
  border-color: var(--red);
}
.form-row, .search-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.form-row .field, .search-form .field { margin-bottom: 0; }
.form-row .field { flex: 1 1 12rem; }

.button {
  display: inline-block;
  min-height: 42px;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--red);
  border-radius: 6px;
  background: var(--red);
  color: var(--white);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.button:hover { background: var(--red-dark); border-color: var(--red-dark); text-decoration: none; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.button--ghost { background: transparent; color: var(--red); }
.button--ghost:hover { background: rgba(179, 36, 31, 0.08); color: var(--red-dark); }
.button--danger { background: var(--red-dark); border-color: var(--red-dark); }
.button--mini { min-height: 0; padding: 0.25rem 0.65rem; font-size: 0.82rem; border-radius: 4px; }

.linkbutton {
  border: 0; background: none; padding: 0; color: var(--red);
  font: inherit; cursor: pointer; text-decoration: underline;
}
.inline-row { display: flex; gap: 0.6rem; align-items: flex-end; flex-wrap: wrap; }
.inline-row--tight { display: inline-flex; gap: 0.35rem; align-items: center; margin: 0; }

/* --- Hinweise ----------------------------------------------------------- */
.callout { border-radius: var(--radius); padding: 0.8rem 1rem; margin: 0.9rem 0; border: 1px solid; }
.callout p { margin: 0.2rem 0; }
.callout--ok { background: #f1f8f3; border-color: #cbe3d4; }
.callout--warn { background: #fdf8ec; border-color: #e8d9b0; }
.callout--red { background: #fdf2f1; border-color: #eec9c6; }

/* --- Tabellen ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin-top: 0.75rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 0.5rem 0.55rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table thead th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; }
.table .right { text-align: right; white-space: nowrap; }
.tickets-table td { min-width: 7rem; }

.badge {
  display: inline-block; padding: 0.08rem 0.5rem; border-radius: 999px;
  background: #eeeae3; color: var(--muted); font-size: 0.77rem; font-weight: 600;
}
.badge--ok { background: #e5f3ea; color: var(--green); }
.badge--err { background: #fbe6e4; color: var(--red-dark); }

/* --- Übersicht ---------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.75rem; margin-top: 1.25rem; }
.stat { background: var(--cream); border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem 0.9rem; }
.stat__value { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.stat__label { display: block; color: var(--muted); font-size: 0.8rem; }
.stat--alert { background: #fdf3f1; border-color: #eec9c6; }
.stat--alert .stat__value { color: var(--red-dark); }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.9rem; }
.quick {
  display: flex; flex-direction: column; gap: 0.25rem;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; color: inherit; box-shadow: var(--shadow);
}
.quick:hover { border-color: var(--red); text-decoration: none; }
.quick strong { font-size: 1.05rem; }
.quick span { color: var(--muted); font-size: 0.9rem; }

/* --- Code prüfen -------------------------------------------------------- */
.code-form { display: flex; gap: 0.75rem; align-items: stretch; }
.code-form input {
  flex: 1;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-height: 58px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}
.code-form .button { min-width: 8rem; font-size: 1rem; }
.code-result { border-top: 6px solid var(--border); }
.code-result--ok { border-top-color: var(--green); }
.code-result--used { border-top-color: var(--gold); }
.code-result--unknown { border-top-color: var(--red); }
.code-big {
  display: inline-block;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  background: rgba(23, 22, 26, 0.06);
}
.reservation-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  background: #fcfbf9;
}
.reservation-card__head { display: flex; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.6rem 1.2rem; margin: 0.9rem 0; }
.detail-list div { margin: 0; }
.detail-list dt { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; }
.detail-list dd { margin: 0.1rem 0 0; font-weight: 600; }

/* --- Saalplan ----------------------------------------------------------- */
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; margin: 0.9rem 0 0.5rem; font-size: 0.86rem; }
.legend__item { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend__item--alert { color: var(--red-dark); font-weight: 700; }
.swatch { width: 0.9rem; height: 0.9rem; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,0.15); }
.swatch--free { background: #dff2e5; }
.swatch--reserved { background: #f7e2b8; }
.swatch--paid { background: #cfe3f5; }
.swatch--scanned { background: #b9dfc8; }
.swatch--checked { background: #1f7a4d; }

.seatmap-layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1rem; align-items: start; }
.seatmap-card { min-width: 0; }
.seatmap-stage {
  width: 100%;
  max-height: 72vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 0.5rem;
}
.seatmap-stage svg { width: 100%; height: auto; min-width: 520px; display: block; }
.seatmap-stage [data-seat-no] { cursor: pointer; }
.seatmap-stage [data-seat-no]:hover { filter: brightness(0.92) drop-shadow(0 0 3px rgba(0,0,0,0.35)); }
.seatmap-stage .seat-selected { filter: drop-shadow(0 0 5px #17161a); }
.seat-panel { position: sticky; top: 1rem; }
.seat-panel h2 { margin-bottom: 0.6rem; }
.seat-panel .detail-list { grid-template-columns: 1fr; gap: 0.45rem; }
.seat-panel .reservation-actions { margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.5rem; }
.live-dot {
  display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%;
  background: var(--green); margin-right: 0.25rem;
}
.live-dot--stale { background: var(--gold); }
.live-dot--off { background: var(--red); }

/* --- Admin -------------------------------------------------------------- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.9rem 1.2rem; margin-bottom: 0.8rem; }
.admin-grid p { margin: 0.15rem 0; font-weight: 600; }

/* --- Login -------------------------------------------------------------- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--ink); }
.login-card {
  width: min(360px, 92vw); background: var(--white); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); padding: 2rem;
}
.login-card h1 { font-size: 1.4rem; }
.login-card__sub { margin: 0.15rem 0 1.5rem; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; }
.login-card .button { width: 100%; }
.login-error { background: #fdf2f1; border: 1px solid #eec9c6; border-radius: 6px; padding: 0.6rem 0.8rem; font-size: 0.9rem; margin: 0 0 1rem; }

/* --- Mobil -------------------------------------------------------------- */
@media (max-width: 900px) {
  .seatmap-layout { grid-template-columns: 1fr; }
  .seat-panel { position: static; }
  .seatmap-stage { max-height: 60vh; }
}
@media (max-width: 720px) {
  .site-header .container { padding-top: 0.6rem; padding-bottom: 0.6rem; }
  .site-nav { margin-left: 0; width: 100%; overflow-x: auto; gap: 0.9rem; }
  .site-header__user { width: 100%; justify-content: flex-end; }
  h1 { font-size: 1.55rem; }
  .code-form { flex-direction: column; }
  .code-form .button { width: 100%; }
  .hero { padding-top: 1.3rem; }
  .card { padding: 1rem; }
  .seatmap-stage svg { min-width: 460px; }
}
