/* ============================================================
   HW Tickets — Dashboard  ·  Stripe-inspired
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  /* Stripe's signature off-white background */
  --bg:            #f6f9fc;
  --surface:       #ffffff;
  --surface-2:     #f6f9fc;
  --border:        #e3e8ef;
  --border-subtle: #edf2f7;

  --text:          #1a1f36;
  --text-muted:    #697386;
  --text-subtle:   #a3acba;

  --primary:       #635bff;
  --primary-hover: #5851e8;
  --primary-dim:   rgba(99, 91, 255, .08);
  --primary-ring:  rgba(99, 91, 255, .2);

  --danger:        #df1b41;
  --danger-dim:    rgba(223, 27, 65, .07);
  --ok:            #09825d;
  --ok-dim:        rgba(9, 130, 93, .08);
  --warn:          #c56200;

  /* Stripe card shadows — barely-there */
  --shadow-xs: 0 1px 1px rgba(0,0,0,.03), 0 3px 6px rgba(18,42,66,.04);
  --shadow-sm: 0 2px 5px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);
  --shadow:    0 4px 6px rgba(50,50,93,.09), 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 7px 14px rgba(50,50,93,.1), 0 3px 6px rgba(0,0,0,.07);
  --shadow-lg: 0 15px 35px rgba(50,50,93,.1), 0 5px 15px rgba(0,0,0,.07);
  --shadow-xl: 0 30px 60px rgba(50,50,93,.12), 0 18px 36px rgba(0,0,0,.06);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --sidebar-w:     232px;
  --sidebar-width: min(80vw, 260px);
  --mobile-topbar-h: 56px;

  --t: 120ms ease;
  --t-med: 200ms ease;

  color-scheme: light dark;
}

[data-theme="dark"] {
  --bg:            #0a0e1a;
  --surface:       #111827;
  --surface-2:     #1a2133;
  --border:        #1f2d40;
  --border-subtle: #172030;

  --text:          #e7ecf3;
  --text-muted:    #8896ab;
  --text-subtle:   #4a5568;

  --primary:       #7c73ff;
  --primary-hover: #6c63f0;
  --primary-dim:   rgba(124,115,255,.1);
  --primary-ring:  rgba(124,115,255,.22);

  --danger:        #f5475c;
  --danger-dim:    rgba(245, 71, 92, .1);
  --ok:            #2cc489;
  --ok-dim:        rgba(44,196,137,.09);

  --shadow-xs: 0 1px 1px rgba(0,0,0,.2), 0 3px 6px rgba(0,0,0,.2);
  --shadow-sm: 0 2px 5px rgba(0,0,0,.25);
  --shadow:    0 4px 6px rgba(0,0,0,.3);
  --shadow-md: 0 7px 14px rgba(0,0,0,.35);
  --shadow-lg: 0 15px 35px rgba(0,0,0,.4);
  --shadow-xl: 0 30px 60px rgba(0,0,0,.5);
}

/* ── Utilities ───────────────────────────────────────────────── */
.hidden { display: none !important; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ── Layout ──────────────────────────────────────────────────── */
.dashboard {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════════ */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 30;
}

/* Logo row */
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.logo img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.logo-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.2px;
  color: var(--text);
  white-space: nowrap;
}

/* Sidebar sections */
.sidebar-section {
  padding: 12px 12px 8px;
}
.sidebar-section + .sidebar-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 4px 8px 8px;
  display: block;
}

/* Sidebar icon buttons row */
.sidebar-actions {
  display: flex;
  gap: 4px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar-icon-btn {
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: color var(--t), background var(--t), border-color var(--t);
}
.sidebar-icon-btn:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}

/* Create button — pill style */
.create-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - 24px);
  margin: 12px;
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: -.1px;
  transition: background var(--t), box-shadow var(--t), transform var(--t);
  box-shadow: 0 2px 5px rgba(99,91,255,.3), 0 1px 2px rgba(0,0,0,.1);
}
.create-button:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(99,91,255,.38), 0 1px 3px rgba(0,0,0,.1);
  transform: translateY(-1px);
}
.create-button:active { transform: translateY(0); box-shadow: none; }
.side-create-button { display: flex !important; }
.grid-create-button { display: none !important; }

