/* 13 DX Mitgliederverwaltung – Oberfläche
   Farben & Logo wie in der 13 DX Rufzeichenverwaltung: Nachtblau #1b2a38 + Gold #c5a46d */
:root {
  --navy: #1b2a38; --navy-2: #16222e; --navy-3: #131d27;
  --gold: #c5a46d; --gold-2: #b08e55; --gold-light: #f6efe2; --on-gold: #111111;
  --brand: var(--navy); --brand-dark: var(--navy-2); --brand-soft: #e8eaeb;
  --bg: #f5f7fb; --card: #ffffff; --text: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --ok: #0f7a3d; --ok-bg: #e7f6ed; --warn: #8a5a00; --warn-bg: #fff5db; --err: #b42318; --err-bg: #fdecea; --info-bg: #e8eaeb;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.55rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 1rem; }
.mb0 { margin-bottom: 0; }
.hidden { display: none !important; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: var(--navy); color: #dbe3f5; border-right: 3px solid var(--gold); flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar .brand { padding: 16px 16px 14px; font-weight: 700; color: #fff; font-size: 1rem; line-height: 1.25; border-bottom: 1px solid rgba(197,164,109,.35); display: flex; align-items: center; gap: 10px; text-decoration: none; }
.sidebar .brand .brand-logo { width: 48px; height: 48px; margin: 0; }
.sidebar .brand small { display: block; font-weight: 400; color: var(--gold); font-size: .78rem; }
.sidebar nav { padding: 8px 0; flex: 1; overflow-y: auto; }
.sidebar nav .group { padding: 12px 18px 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(197,164,109,.8); }
.sidebar nav a { display: flex; justify-content: space-between; align-items: center; padding: 7px 18px; color: #dbe3f5; text-decoration: none; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: var(--gold); }
.sidebar nav a.active { background: rgba(255,255,255,.07); border-left-color: var(--gold); color: var(--gold); }
.sidebar .user { padding: 12px 18px; border-top: 1px solid rgba(197,164,109,.35); font-size: .85rem; }
.sidebar .user form { display: inline; }
.sidebar .user button { background: none; border: 0; color: var(--gold); text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main > .content { flex: 1 0 auto; width: 100%; }
.topbar { display: none; }
.content { padding: 24px 28px 48px; max-width: 1320px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge-count { background: var(--gold); color: var(--on-gold); font-weight: 700; border-radius: 999px; padding: 0 7px; font-size: .75rem; }

@media (max-width: 900px) {
  .layout { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; width: 270px; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; padding: 8px 16px; position: sticky; top: 0; z-index: 40; border-bottom: 3px solid var(--gold); }
  .topbar .brand-logo { width: 36px; height: 36px; }
  .topbar button { background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 6px; padding: 4px 10px; font-size: 1.1rem; }
  .content { padding: 16px; }
}

/* Cards & grid */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; border: 1px solid #e6ecf2; }
.card > h2:first-child { margin-top: 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)); }
@media (max-width: 1000px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.stat { padding: 16px 18px; border-left: 4px solid var(--gold); }
.stat .num { font-size: 1.7rem; font-weight: 700; color: var(--brand); }
.stat .lbl { color: var(--muted); font-size: .85rem; }
.stat.alert .num { color: var(--err); }
dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 600px) { dl.kv { grid-template-columns: 1fr; } dl.kv dd { margin-bottom: 6px; } }

/* Tabellen */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.list th { text-align: left; font-weight: 600; color: var(--navy); background: #fafbfd; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 2px solid var(--gold); white-space: nowrap; }
table.list td { padding: 8px 10px; border-bottom: 1px solid #edf1f5; vertical-align: top; }
table.list tr:hover td { background: #f8fbfe; }
table.list tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: var(--brand-soft); }
table.list tr.hl td { background: var(--warn-bg); }
table.list .actions { white-space: nowrap; text-align: right; }

/* Badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: #e9eef3; color: #364656; white-space: nowrap; }
.badge.ok, .badge.aktiv, .badge.bezahlt, .badge.freigegeben, .badge.gesendet { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .badge.antrag, .badge.offen, .badge.unbestaetigt { background: var(--warn-bg); color: var(--warn); }
.badge.err, .badge.abgelehnt, .badge.fehler, .badge.storniert { background: var(--err-bg); color: var(--err); }
.badge.archiviert { background: #eceff3; color: #56616c; }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

/* Formulare */
form .row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 14px; }
.f { grid-column: span 6; display: flex; flex-direction: column; gap: 4px; }
.f.s2 { grid-column: span 2; } .f.s3 { grid-column: span 3; } .f.s4 { grid-column: span 4; } .f.s8 { grid-column: span 8; } .f.s9 { grid-column: span 9; } .f.s12 { grid-column: span 12; }
@media (max-width: 700px) { .f, .f.s2, .f.s3, .f.s4, .f.s8, .f.s9 { grid-column: span 12; } }
label { font-weight: 600; font-size: .88rem; }
label .req { color: var(--err); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel], input[type=number], input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #c5d0dc; border-radius: 7px; font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(197,164,109,.35); }
.f.error input, .f.error select, .f.error textarea { border-color: var(--err); background: #fffafa; }
.err-msg { color: var(--err); font-size: .82rem; }
.hint { color: var(--muted); font-size: .82rem; font-weight: 400; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input[type=text] { width: auto; min-width: 120px; padding: 5px 8px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; color: var(--brand); }
.yesno { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 4px; }
.yesno label { font-weight: 400; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.consent { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.consent:last-child { border-bottom: 0; }
.consent .q { font-weight: 600; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: 7px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.3; }
.btn:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn:active { background: var(--navy-3); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn.primary:hover { background: var(--gold-2); border-color: var(--gold-2); color: var(--on-gold); }
.btn.block { width: 100%; justify-content: center; }
.btn.secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn.secondary:hover { background: var(--navy); color: #fff; }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.sm { padding: 4px 10px; font-size: .84rem; }
.btn.link { background: none; border: 0; color: var(--brand); padding: 0; text-decoration: underline; font-weight: 400; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* Meldungen */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid transparent; }
.alert.success { background: var(--ok-bg); color: var(--ok); border-color: #bfe5cf; }
.alert.error { background: var(--err-bg); color: var(--err); border-color: #f5c6c1; }
.alert.warning { background: var(--warn-bg); color: var(--warn); border-color: #f3dfaa; }
.alert.info { background: var(--info-bg); color: var(--brand-dark); border-color: #c8dcf1; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; font-weight: 600; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--gold); }

/* Öffentliche Seiten (Kopf- und Fußzeile wie Rufzeichenverwaltung) */
body.public { display: flex; flex-direction: column; min-height: 100vh; }
body.public > main { flex: 1 0 auto; width: 100%; }
.pub-topbar { background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold); }
.pub-wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; min-height: 58px; }
.pub-topbar .brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.pub-topbar nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.pub-topbar nav a { color: #dbe3f5; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .95rem; }
.pub-topbar nav a:hover { color: var(--gold); }
.pub-topbar nav a.active { color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 0; }
.pub-topbar .nav-note { color: var(--gold); font-size: .9rem; padding: 6px 10px; }
.brand-logo { height: 44px; width: 44px; object-fit: contain; margin: -6px 0; display: block; flex-shrink: 0; }
.brand-mark { background: var(--gold); color: var(--on-gold); border-radius: 6px; padding: 2px 7px; font-weight: 700; }
.public-wrap { max-width: 860px; margin: 0 auto; padding: 28px 16px 40px; }
.public-wrap.narrow { max-width: 452px; padding-top: 8vh; }
.auth-card { border-top: 4px solid var(--gold); text-align: center; padding: 26px 24px; }
.auth-card > h1 { margin-top: 0; }
.auth-card > :not(.login-logo):not(h1):not(p.muted) { text-align: left; }
.login-logo { width: 140px; height: 140px; object-fit: contain; display: block; margin: 0 auto 10px; }
.auth-links { margin-top: 16px; line-height: 1.8; }

/* Fußzeile */
.foot { background: var(--navy); color: rgba(255,255,255,.75); border-top: 3px solid var(--gold); font-size: .9rem; padding: 18px 0 22px; margin-top: 2rem; }
.foot a { color: var(--gold); }
.foot a:hover { color: #fff; }
.foot-wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.foot-links span { opacity: .6; }
.foot-version { margin-left: auto; font-size: .8rem; opacity: .7; }
.foot-admin { font-size: .85rem; padding: 12px 0 14px; margin-top: 0; }
.foot-admin .foot-wrap { max-width: none; padding: 0 28px; }
@media (max-width: 760px) { .foot-wrap { flex-direction: column; gap: 4px; } .foot-version { margin-left: 0; } .foot-admin .foot-wrap { padding: 0 16px; } }

/* Installer */
.steps { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.steps span { flex: 1; min-width: 110px; padding: 8px 10px; border-radius: 7px; background: #e9eef3; color: var(--muted); font-size: .82rem; font-weight: 600; text-align: center; }
.steps span.done { background: var(--ok-bg); color: var(--ok); }
.steps span.cur { background: var(--navy); color: var(--gold); }
ul.req { list-style: none; padding: 0; margin: 0; }
ul.req li { padding: 6px 0; border-bottom: 1px solid #edf1f5; display: flex; justify-content: space-between; gap: 10px; }

/* Unterschrift */
.sig-wrap { border: 2px dashed #9fb3c8; border-radius: 10px; background: #fff; position: relative; touch-action: none; }
.sig-wrap canvas { display: block; width: 100%; height: 200px; cursor: crosshair; border-radius: 8px; }
.sig-wrap .sig-line { position: absolute; left: 6%; right: 6%; bottom: 46px; border-bottom: 1px solid #c6d2de; pointer-events: none; }
.sig-wrap .sig-hint { position: absolute; left: 6%; bottom: 24px; color: #9aabbd; font-size: .8rem; pointer-events: none; }
.sig-img { max-width: 320px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.cs-status { font-size: .85rem; margin-top: 4px; }
.cs-status.free { color: var(--ok); } .cs-status.taken { color: var(--err); } .cs-status.unknown { color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Filterleiste */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .f { grid-column: auto; min-width: 150px; flex: 1; }
.filters .f.grow { flex: 2; }
.cols-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.danger-zone { border-color: #f1c3bd; background: #fffafa; }
.empty { padding: 26px; text-align: center; color: var(--muted); }
@media print { .sidebar, .topbar, .pub-topbar, .foot, .page-head .actions, .btn { display: none !important; } .content { padding: 0; } body { background: #fff; } }
a.card { display: block; text-decoration: none; color: inherit; }
a.card:hover { border-color: #c8d7e6; }
.small.muted, p.small { word-break: break-word; }
.sidebar { position: sticky; top: 0; height: 100vh; }
@media (max-width: 900px) { .sidebar { position: fixed; height: auto; } }

.cs-suggest { margin-top: 8px; }
.cs-suggestions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.cs-suggestions .hint { width: 100%; }
.chip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; padding: 4px 12px; border-radius: 999px; border: 1px solid #e2cfa8; background: var(--gold-light); color: var(--navy); cursor: pointer; }
.chip:hover, .chip:focus { border-color: var(--gold); }

/* Häkchen, Fokus-Rahmen in Vereinsfarben */
input[type=checkbox], input[type=radio] { accent-color: var(--navy); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
legend { color: var(--navy); }
.card > h2:first-child { border-bottom: 2px solid var(--gold); padding-bottom: 8px; }
.card.stat { border-left: 4px solid var(--gold); }
.card.stat.alert { padding: 16px 18px; margin-bottom: 18px; color: inherit; background: var(--card); border: 1px solid #e6ecf2; border-left: 4px solid var(--err); border-radius: var(--radius); }
table.list td { overflow-wrap: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }

/* 1.5.0: Datenimport & Backup, Kassenbuch-Abgleich */
pre.log { background: #f6f8fb; border: 1px solid #e6ecf2; border-radius: 8px; padding: 12px 14px; font-size: .8rem; line-height: 1.45; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.badge.geloescht { background: #eceff3; color: #5b6774; }
.f label.check { display: block; margin: 4px 0; font-weight: normal; }

/* 1.6.0: Startseite mit Kacheln, Veranstaltungen, Dokumente */
.f.s6 { grid-column: span 6; }
@media (max-width: 700px) { .f.s6 { grid-column: span 12; } }
.public-wrap.wide { max-width: 1280px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; align-items: start; }
.tiles .tile { margin-bottom: 0; min-width: 0; }
.tile h2 { font-size: 1.1rem; margin-top: 0; }
.tile h3 { font-size: .98rem; margin: 10px 0 4px; }
.tile .f { margin-bottom: 10px; }
.tile-wide { grid-column: span 2; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .tiles { grid-template-columns: 1fr; } .tile-wide { grid-column: auto; } }
.tile-list { list-style: none; padding: 0; margin: 0; }
.tile-list li { padding: 7px 0; border-bottom: 1px solid #edf1f5; overflow-wrap: anywhere; }
.tile-list li:last-child { border-bottom: 0; }
.tile-list.docs li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ftype { display: inline-block; min-width: 38px; text-align: center; font-size: .68rem; font-weight: 700; letter-spacing: .03em; padding: 2px 5px; border-radius: 4px; background: var(--navy); color: var(--gold); }
.tile-item { padding: 8px 0; border-bottom: 1px solid #edf1f5; }
.tile-item:last-of-type { border-bottom: 0; }
.tile-item h3 { margin: 2px 0; }
.tile-item h3 a { text-decoration: none; }
.tile-item h3 a:hover { text-decoration: underline; }
.tile-more { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: .9rem; font-weight: 600; }
.tile-wide .tile-item { display: block; }
.bday-today { background: var(--gold-light); border-left: 3px solid var(--gold); padding: 6px 10px; border-radius: 6px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cal-head a { text-decoration: none; font-size: 1.2rem; padding: 0 8px; font-weight: 700; }
table.cal { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: center; font-size: .88rem; }
table.cal th { color: var(--muted); font-weight: 600; font-size: .75rem; padding: 4px 0; }
table.cal td { padding: 2px; }
table.cal td span, table.cal td a { display: block; padding: 5px 0; border-radius: 6px; }
table.cal td.has-event a { background: var(--gold-light); color: var(--navy); font-weight: 700; text-decoration: none; box-shadow: inset 0 -2px 0 var(--gold); }
table.cal td.has-event a:hover { background: var(--gold); color: var(--on-gold); }
table.cal td.today span, table.cal td.today a { background: var(--navy); color: #fff; font-weight: 700; }
table.cal td.today.has-event a { color: var(--gold); }
.event-row { display: grid; grid-template-columns: 220px 1fr; gap: 6px 16px; padding: 10px 0; border-bottom: 1px solid #edf1f5; }
.event-row:last-child { border-bottom: 0; }
.event-row .when { color: var(--muted); font-size: .9rem; }
.event-row h3 { margin: 0 0 2px; font-size: 1rem; }
.event-row.cancelled h3 a { text-decoration: line-through; color: var(--muted); }
@media (max-width: 640px) { .event-row { grid-template-columns: 1fr; } }
.prose { line-height: 1.65; overflow-wrap: anywhere; }
.code-copy { user-select: all; word-break: break-all; }
