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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f4f6f9;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ── Top-Nav ── */
nav.topbar {
  background: #000;
  color: #ffd700;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
nav.topbar .brand { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
nav.topbar .nav-links { display: flex; gap: 0.2rem; height: 100%; }
nav.topbar .nav-links a {
  display: flex; align-items: center; padding: 0 1rem;
  color: #fff; text-decoration: none; font-size: 0.88rem; font-weight: 600;
  border-bottom: 3px solid transparent; transition: color 0.15s, border-color 0.15s;
}
nav.topbar .nav-links a:hover  { color: #ffd700; }
nav.topbar .nav-links a.active { color: #ffd700; border-bottom-color: #ffd700; }
nav.topbar .user { font-size: 0.82rem; color: #ccc; display: flex; align-items: center; gap: 0.8rem; }
nav.topbar form { display: inline; }
nav.topbar button, nav.topbar a.btn-logout {
  background: none; border: 1px solid #444; color: #aaa;
  padding: 0.3rem 0.75rem; border-radius: 5px; cursor: pointer; font-size: 0.8rem;
  text-decoration: none; display: inline-block;
}
nav.topbar button:hover, nav.topbar a.btn-logout:hover { border-color: #ffd700; color: #ffd700; }
.nav-user-row { display: none; }
.gear-link {
  color: #aaa; text-decoration: none; font-size: 1.15rem; line-height: 1;
  display: flex; align-items: center; transition: color 0.15s;
}
.gear-link:hover { color: #fff; }
.gear-link.active { color: #ffd700; }

main { padding: 2rem; max-width: 1100px; margin: 0 auto; }

h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.05rem; margin-bottom: 1rem; color: #333; font-weight: 700; }

.card {
  background: #fff; border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  padding: 1.5rem; margin-bottom: 1.5rem;
}
.card-flush { padding: 0; overflow: hidden; }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; flex-wrap: wrap; gap: 0.6rem;
}

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th {
  text-align: left; padding: 0.6rem 0.8rem;
  background: #f8f8f8; border-bottom: 2px solid #eee;
  font-size: 0.75rem; text-transform: uppercase; color: #666; white-space: nowrap;
}
td { padding: 0.6rem 0.8rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

.badge {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 99px; font-size: 0.75rem; font-weight: 600;
}
.badge-used      { background: #fdecea; color: #b71c1c; }
.badge-free      { background: #e8f5e9; color: #2e7d32; }
.badge-vorstand     { background: #fff8e1; color: #f57f17; }
.badge-kassierer    { background: #e3f2fd; color: #1565c0; }
.badge-ticket       { background: #f3e8ff; color: #7e22ce; }
.badge-offen     { background: #e3f2fd; color: #1565c0; }
.badge-genehmigt { background: #e8f5e9; color: #2e7d32; }
.badge-abgelehnt { background: #fdecea; color: #b71c1c; }
.badge-passiv    { background: #f3f4f6; color: #6b7280; }
.badge-gesperrt  { background: #fdecea; color: #b71c1c; }
.badge-resigned  { background: #f3f4f6; color: #9ca3af; }
.badge-excluded  { background: #fdecea; color: #b71c1c; font-weight: 700; }

.alert {
  background: #fdecea; color: #b71c1c; border: 1px solid #f5c6cb;
  border-radius: 7px; padding: 0.8rem 1rem; margin-bottom: 1rem; font-size: 0.92rem;
}
.success {
  background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9;
  border-radius: 7px; padding: 0.8rem 1rem; margin-bottom: 1rem; font-size: 0.92rem;
}

label { display: block; font-size: 0.85rem; font-weight: 600; color: #444; margin-bottom: 0.3rem; margin-top: 1rem; }
input[type="email"], input[type="password"], input[type="number"], input[type="text"],
input[type="tel"], input[type="datetime-local"], select {
  width: 100%; padding: 0.72rem 0.9rem;
  border: 1.5px solid #d1d5db; border-radius: 7px; font-size: 1rem;
  background: #fafafa; transition: border-color 0.2s; font-family: inherit;
}
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.85rem center;
  padding-right: 2.5rem; cursor: pointer;
}
input:focus { outline: none; border-color: #ffd700; background: #fff; }
select:focus { outline: none; border-color: #ffd700; background-color: #fff; }

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.7rem 1.4rem; background: #ffd700; color: #000;
  font-weight: 700; font-size: 0.9rem; border: 1px solid transparent; border-radius: 7px;
  cursor: pointer; text-decoration: none; transition: background 0.15s;
  appearance: none; -webkit-appearance: none;
}
.btn:hover { background: #f0c800; }
.btn-ghost {
  background: none; border: 1px solid #d1d5db; color: #444;
  padding: 0.45rem 0.9rem; font-size: 0.85rem; font-weight: 600; border-radius: 5px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem;
  appearance: none; -webkit-appearance: none; font-family: inherit; line-height: 1.2;
}
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; font-weight: 600; border-radius: 5px; }
.btn-ghost:hover { border-color: #000; color: #000; }
.btn-ghost-danger { border-color: #fca5a5; color: #dc2626; }
.btn-ghost-danger:hover { border-color: #dc2626; background: #fef2f2; color: #b91c1c; }
.btn-green  { background: #25d366; color: #fff; }
.btn-green:hover  { background: #1ebe5d; }
.btn-danger    { background: #d32f2f; color: #fff; }
.btn-danger:hover    { background: #b71c1c; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn-secondary:hover { background: #4b5563; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* ── Filter-Tabs ── */
.filter-tabs { display: flex; gap: 0.4rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.filter-tab {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 1rem; border-radius: 99px; font-size: 0.82rem; font-weight: 600;
  border: 1.5px solid #d1d5db; color: #555; text-decoration: none;
  background: #fff; transition: border-color 0.15s, color 0.15s;
}
.filter-tab:hover  { border-color: #000; color: #000; }
.filter-tab.active { border-color: #ffd700; background: #ffd700; color: #000; }
.filter-count { font-size: 0.75rem; font-weight: 700; opacity: 0.7; }

/* ── Detail-Liste ── */
dl.details { display: grid; grid-template-columns: 160px 1fr; gap: 0.5rem 1rem; font-size: 0.88rem; }
dl.details dt { color: #888; font-weight: 600; padding-top: 0.15rem; }
dl.details dd { color: #1a1a2e; }

/* ── Entscheidungsbereich ── */
.decision-area { padding: 1rem; background: #f8f8f8; border-radius: 8px; }
.decision-result { padding: 0.8rem; border-radius: 8px; display: flex; align-items: center; }
.decision-approved { background: #f1faf2; }
.decision-rejected { background: #fef7f7; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: #fff; border-radius: 10px; padding: 1.2rem 1.5rem; box-shadow: 0 2px 12px rgba(0,0,0,0.07); }
.stat .value { font-size: 2rem; font-weight: 700; color: #000; }
.stat .label { font-size: 0.82rem; color: #888; margin-top: 0.2rem; }

/* ── Search count badge ── */
.search-count {
  display: inline-flex; align-items: center;
  font-size: 0.8rem; color: #9ca3af; white-space: nowrap;
  padding: 0.25rem 0.7rem; border-radius: 99px;
  border: 1.5px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.search-count.active {
  color: #1a1a2e; border-color: #d1d5db; background: #fff;
}

/* ── Modal ── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 100;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; padding: 2rem;
  max-width: 400px; width: 90%; text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.modal h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.modal .code-label {
  font-family: monospace; font-size: 1.4rem; font-weight: 700;
  letter-spacing: 0.1em; background: #f4f6f9; padding: 0.4rem 1rem;
  border-radius: 6px; display: inline-block; margin-bottom: 1rem;
}
.modal canvas { border-radius: 8px; }
.modal .modal-url {
  font-size: 0.75rem; color: #888; word-break: break-all;
  margin: 0.6rem 0 1.2rem; display: block;
}
.modal-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.modal-close {
  position: absolute; top: 1rem; right: 1.2rem;
  background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #888;
}
.modal-close:hover { color: #000; }
.modal-wrapper { position: relative; }

/* ── Mobile ─────────────────────────────────────────────────────────────── */
.nav-toggle {
  display: none !important;
  background: none; border: none; color: #ffd700;
  font-size: 1.5rem; cursor: pointer; padding: 0.2rem 0.5rem; line-height: 1;
  flex-shrink: 0;
}

.m-br { display: none; }
.d-sep { display: inline; color: #ccc; }

.doc-actions { display: flex; flex-direction: row; gap: 0.4rem; align-items: center; flex-shrink: 0; }
.banner-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

@media (max-width: 768px) {
  .m-br { display: block; height: 0; }
  .d-sep { display: none; }
  .doc-actions { flex-direction: column; align-items: flex-end; gap: 0.3rem; }
  .banner-row { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  nav.topbar { padding: 0 1rem; position: relative; }
  nav.topbar .brand { font-size: 0.88rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  nav.topbar .nav-links {
    display: none; flex-direction: column; height: auto;
    position: absolute; top: 52px; left: 0; right: 0;
    background: #0a0a0a; z-index: 200; padding-bottom: 0.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  }
  nav.topbar .nav-links.open { display: flex; }
  nav.topbar .nav-links a {
    padding: 0.75rem 1.2rem; height: auto;
    border-bottom: 1px solid #1e1e1e; font-size: 0.92rem;
    color: #fff;
  }
  nav.topbar .nav-links a:hover { color: #ffd700; }
  nav.topbar .nav-links a:last-child { border-bottom: none; }
  nav.topbar .nav-links a.active { background: #111; border-bottom-color: transparent; color: #ffd700; }
  nav.topbar .user { display: none; }
  .nav-toggle { display: flex !important; align-items: center; margin-left: 0.5rem; }
  .nav-user-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1.2rem; border-bottom: 2px solid #2a2a2a;
    background: #111; color: #ccc; font-size: 0.82rem;
  }
  .nav-user-info { display: flex; align-items: center; gap: 0.5rem; }
  .nav-user-actions { display: flex; align-items: center; gap: 0.8rem; }

  main { padding: 1rem; }
  h1 { font-size: 1.2rem; margin-bottom: 1rem; }
  .card { padding: 1rem; }
  .card table, .card-flush table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  dl.details { grid-template-columns: 110px 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .filter-tabs { gap: 0.3rem; }
  .filter-tab { padding: 0.4rem 0.7rem; font-size: 0.78rem; }
}

@media (max-width: 480px) {
  .nav-toggle { margin-left: auto; }
  dl.details { grid-template-columns: 1fr; }
  dl.details dt { margin-top: 0.5rem; }
  dl.details dd { padding-bottom: 0.25rem; }
  .stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .fc .fc-toolbar { flex-wrap: wrap; gap: 0.4rem; }
  .fc .fc-toolbar-title { font-size: 1rem; }
  .fc .fc-button { padding: 0.3rem 0.55rem; font-size: 0.8rem; }
  .fc .fc-list-event-title { font-size: 0.85rem; }
  .fc .fc-list-day-text, .fc .fc-list-day-side-text { font-size: 0.82rem; }
}