/* Divider */
.hr-event-list, .hr-event-grid {
  display: block;
  border: none;
  height: 1px;
  background: var(--border-subtle);
  margin: 0 12px;
}
.hr-event-grid { display: none !important; }
.hr-event-list::before, .hr-event-list::after { display: none; }

/* Event nav items */
.events-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  min-height: 0;
}
.event-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t), color var(--t);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
}
.event-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.sidebar-thumb {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.event-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar footer */
.sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
}
.sidebar-legal-link {
  font-size: 12px;
  color: var(--text-subtle);
  text-decoration: none;
  transition: color var(--t);
}
.sidebar-legal-link:hover { color: var(--text-muted); }

/* Mobile menu toggle */
.mobile-menu-toggle {
  position: fixed;
  top: 14px; left: 14px;
  z-index: 40;
  height: 36px; width: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: none;
  place-items: center;
  opacity: 0;
  pointer-events: none;
}
.mobile-menu-toggle::before {
  content: "";
  display: block;
  width: 15px; height: 1.5px;
  background: currentColor;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

/* Mobile title */
.mobile-title {
  display: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.2px;
  position: fixed;
  left: 60px; top: 21px;
  z-index: 30;
  color: var(--text);
  pointer-events: none;
}

/* Mobile-Topbar: echte fixe Leiste auf kleinen Screens (Desktop: aus) */
.mobile-topbar { display: none; }

/* Theme toggle specific */
.theme-toggle {
  position: static !important;
  top: auto !important; right: auto !important;
}
.admin-btn {
  position: static !important;
  top: auto !important; right: auto !important;
}

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════════════════ */
.main-content {
  padding: clamp(24px, 3vw, 40px) clamp(20px, 3vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* Empty state */
.empty-state {
  margin: 10vh auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 60px 40px;
  box-shadow: var(--shadow-sm);
  max-width: 480px;
}
.empty-text {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 24px;
}
.empty-button-big {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(99,91,255,.3);
  transition: background var(--t), box-shadow var(--t), transform var(--t);
}
.empty-button-big:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,91,255,.35);
}

/* ═══════════════════════════════════════════════════════════════
   EVENT CARDS  — Stripe-style product cards
═══════════════════════════════════════════════════════════════ */
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition:
    transform var(--t-med),
    box-shadow var(--t-med),
    border-color var(--t-med);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* remove old gradient pseudo trick */
}

/* Image */
.event-card::before {
  content: "";
  display: block;
  height: 140px;
  background-image: var(--bg-image, none);
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
  transition: transform var(--t-med);
}

.event-card::after { display: none; }

/* Title row */
.event-card-title {
  position: static;
  display: block;
  padding: 14px 16px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.1px;
  line-height: 1.4;
  text-align: left;
  text-shadow: none;
  background: var(--surface);
  border-top: 1px solid var(--border-subtle);

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Hover */
.event-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}
.event-card:hover::before { transform: scale(1.04); }
.event-card::before, .event-card::after { pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(26, 31, 54, .5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-med);
  z-index: 50;
  overscroll-behavior: contain;
}
.modal.active { opacity: 1; pointer-events: auto; }
.modal:not(.active) { pointer-events: none; }

.modal-content {
  width: min(960px, 96vw);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: clamp(20px, 3vw, 32px);
  position: relative;
}

/* Close button */
.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  left: auto;
  float: none;
  height: 36px; width: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 14px;
  transition: color var(--t), background var(--t), border-color var(--t);
  z-index: 5; box-shadow: var(--shadow-sm);
}
.close-btn:hover {
  color: var(--danger);
  border-color: rgba(223,27,65,.3);
  background: var(--danger-dim);
}

.close-btn-small-popup {
  position: absolute; top: 14px; right: 14px; left: auto;
  height: 36px; width: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: color var(--t), background var(--t);
  z-index: 60;
}
.close-btn-small-popup:hover {
  color: var(--danger);
  background: var(--danger-dim);
  border-color: rgba(223,27,65,.3);
}

