/* Design der Plus-Immobilien-Eigenentwicklungen (Personal Manager, ooo-manager),
   damit alle Tools optisch als Familie erkennbar sind. Basis-Regeln übernommen
   aus Personal Manager/app/static/style.css, darunter die Eventübersicht-eigenen.
   Abweichung: novum-Logo (Querformat) statt PI-Logo (quadratisch) – Größen unten angepasst. */

:root {
  --bg: #faf9f7;
  --card-bg: #ffffff;
  --border: #e3e1de;
  --text: #202124;
  --muted: #6b6d72;
  --primary: #33363a;
  --primary-dark: #1c1d1f;
  --danger: #d64545;
  --green: #22a55d;
  --orange: #e8823c;
  --changed-bg: #fff6da;
  --sidebar-w: 240px;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.app-shell { display: flex; align-items: stretch; min-height: 100vh; }

/* ── Marke ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1.5rem; background: var(--card-bg); border-bottom: 1px solid var(--border);
}
.brand-link { text-decoration: none; color: var(--text); font-weight: 700; }
.brand-mark { display: inline-flex; align-items: center; gap: 0.6rem; }
.brand-logo { display: block; height: 44px; width: auto; border-radius: 6px; }
.brand-sub { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.brand-mark-sm .brand-logo { height: 30px; }
.brand-mark-lg { display: flex; flex-direction: column; align-items: center; gap: 0.85rem; margin-bottom: 2rem; }
.brand-mark-lg .brand-logo { height: auto; width: 230px; max-width: 100%; }
.brand-mark-lg .brand-sub { font-size: 0.8rem; }
/* Logo hat einen weißen, nicht transparenten Hintergrund – auf der dunklen Sidebar daher auf heller Karte. */
.brand-mark-sidebar { flex-direction: column; align-items: flex-start; gap: 0.7rem; }
.brand-mark-sidebar { align-items: stretch; width: 100%; }
.brand-mark-sidebar .brand-logo { width: 100%; height: auto; background: #fff; padding: 10px 12px; border-radius: 10px; box-sizing: border-box; }
.brand-mark-sidebar .brand-sub { font-size: 0.7rem; }

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--primary); color: rgba(255, 255, 255, 0.85);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { padding: 1.5rem 1.25rem 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08); flex-shrink: 0; }
.sidebar-brand .brand-link { color: #fff; display: block; }
.sidebar-brand .brand-sub { color: rgba(255, 255, 255, 0.45); }
.sidebar-nav { flex: 1; padding: 0.75rem 0.6rem; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-section {
  font-size: 0.625rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35); padding: 0.85rem 0.7rem 0.4rem;
}
.nav-item {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem; border-radius: 8px;
  color: rgba(255, 255, 255, 0.65); font-size: 0.85rem; font-weight: 500; text-decoration: none;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 600; }

.sidebar-user { position: relative; padding: 0.75rem; border-top: 1px solid rgba(255, 255, 255, 0.08); flex-shrink: 0; }
.user-menu-button {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; background: none; border: none;
  padding: 0.4rem; border-radius: 8px; color: #fff; cursor: pointer; text-align: left;
}
.user-menu-button:hover { background: rgba(255, 255, 255, 0.08); }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, 0.16);
  display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
}
.user-name { font-size: 0.85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-dropdown {
  display: none; position: absolute; left: 0.75rem; right: 0.75rem; bottom: calc(100% + 0.4rem);
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18); padding: 0.3rem; z-index: 1000;
}
.user-menu-dropdown.open { display: block; }
.user-menu-dropdown a { display: block; padding: 0.45rem 0.6rem; border-radius: 4px; font-size: 0.85rem; color: var(--text); text-decoration: none; }
.user-menu-dropdown a:hover { background: var(--bg); }

