/* ==========================================================================
   Verwaltung – Gestaltung. Folgt der Website (Navy, Gold, Sand; Fraunces + Inter).
   ========================================================================== */
:root {
  --navy: #1B2A41; --navy-deep: #13202F; --navy-soft: #26395A;
  --gold: #C9A24B; --gold-dark: #A9853A; --gold-soft: rgba(201,162,75,.16);
  --bg: #FAF8F4; --sand: #EEEAE2; --sand-dark: #DED8CC; --white: #FFFFFF;
  --ink: #2B2B2B; --muted: #5E5E5E; --line: rgba(27,42,65,.09);
  --ok: #2E7D4F; --ok-soft: #E6F3EA; --warn: #B7791F; --warn-soft: #FFF4D6; --err: #B23A3A; --err-soft: #F8E6E6; --info: #2F5F8F; --info-soft: #E6EEF7;
  --serif: 'Fraunces', Georgia, serif; --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius: 12px; --shadow: 0 8px 26px rgba(27,42,65,.08); --side: 248px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); min-height: 100vh; }
a { color: var(--navy); } a:hover { color: var(--gold-dark); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--navy); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 .9em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.eyebrow { display: inline-block; font-size: .74rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-dark); margin-bottom: .5rem; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout --------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--navy-deep); color: #C9CDD6; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .brand { padding: 22px 22px 16px; color: var(--white); font-family: var(--serif); font-weight: 600; font-size: 1.15rem; text-decoration: none; display: block; line-height: 1.2; }
.side .brand small { display: block; font-family: var(--sans); font-size: .68rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-top: 4px; }
.side nav { padding: 6px 12px; display: grid; gap: 2px; flex: 1; overflow-y: auto; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #C9CDD6; text-decoration: none; font-weight: 500; font-size: .95rem; }
.side nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.side nav a:hover { background: rgba(255,255,255,.06); color: var(--white); }
.side nav a.active { background: rgba(201,162,75,.16); color: var(--white); }
.side nav a.active svg { opacity: 1; color: var(--gold); }
.side nav .sep { height: 1px; background: rgba(255,255,255,.08); margin: 8px 10px; }
.side .side-foot { padding: 14px 22px 18px; font-size: .8rem; color: #8E95A3; border-top: 1px solid rgba(255,255,255,.08); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side .side-foot a { color: #C9CDD6; text-decoration: none; }
.side .side-foot a:hover { color: var(--gold); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: rgba(250,248,244,.96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px); }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input[type=search] { width: 100%; padding: 10px 14px 10px 38px; border-radius: 999px; border: 1px solid var(--sand-dark); background: var(--white); font: inherit; }
.topbar .search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--white); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--line); z-index: 30; max-height: 60vh; overflow: auto; padding: 6px; }
.search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 8px; text-decoration: none; font-size: .92rem; }
.search-results a:hover { background: var(--sand); }
.search-results .grp { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-dark); padding: 8px 12px 4px; }
.topbar .spacer { flex: 1; }
.nav-toggle { display: none; background: none; border: 0; width: 40px; height: 40px; cursor: pointer; border-radius: 8px; padding: 0; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--navy); margin: 5px auto; }
.content { padding: 26px 28px 60px; max-width: 1280px; width: 100%; min-width: 0; overflow-x: clip; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.page-head h1 { margin-bottom: 0; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { text-decoration: none; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 84vw); z-index: 60; transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .side.open { transform: none; }
  .nav-toggle { display: block; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar .search { max-width: none; }
  .topbar .search input[type=search] { padding-left: 34px; font-size: .9rem; }
  .topbar > .btn { display: none; }
  .topbar .spacer { display: none; }
  .content { padding: 18px 16px 50px; }
  .overlay { position: fixed; inset: 0; background: rgba(19,32,47,.45); z-index: 55; }
}

/* Cards / Grid --------------------------------------------------------- */
.card { min-width: 0; background: var(--white); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(27,42,65,.04); padding: 22px 24px; }
.card + .card { margin-top: 18px; }
.card h2, .card h3 { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4, .grid-main { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }

/* KPI ------------------------------------------------------------------ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--white); border-radius: var(--radius); border: 1px solid var(--line); padding: 16px 18px; border-top: 3px solid var(--gold); }
.kpi .label { font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kpi .value { font-family: var(--serif); font-size: 1.9rem; font-weight: 600; color: var(--navy); line-height: 1.1; margin-top: 4px; }
.kpi .value small { font-family: var(--sans); font-size: .85rem; font-weight: 500; color: var(--muted); margin-left: 4px; }
.kpi .sub { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.kpi.navy { background: var(--navy); border-color: var(--navy); border-top-color: var(--gold); }
.kpi.navy .label, .kpi.navy .sub { color: #C9CDD6; } .kpi.navy .value { color: var(--white); } .kpi.navy .value small { color: #C9CDD6; }

/* Zählwerk ------------------------------------------------------------- */
.meter { height: 10px; background: var(--sand); border-radius: 999px; overflow: hidden; display: flex; }
.meter span { height: 100%; display: block; }
.meter .m-bezahlt { background: var(--navy); } .meter .m-reserviert { background: var(--gold); } .meter .m-ein { background: var(--ok); }
.meter-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--muted); margin-top: 8px; }
.meter-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.zw-big { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; text-align: center; }
.zw-big > div { background: var(--sand); border-radius: 12px; padding: 16px 10px; }
.zw-big .n { font-family: var(--serif); font-size: 2.2rem; font-weight: 600; color: var(--navy); line-height: 1; }
.zw-big .l { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.zw-big .n.ok { color: var(--ok); } .zw-big .n.gold { color: var(--gold-dark); }
.live { background: var(--navy); color: #E9E6DF; border-radius: 18px; padding: 28px; }
.live h2 { color: var(--white); } .live .muted { color: #C9CDD6; }
.live .zw-big > div { background: rgba(255,255,255,.07); } .live .zw-big .n { color: var(--white); } .live .zw-big .l { color: #C9CDD6; }
.live .zw-big .n.ok { color: #7FD69E; } .live .zw-big .n.gold { color: var(--gold); }
.live .meter { background: rgba(255,255,255,.12); height: 16px; }
.live .meter .m-ein { background: #7FD69E; }
.live-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #7FD69E; box-shadow: 0 0 0 0 rgba(127,214,158,.6); animation: pulse 1.6s infinite; }
.pulse.off { background: #B23A3A; animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(127,214,158,.6); } 70% { box-shadow: 0 0 0 10px rgba(127,214,158,0); } 100% { box-shadow: 0 0 0 0 rgba(127,214,158,0); } }

/* Tabellen ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--sand-dark); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; } tbody tr.link:hover td { background: #FCFAF6; }
.sub { display: block; font-size: .8rem; color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.empty strong { display: block; font-family: var(--serif); font-size: 1.15rem; color: var(--navy); margin-bottom: 4px; }

/* Badges --------------------------------------------------------------- */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; letter-spacing: .04em; background: var(--sand); color: var(--navy); white-space: nowrap; }
.badge.gold { background: var(--gold-soft); color: var(--gold-dark); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.navy { background: var(--navy); color: var(--white); }
.badge.dim { background: var(--sand); color: var(--muted); }

/* Buttons -------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 .9rem var(--sans); padding: 9px 16px; border-radius: 999px; border: 2px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, color .15s, border-color .15s, transform .1s; background: var(--sand); color: var(--navy); }
.btn:hover { background: var(--sand-dark); } .btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-gold { background: var(--gold); color: var(--navy-deep); } .btn-gold:hover { background: var(--gold-dark); color: var(--white); }
.btn-navy { background: var(--navy); color: var(--white); } .btn-navy:hover { background: var(--navy-soft); }
.btn-outline { background: transparent; border-color: var(--navy); color: var(--navy); } .btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-danger { background: var(--err-soft); color: var(--err); } .btn-danger:hover { background: var(--err); color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: .82rem; } .btn-lg { padding: 13px 24px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Formulare ------------------------------------------------------------ */
.form { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; } .form-row-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) { .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; } }
label { font-weight: 500; font-size: .88rem; display: block; margin-bottom: 5px; color: var(--navy); }
label .hint { font-weight: 400; color: var(--muted); }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--sand-dark); background: var(--white); color: var(--ink); }
input:disabled, select:disabled, textarea:disabled { background: var(--sand); color: var(--muted); }
textarea { min-height: 110px; resize: vertical; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; min-height: 260px; white-space: pre; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); margin-top: 2px; flex: none; }
.check label { margin: 0; font-weight: 400; color: var(--ink); }
.form-msg { display: none; padding: 12px 14px; border-radius: 8px; font-size: .92rem; }
.form-msg.ok { display: block; background: var(--ok-soft); color: var(--ok); } .form-msg.err { display: block; background: var(--err-soft); color: var(--err); }
.fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.fieldset > legend, .fieldset-title { font-family: var(--serif); font-weight: 600; color: var(--navy); font-size: 1rem; padding: 0 6px; }
.help { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.notice { background: var(--sand); border-left: 4px solid var(--gold); padding: 12px 16px; border-radius: 0 8px 8px 0; font-size: .9rem; color: var(--muted); }
.notice.warn { background: var(--warn-soft); border-color: var(--warn); color: #6B5214; }
.notice.err { background: var(--err-soft); border-color: var(--err); color: var(--err); }
.notice.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.notice p:last-child { margin: 0; }

/* Definitionen ----------------------------------------------------------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: .92rem; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filters > div { min-width: 150px; } .filters input, .filters select { padding: 8px 10px; }

/* Tabs ------------------------------------------------------------------ */
.tabs { display: flex; min-width: 0; gap: 2px; border-bottom: 1px solid var(--sand-dark); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--navy); border-color: var(--gold); }

/* Aufgaben / Listen ----------------------------------------------------- */
.tasks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.tasks li a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; background: var(--sand); text-decoration: none; color: var(--ink); font-size: .92rem; }
.tasks li a:hover { background: var(--sand-dark); }
.tasks .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); flex: none; }
.tasks .dot.err { background: var(--err); } .tasks .dot.info { background: var(--info); }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.timeline li { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.timeline li span:first-child { color: var(--muted); font-size: .8rem; }
.seminar-card { display: grid; gap: 10px; }
.seminar-card .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.seminar-card h3 { margin: 0; font-size: 1.05rem; }
.seminar-card .when { font-family: var(--serif); font-weight: 600; color: var(--navy); font-size: 1.1rem; }
.seminar-card .when small { display: block; font-family: var(--sans); font-size: .82rem; font-weight: 500; color: var(--muted); }
.seminar-card .nums { display: flex; flex-wrap: wrap; gap: 14px; font-size: .85rem; color: var(--muted); }
.seminar-card .nums b { color: var(--navy); font-size: 1rem; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chain a { padding: 8px 12px; border-radius: 10px; background: var(--sand); text-decoration: none; font-size: .88rem; }
.chain a.cur { background: var(--navy); color: var(--white); }
.chain .arrow { color: var(--gold-dark); }
.ticket-row .code { font-family: var(--serif); font-weight: 600; letter-spacing: .08em; color: var(--navy); font-size: 1rem; }
.qr-box { display: grid; place-items: center; padding: 12px; background: var(--white); border-radius: 12px; border: 1px solid var(--line); }
.qr-box svg { width: 220px; height: 220px; }
.copy { cursor: pointer; }

/* Dialog ------------------------------------------------------------------ */
dialog { border: 0; border-radius: 16px; padding: 0; box-shadow: 0 20px 60px rgba(19,32,47,.35); width: min(680px, 94vw); max-height: 92vh; }
dialog::backdrop { background: rgba(19,32,47,.5); }
dialog .dlg { padding: 24px 26px; display: grid; gap: 14px; max-height: 92vh; overflow: auto; }
dialog .dlg h2 { margin: 0; }
dialog .dlg-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
dialog.wide { width: min(960px, 96vw); }

/* Toast ------------------------------------------------------------------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--navy-deep); color: var(--white); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: .9rem; max-width: 380px; border-left: 4px solid var(--gold); animation: toast .2s ease; }
.toast.err { border-color: var(--err); } .toast.ok { border-color: #7FD69E; }
@keyframes toast { from { opacity: 0; transform: translateY(8px); } }

/* Login ------------------------------------------------------------------- */
.login-body { display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #26395A 0%, var(--navy) 55%, var(--navy-deep) 100%); }
.login-card { background: var(--white); border-radius: 18px; padding: 36px; width: min(420px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.3); border-top: 5px solid var(--gold); }
.login-card .brand { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--navy); margin-bottom: 18px; }
.login-card .brand small { font-family: var(--sans); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-dark); margin-left: 8px; }
.login-card form { display: grid; gap: 12px; margin-top: 12px; }
.login-card .btn { justify-content: center; }

.loading { padding: 40px; text-align: center; color: var(--muted); }
.diff { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; white-space: pre-wrap; background: #FCFAF6; border: 1px solid var(--line); border-radius: 10px; padding: 14px; max-height: 420px; overflow: auto; line-height: 1.5; }
.diff .add { background: var(--ok-soft); color: var(--ok); display: block; } .diff .del { background: var(--err-soft); color: var(--err); display: block; text-decoration: line-through; }
.placeholders { display: flex; flex-wrap: wrap; gap: 6px; }
.placeholders code { background: var(--sand); padding: 2px 8px; border-radius: 6px; font-size: .8rem; cursor: pointer; }
.print-only { display: none; }
@media print { .side, .topbar, .page-head .actions, .btn, .tabs { display: none !important; } .app { display: block; } .content { padding: 0; } .card { box-shadow: none; border: 1px solid #ccc; } }