/* ═══════════════════════════════════════════════════════════════
   DETAIL POPUP
═══════════════════════════════════════════════════════════════ */
.detail-card { display: flex; flex-direction: column; gap: 16px; }

.detail-hero {
  width: 100%; height: 200px; object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.detail-header {
  display: flex; align-items: center; gap: 12px;
  justify-content: space-between; flex-wrap: wrap;
}
.detail-title { font-size: clamp(16px, 2vw, 20px); font-weight: 700; letter-spacing: -.3px; }
.detail-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Action buttons */
.action-btn {
  height: 34px; min-width: 34px; padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color var(--t), background var(--t), border-color var(--t);
}
.action-btn:hover {
  color: var(--primary);
  border-color: rgba(99,91,255,.35);
  background: var(--primary-dim);
}

/* ═══════════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════════ */
.tbl-search {
  width: 100%; height: 38px;
  padding: 0 13px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 13.5px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.tbl-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.tbl-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 8px;
  box-shadow: var(--shadow-xs);
}
.tbl-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.tbl-head h4 { font-size: 13px; font-weight: 600; color: var(--text); }
.tbl-tools { display: flex; gap: 6px; }

.tbl-btn {
  height: 30px; min-width: 30px; padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: color var(--t), background var(--t), border-color var(--t);
}
.tbl-btn:hover {
  color: var(--primary);
  border-color: rgba(99,91,255,.3);
  background: var(--primary-dim);
}

.tbl-wrap { overflow: auto; }
.tbl { width: 100%; min-width: 580px; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 10px 16px; border-bottom: 1px solid var(--border-subtle); text-align: left; }
.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface);
  color: var(--text-subtle);
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl.summary { margin-top: 12px; }
.summary-head { margin-top: 22px; font-size: 14px; font-weight: 600; color: var(--text); }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════ */
.btn-primary, .add-datetime-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius);
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; letter-spacing: -.1px;
  box-shadow: 0 2px 5px rgba(99,91,255,.28);
  transition: background var(--t), box-shadow var(--t), transform var(--t);
  white-space: nowrap;
}
.btn-primary:hover, .add-datetime-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(99,91,255,.35);
  transform: translateY(-1px);
}
.btn-primary:active, .add-datetime-btn:active { transform: translateY(0); box-shadow: none; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  border-radius: var(--radius);
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--surface-2); border-color: #c4c9d4; }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  background: var(--danger); color: #fff;
  border: none; border-radius: var(--radius);
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: opacity var(--t), transform var(--t);
}
.btn-danger:hover { opacity: .88; transform: translateY(-1px); }

.btn-small {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background var(--t);
}
.btn-small:hover { background: var(--primary-hover); }
.btn-small.secondary {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.btn-small.secondary:hover { background: var(--surface-2); }

.btn-remove {
  height: 34px; width: 34px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color var(--t), border-color var(--t), background var(--t);
  flex-shrink: 0;
}
.btn-remove:hover {
  color: var(--danger);
  border-color: rgba(223,27,65,.3);
  background: var(--danger-dim);
}

/* ═══════════════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════════════ */
.event-form-modal { width: min(680px, 96vw); }

#formTitle {
  font-size: 18px; font-weight: 700; letter-spacing: -.3px;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

form { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); letter-spacing: .05px; }
.form-hint  { font-size: 12px; color: var(--text-subtle); line-height: 1.5; }

.form-input, .form-textarea,
input[type="date"], input[type="time"], input[type="number"],
select.form-input {
  width: 100%; padding: 9px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 14px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  appearance: none; -webkit-appearance: none;
}
.form-textarea { min-height: 86px; resize: vertical; }

.form-input:focus, .form-textarea:focus,
input[type="date"]:focus, input[type="time"]:focus, input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
input[readonly] { opacity: .6; cursor: not-allowed; }

/* Date-time card */
.date-time-pair { display: flex; flex-direction: column; gap: 8px; }
.date-time-card {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 10px; align-items: end;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
}
.date-time-card label {
  display: block; font-size: 12px;
  color: var(--text-muted); margin-bottom: 4px; font-weight: 500;
}