.mobile-topbar {
  display: none; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem;
  background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 1100;
}
.mobile-menu-knopf { background: none; border: none; color: #fff; padding: 0.3rem; line-height: 1; cursor: pointer; flex-shrink: 0; }
.mobile-menu-knopf:hover { background: none; }
.mobile-menu-knopf svg { width: 26px; height: 26px; display: block; }
.mobile-topbar .brand-logo { background: #fff; padding: 4px 6px; box-sizing: content-box; }
.mobile-topbar .brand-sub { color: rgba(255, 255, 255, 0.6); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 1150; }

/* ── Inhalt, Karten, Formulare ─────────────────────────────────────────── */
.content { flex: 1; min-width: 0; max-width: 1500px; margin: 0 auto; padding: 2rem 2.5rem; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 1.4rem; display: flex; align-items: center; gap: 0.6rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 1.5rem;
  margin-bottom: 1.25rem; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
}

.button, button, input[type="submit"] {
  display: inline-block; background: var(--primary); color: #fff; border: none; border-radius: 6px;
  padding: 0.5rem 1rem; font-size: 0.9rem; font-family: inherit; text-decoration: none; cursor: pointer;
}
.button:hover, button:hover { background: var(--primary-dark); }
button:disabled { opacity: 0.6; cursor: default; }
.button.secondary, button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.button.secondary:hover, button.secondary:hover { background: var(--bg); }
button.small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
button.link-button {
  background: none; border: none; padding: 0; color: var(--muted); font-size: 0.75rem;
  text-decoration: underline; text-transform: none; letter-spacing: 0; font-weight: 400;
}
button.link-button:hover { background: none; color: var(--text); }

label { display: block; margin-top: 1rem; margin-bottom: 0.25rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], textarea, select {
  width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.9rem; font-family: inherit; background: #fff; color: var(--text); margin-top: 0.25rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(51, 54, 58, 0.12); }
.form-actions { margin-top: 1.25rem; }

.alert-error {
  background: #fdecec; color: #b3261e; border: 1px solid #f6c8c5; border-radius: 8px;
  padding: 0.6rem 0.9rem; font-size: 0.85rem; margin-bottom: 1rem;
}
.muted { color: var(--muted); font-size: 0.85rem; }
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge.warn { background: #fdf3e3; color: #8a5a12; }

/* ── Anmeldung ─────────────────────────────────────────────────────────── */
.login-wrap { min-height: calc(100vh - 61px); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 360px; padding: 2.5rem 2rem; box-shadow: 0 20px 45px rgba(31, 36, 48, 0.08); border-radius: 14px; }

/* ── Eventübersicht: Filter ───────────────────────────────────────────── */
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.filter-card { position: sticky; top: 1.25rem; max-height: calc(100vh - 2.5rem); overflow-y: auto; padding: 0.5rem 1.25rem 1rem; }
.block { padding: 0.9rem 0; border-bottom: 1px solid var(--border); }
.block:last-of-type { border-bottom: none; }
.block h2 {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted);
  margin: 0 0 0.5rem; display: flex; justify-content: space-between; align-items: baseline;
}
.block > label:first-of-type { margin-top: 0; }
.row { display: flex; gap: 0.5rem; }
.row label { flex: 1; min-width: 0; margin-top: 0; font-weight: 500; font-size: 0.78rem; }
.row input { min-width: 0; padding: 0.45rem 0.4rem; }
.presets { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.6rem; }
label.check {
  display: flex; align-items: center; gap: 0.5rem; margin: 0; padding: 0.15rem 0;
  font-weight: 400; font-size: 0.88rem; color: var(--text); cursor: pointer;
}
label.check input { width: auto; margin: 0; accent-color: var(--primary); }
.checklist.small label.check { font-size: 0.82rem; }
.checklist.two-col { display: grid; grid-template-columns: 1fr 1fr; column-gap: 0.5rem; margin-top: 0.75rem; }
.group-label { font-size: 0.65rem; color: var(--muted); margin-top: 0.5rem; text-transform: uppercase; letter-spacing: 0.06em; }
details { margin: 0.5rem 0; }
summary { cursor: pointer; color: var(--text); font-size: 0.85rem; font-weight: 500; padding: 0.25rem 0; }
.status { font-size: 0.82rem; color: var(--muted); min-height: 1.2em; margin: 0.5rem 0 0; }
.status.error { color: var(--danger); }
.hint { color: var(--muted); font-size: 0.8rem; }

/* ── Eventübersicht: Dokument (Bildschirm = Druckvorschau) ──────────── */
.doc { padding: 2rem 2.25rem; font-size: 0.85rem; line-height: 1.4; min-width: 0; }
.empty { color: var(--muted); }
.doc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; border-bottom: 2px solid var(--primary); padding-bottom: 0.4rem; }
.doc-head h1 { margin: 0; font-size: 1.4rem; }
.range { color: var(--muted); }
.stand { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; font-size: 0.72rem; color: var(--muted); margin: 0.5rem 0 1rem; }
.legend-hint { margin-left: auto; }
.swatch {
  display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: baseline;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.warn { background: #fdf3e3; color: #8a5a12; border: 1px solid #f3dcb5; padding: 0.5rem 0.8rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.8rem; }
.label { font-weight: 600; }
.tag { font-size: 0.65rem; border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 0 0.45rem; font-weight: 600; vertical-align: middle; }

.day { margin-bottom: 1rem; }
.day-head {
  font-size: 0.9rem; margin: 1rem 0 0.4rem; padding: 0.3rem 0.6rem; background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; break-after: avoid;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}

/* Detailliste */
.ev {
  display: grid; grid-template-columns: 110px 1fr; gap: 0.75rem;
  padding: 0.6rem 0 0.6rem 0.7rem; border-left: 4px solid var(--cal); border-bottom: 1px solid var(--border);
  break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.ev-time { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ev h3 { margin: 0; font-size: 1rem; }
.sub { color: var(--muted); font-style: italic; }
.facts { display: flex; flex-wrap: wrap; gap: 0.1rem 0.9rem; color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }
.desc { margin: 0.3rem 0; white-space: pre-line; }
.note {
  margin: 0.3rem 0; white-space: pre-line; background: var(--changed-bg); padding: 0.15rem 0.45rem; border-radius: 4px;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.resources { margin-top: 0.3rem; }

.services { margin-top: 0.3rem; display: grid; gap: 0.15rem; }
.svc-group { display: grid; grid-template-columns: 120px 1fr; gap: 0.5rem; }
.svc-group-name { color: var(--muted); font-size: 0.78rem; }
.svc-items { display: flex; flex-wrap: wrap; gap: 0 0.9rem; }
.svc-name { color: var(--muted); }
.st-open { color: var(--danger); font-weight: 700; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.03em; }
.st-req { font-style: italic; }
.st-req-mark { display: inline-block; margin-left: 2px; color: var(--orange); font-weight: 700; font-style: normal; font-size: 0.72rem; }

/* Tabelle */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; background: #fafbfc; color: var(--muted); font-weight: 600; font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.03em; padding: 0.5rem 0.6rem; border-bottom: 2px solid var(--border);
}
.tbl td { vertical-align: top; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
.tbl tr { break-inside: avoid; }
.tbl thead { display: table-header-group; }
.tbl .services .svc-group { grid-template-columns: 1fr; gap: 0; }
.tbl .svc-items { flex-direction: column; }
.cal-edge { border-left: 4px solid var(--cal); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.nowrap { white-space: nowrap; }

/* Kompakt */
.compact .line {
  display: grid; grid-template-columns: 110px 1fr; gap: 0.6rem; padding: 0.15rem 0 0.15rem 0.5rem;
  border-left: 3px solid var(--cal); break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.l-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.l-svcs { display: block; font-size: 0.78rem; color: var(--muted); }
.unassigned { margin-top: 1.5rem; }

/* ── Druck / PDF ───────────────────────────────────────────────────────── */
@media print {
  .no-print, .sidebar, .sidebar-user, .mobile-topbar { display: none !important; }
  body, body.app-shell { display: block; background: #fff; }
  .content { max-width: none; margin: 0; padding: 0; }
  .layout { display: block; }
  .card.doc { border: 0; box-shadow: none; padding: 0; margin: 0; border-radius: 0; font-size: 10.5pt; }
  .doc.layout-table, .doc.layout-compact { font-size: 9.5pt; }
  .doc-head h1 { font-size: 16pt; }
  a { color: inherit; text-decoration: none; }
}

/* ── Mobil (am Ende, "screen and", damit der Druck nicht betroffen ist) ── */
@media screen and (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .filter-card { position: static; max-height: none; }
}
@media screen and (max-width: 880px) {
  body.app-shell { display: block; }
  .mobile-topbar { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 1200; transform: translateX(-100%);
    transition: transform 0.25s ease; box-shadow: 0 0 30px rgba(0, 0, 0, 0.25);
  }
  .sidebar.offen { transform: translateX(0); }
  .sidebar-backdrop.offen { display: block; }
  .content { padding: 1.25rem 1rem; max-width: none; }
  .page-header h1 { font-size: 1.2rem; }
  .card { padding: 1.1rem; }
  .doc { padding: 1.1rem; }
  .ev, .compact .line { grid-template-columns: 1fr; gap: 0.1rem; }
  .svc-group { grid-template-columns: 1fr; gap: 0; }
  .tbl { display: block; overflow-x: auto; }
  .doc-head { flex-direction: column; align-items: flex-start; }
}