/* File upload */
.file-upload-with-preview { display: flex; flex-direction: column; gap: 10px; }
.file-upload { display: flex; align-items: center; gap: 10px; }
.file-upload input[type="file"] { display: none; }
.file-upload-label {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px dashed var(--border);
  background: var(--surface-2); color: var(--text-muted);
  padding: 9px 14px; border-radius: var(--radius);
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: border-color var(--t), color var(--t), background var(--t);
}
.file-upload-label:hover {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-dim);
}
.image-preview {
  display: none; width: 100%; height: 160px;
  object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Checkboxes */
.checkline {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; cursor: pointer; padding: 4px 0; color: var(--text);
}
.checkline input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--primary); cursor: pointer; flex-shrink: 0;
}

/* Form actions */
.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding-top: 10px; border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
}

/* Discounts */
.discounts-container .muted-hint {
  font-size: 13px; color: var(--text-subtle);
  padding: 9px 12px; border: 1px dashed var(--border); border-radius: var(--radius);
}
.discount-row { margin-top: 8px; }
.discount-grid {
  display: grid; grid-template-columns: 1fr 1fr auto;
  gap: 10px; align-items: end;
  padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2);
}
.discount-grid label {
  display: block; font-size: 12px;
  color: var(--text-muted); margin-bottom: 4px; font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   DELETE / SMALL MODALS
═══════════════════════════════════════════════════════════════ */
.modal-header { font-weight: 700; font-size: 16px; margin-bottom: 8px; color: var(--text); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* QR Modal */
.qr-modal {
  width: min(440px, 96vw); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.qr-img {
  width: 240px; height: 240px; object-fit: contain; display: block;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px; background: #fff;
}
.link-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Link Popup */
.link-popup-overlay {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(26,31,54,.5);
  backdrop-filter: blur(3px);
}
.link-popup-box {
  position: relative; width: min(500px, 100%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
  padding: 24px; display: flex; flex-direction: column; gap: 14px;
}
.link-popup-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 12px;
  transition: color var(--t), border-color var(--t);
}
.link-popup-close:hover { color: var(--danger); border-color: rgba(223,27,65,.3); }
.link-popup-title { font-size: 16px; font-weight: 700; padding-right: 36px; color: var(--text); }
.link-popup-text  { font-size: 13px; color: var(--text-muted); }
.link-popup-input {
  width: 100%; padding: 9px 12px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: ui-monospace, 'Cascadia Code', monospace; font-size: 13px;
  outline: none;
}
.link-popup-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.link-popup-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════
   PRINT CENTER / PRICE FORECAST
═══════════════════════════════════════════════════════════════ */
.print-center-modal,
.price-forecast-modal { width: min(1340px, calc(100vw - 24px)); }

.print-center-layout {
  display: grid;
  grid-template-columns: minmax(0,1.4fr) minmax(280px,.8fr);
  gap: 16px; min-height: min(74vh,860px);
}
.print-preview-pane, .print-config-pane {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.print-preview-pane {
  padding: 14px; display: grid; grid-template-rows: auto 1fr; gap: 12px;
}
.print-preview-head h2, .print-config-pane h2 { margin: 0; font-size: 14px; font-weight: 700; }
.print-preview-head p, .forecast-foot { margin: 3px 0 0; color: var(--text-muted); font-size: 13px; }

#printPreviewFrame {
  width: 100%; min-height: 58vh;
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
}
.print-config-pane {
  padding: 16px; display: grid; grid-template-rows: auto 1fr auto; gap: 12px;
}
.print-config-scroll { overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.print-config-group {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; background: var(--surface);
}
.print-config-group h3 {
  margin: 0 0 8px; font-size: 11.5px; font-weight: 600;
  color: var(--text-subtle); text-transform: uppercase; letter-spacing: .5px;
}
/* Sortier-Auswahl im Druckzentrum */
.selectline {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 13px; color: var(--text); padding: 4px 0;
}
.selectline + .selectline { margin-top: 8px; }
.selectline > span { font-weight: 500; color: var(--text-muted); }
.print-config-select {
  width: 100%; min-height: 38px;
  padding: 8px 12px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 13.5px;
  cursor: pointer; outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.print-config-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.print-config-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ── Forecast Popup redesign ──────────────────────────────── */

/* Modal width — narrower & focused */
.price-forecast-modal { width: min(520px, 96vw) !important; }

/* Header */
.fc-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 20px;
}
.fc-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .6px;
  text-transform: uppercase; color: var(--primary); margin-bottom: 4px; padding-left: 40px;
}
.fc-title  { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2; padding-top: 10px;}
.fc-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.fc-prices { display: none; flex-direction: column; gap: 4px; align-items: flex-end; flex-shrink: 0; }
.fc-price-chip {
  font-size: 12px; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 2px 10px; white-space: nowrap;
}
.fc-price-chip b { display: none; color: var(--text); }

/* Hero number */
.fc-hero {
  background: var(--primary-dim);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
  text-align: center;
}
.fc-hero-label { font-size: 12px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.fc-hero-value { font-size: 32px; font-weight: 700; letter-spacing: -1px; color: var(--text); line-height: 1; margin-bottom: 10px; }
.fc-hero-sub   { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.fc-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 99px;
}
.fc-badge--ok   { background: var(--ok-dim); color: var(--ok); }
.fc-badge--warn { background: rgba(197,98,0,.09); color: var(--warn); }

/* Stat rows */
.fc-stats {
  display: flex; flex-direction: column; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; margin-bottom: 16px;
}
.fc-stat-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 11px 16px; font-size: 13.5px;
  border-bottom: 1px solid var(--border-subtle);
}
.fc-stat-row:last-child { border-bottom: none; }
.fc-stat-label { color: var(--text-muted); }
.fc-stat-value { font-weight: 600; color: var(--text); text-align: right; }
.fc-stat-detail { display: block; font-size: 11.5px; font-weight: 400; color: var(--text-muted); margin-top: 1px; }

/* Capacity bar */
.fc-cap-bar-wrap {
  padding: 0 16px 12px; background: var(--surface);
  border-bottom: 1px solid var(--border-subtle); display: none;
}
.fc-cap-bar {
  height: 5px; background: var(--border);
  border-radius: 99px; overflow: hidden; position: relative;
}
.fc-cap-bar::after {
  content: ''; position: absolute; inset: 0;
  width: var(--pct, 0%);
  background: var(--primary);
  border-radius: 99px;
  transition: width .4s ease;
}

/* Section label */
.fc-section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-subtle);
  margin-bottom: 8px;
}

/* Dates table */
.fc-dates-table-wrap {
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
}
.fc-dates-table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
}
.fc-dates-table th, .fc-dates-table td {
  padding: 9px 14px; border-bottom: 1px solid var(--border-subtle); text-align: left;
}
.fc-dates-table thead th {
  background: var(--surface-2); font-size: 11.5px; font-weight: 600;
  color: var(--text-subtle); text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border);
}
.fc-dates-table tbody tr:last-child td { border-bottom: none; }
.fc-dates-table tbody tr:hover td { background: var(--surface-2); }
.fc-dates-table tfoot td {
  background: var(--surface-2); border-top: 1px solid var(--border);
  border-bottom: none; font-size: 13.5px;
}
.fc-dates-table .num { text-align: right; }
.fc-money { font-variant-numeric: tabular-nums; }
.fc-row--active td { background: var(--primary-dim); }
.fc-row--active:hover td { background: color-mix(in srgb, var(--primary-dim) 80%, var(--surface-2)); }
.fc-current-tag {
  display: inline-block; font-size: 10px; font-weight: 600;
  background: var(--primary); color: #fff;
  border-radius: 4px; padding: 1px 5px; margin-left: 6px;
  vertical-align: middle; letter-spacing: .2px;
}

/* ═══════════════════════════════════════════════════════════════
   LOADER
═══════════════════════════════════════════════════════════════ */
.loader.hidden { display: none !important; }
.loader {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
}
.loader-backdrop {
  position: absolute; inset: 0;
  backdrop-filter: blur(3px);
  background: rgba(26,31,54,.4);
}
.loader-card {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px 32px;
  box-shadow: var(--shadow-xl);
}
.spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--primary);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { font-size: 13.5px; color: var(--text-muted); }

.btn-primary.btn-loading, .create-button.btn-loading {
  position: relative; pointer-events: none; opacity: .8;
}
.btn-primary.btn-loading::after, .create-button.btn-loading::after {
  content: ''; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}

/* ── Animations ────────────────────────────────────────────── */
.fade-in { animation: fadeIn .2s ease both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}

/* ── Scroll-lock ────────────────────────────────────────────── */
body.modal-open, body.menu-open {
  position: fixed; width: 100%; overflow: hidden;
  top: var(--scroll-lock-top, 0);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  /* Topbar als echte, fixe Leiste mit Hintergrund */
  .mobile-topbar {
    display: flex; align-items: center; gap: 10px;
    position: fixed; top: 0; left: 0; right: 0;
    height: calc(var(--mobile-topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-left)) 0 max(12px, env(safe-area-inset-left));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    z-index: 40;
  }
  /* Toggle + Titel sitzen jetzt statisch in der Leiste */
  .mobile-topbar .mobile-menu-toggle {
    position: static; opacity: 1; pointer-events: auto;
    display: grid; place-items: center;
    height: 42px; width: 42px;
    box-shadow: none;
  }
  .mobile-topbar .mobile-title {
    position: static; left: auto; top: auto;
    display: block; pointer-events: auto;
    font-size: 16px;
  }

  .dashboard { grid-template-columns: 1fr; }
  /* Drawer öffnet unterhalb der Topbar */
  .sidebar {
    position: fixed;
    top: calc(var(--mobile-topbar-h) + env(safe-area-inset-top));
    left: 0; bottom: 0;
    height: calc(100dvh - var(--mobile-topbar-h) - env(safe-area-inset-top));
    width: var(--sidebar-width);
    transform: translateX(-110%);
    transition: transform var(--t-med), box-shadow var(--t-med);
    z-index: 35; box-shadow: none;
  }
  .sidebar.mobile-visible { transform: translateX(0); box-shadow: var(--shadow-xl); }
  /* Backdrop beginnt ebenfalls unter der Topbar, damit diese bedienbar bleibt */
  .sidebar-backdrop { top: calc(var(--mobile-topbar-h) + env(safe-area-inset-top)); }

  .main-content {
    padding-top: calc(var(--mobile-topbar-h) + env(safe-area-inset-top) + 12px);
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  /* Eingebetteter Bereich (Abendkasse/Einlass): Topbar ausblenden,
     der eigene „Zurück“-Balken übernimmt – kein doppelter Header */
  .dashboard:has(#embedView:not(.hidden)) .mobile-topbar { display: none; }
  .embed-bar { padding-top: max(10px, env(safe-area-inset-top)); }
}

@media (max-width: 768px) {
  .event-grid { grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; }
  .event-card::before { height: 115px; }
  .detail-header { flex-direction: column; align-items: stretch; }
  .form-actions { flex-direction: column; }
  .date-time-card {
    grid-template-columns: 1fr 1fr;
    position: relative;
    padding-top: 38px;
  }
  /* Datum + Uhrzeit nebeneinander (kurze Felder), Rest volle Breite */
  .date-time-card > div:nth-child(1),
  .date-time-card > div:nth-child(2) { grid-column: span 1; }
  .date-time-card > div:nth-child(3),
  .date-time-card > div:nth-child(4),
  .date-time-card > div:nth-child(5) { grid-column: 1 / -1; }
  /* Preisfelder dürfen voll breit werden */
  .date-time-card .term-price-normal,
  .date-time-card .term-price-reduced { min-width: 0; max-width: none; width: 100%; }
  .date-time-card input { width: 100%; }
  /* Entfernen-Button oben rechts in der Karte */
  .date-time-card > .btn-remove:last-child {
    position: absolute; top: 8px; right: 8px;
    grid-column: auto; justify-self: auto;
  }
  .print-center-layout { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .main-content {
    padding: calc(var(--mobile-topbar-h) + env(safe-area-inset-top) + 10px)
             max(14px, env(safe-area-inset-right))
             calc(20px + env(safe-area-inset-bottom))
             max(14px, env(safe-area-inset-left));
  }
  .event-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .event-card::before { height: 100px; }
  .event-card-title { font-size: 12px; padding: 10px 12px 12px; }
  .btn-primary, .btn-secondary, .btn-danger { width: 100%; }
  .form-actions { flex-direction: column; }
  .form-input, .form-textarea,
  input[type="date"], input[type="time"], input[type="number"] {
    font-size: 16px; min-height: 44px;
  }
  .link-popup-actions { flex-direction: column; }
  .link-popup-actions .btn-secondary { width: 100%; }
}

.term-price-reduced, .term-price-normal { min-width: 66px; max-width: 66px; }

/* ═══════════════════════════════════════════════════════════════
   MOBILE-FEINSCHLIFF (Dashboard) – Touch-freundlich & sauber
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Modal nutzt mehr Breite + Safe-Area */
  .modal {
    padding: 12px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    align-items: start;
  }
  .modal { place-items: start center; padding-top: 16px; padding-bottom: 16px; }
  .modal-content {
    width: 100%;
    max-height: calc(100dvh - 32px);
    padding: 20px 16px;
    border-radius: var(--radius-lg);
  }
  .event-form-modal { width: 100% !important; }

  /* Aktions-Buttons im Detail-Popup: große, gleichmäßige Touch-Ziele */
  .detail-actions { gap: 8px; width: 100%; justify-content: flex-start; }
  .detail-actions .action-btn {
    height: 44px; width: 44px; min-width: 44px;
    flex: 0 0 auto;
    padding: 0;
    font-size: 16px;
  }

  /* Close-Buttons gut erreichbar */
  .close-btn, .close-btn-small-popup { height: 40px; width: 40px; top: 12px; right: 12px; }

  /* iOS-Zoom verhindern: alle Eingaben mind. 16px */
  input, select, textarea, .input, .form-input, .form-textarea, .link-popup-input {
    font-size: 16px !important;
  }

  /* Karten: kein „hängender“ Hover auf Touch, dafür echtes Tap-Feedback */
  .event-card:hover { transform: none; box-shadow: var(--shadow-xs); }
  .event-card:hover::before { transform: none; }
  .event-card:active { transform: scale(.985); box-shadow: var(--shadow-sm); }

  /* Detail-Popup: Hero etwas flacher, mehr Platz für die Liste */
  .detail-hero { height: 150px; }
  .summary-head { margin-top: 16px; }

  /* Buchungs-/Druck-Werkzeuge: größere Touch-Ziele, saubere Umbrüche */
  .tbl-head { flex-wrap: wrap; gap: 8px; }
  .tbl-tools { gap: 8px; }
  .tbl-btn { height: 40px; min-width: 40px; font-size: 14px; }
  .tbl-wrap { -webkit-overflow-scrolling: touch; }

  /* Druckzentrum: Vorschau kompakter, Konfiguration (inkl. Sortierung)
     ohne langes Scrollen erreichbar */
  .print-center-layout { gap: 12px; min-height: 0; }
  #printPreviewFrame { min-height: 40vh; }
  .print-config-pane { padding: 12px; }
  .print-config-select { min-height: 44px; }
  .print-config-actions .btn-primary,
  .print-config-actions .btn-secondary { flex: 1 1 auto; }
}

@media (max-width: 480px) {
  /* QR-Bild skaliert mit */
  .qr-img { width: min(72vw, 240px); height: auto; aspect-ratio: 1; }

  /* Modal-Aktionen stapeln & volle Breite */
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions > button, .modal-actions > .btn-primary,
  .modal-actions > .btn-secondary, .modal-actions > .btn-danger { width: 100%; }

  /* Detailtitel etwas kompakter */
  .detail-title { font-size: 18px; }
}
