/* Solid Mitglieder Nummer Generator - Linksjugend ['solid] Siegen-Wittgenstein */

:root {
  color-scheme: dark;

  --bg: #0e0e10;
  --surface: #141417;
  --surface-2: #1a1a1e;
  --surface-3: #212126;
  --line: #26262c;
  --line-2: #34343c;

  --text: #e8e8ea;
  --text-2: #9b9ba4;
  --text-3: #6d6d76;

  --red: #e3001b;
  --red-hover: #ff0a26;
  --red-ink: #ff5262;
  --red-wash: #2a0f13;

  --amber: #d99728;
  --amber-ink: #e8ab45;
  --amber-wash: #241a0c;

  --green-ink: #4cb87c;
  --magenta-ink: #ff5aa8;

  --mono: ui-monospace, "DejaVu Sans Mono", "Liberation Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, "Liberation Sans", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

a { color: var(--text); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--red); }

::selection { background: var(--red); color: #fff; }

kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text-2);
}

/* ------------------------------ Formulare ------------------------------ */

.field { display: block; }
.field > span { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.field + .field { margin-top: 14px; }

input[type="text"], input[type="password"], input[type="date"],
input[type="search"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--red);
  background: var(--surface-3);
}

input::placeholder { color: var(--text-3); }

input[type="checkbox"] {
  appearance: none;
  margin: 0;
  width: 15px;
  height: 15px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--surface-2);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  vertical-align: -2px;
}
input[type="checkbox"]::after {
  content: "";
  width: 8px; height: 8px;
  transform: scale(0);
  box-shadow: inset 1em 1em #fff;
  clip-path: polygon(14% 44%, 0 65%, 40% 100%, 100% 16%, 84% 0, 38% 70%);
}
input[type="checkbox"]:checked { background: var(--red); border-color: var(--red); }
input[type="checkbox"]:checked::after { transform: scale(1); }
input[type="checkbox"].warn:checked { background: var(--amber); border-color: var(--amber); }
input[type="checkbox"]:disabled { opacity: .4; cursor: not-allowed; }
input:focus-visible { outline: 1px solid var(--red); outline-offset: 1px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check-inline { font-size: 13px; color: var(--text-2); }

.choice { display: flex; gap: 0; }
.choice label {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-2);
}
.choice label + label { border-left: 0; }
.choice input { appearance: none; width: 9px; height: 9px; border: 1px solid var(--line-2); border-radius: 50%; margin: 0; }
.choice label:has(input:checked) { background: var(--red-wash); border-color: var(--red); color: var(--text); }
.choice label:has(input:checked) + label { border-left-color: var(--red); }
.choice label:has(input:checked) input { background: var(--red); border-color: var(--red); }

.with-button { display: flex; gap: 6px; }
.with-button input { flex: 1; font-family: var(--mono); }

.note { font-size: 12.5px; color: var(--text-2); margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------ Buttons ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--text-3); }
.btn:focus-visible { outline: 1px solid var(--red); outline-offset: 1px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); border-color: var(--red-hover); }

.btn-small { padding: 4px 9px; font-size: 12.5px; font-weight: 500; }
.btn-block { display: flex; width: 100%; padding: 10px 14px; font-size: 14.5px; }
.btn-block + .btn-block { margin-top: 8px; }

.link {
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.link:hover { color: var(--text); border-bottom-color: var(--red); }

.icon {
  width: 22px; height: 22px;
  padding: 0;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  color: var(--text-3);
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
}
.icon:hover { color: var(--text); border-color: var(--line-2); background: var(--surface-2); }
.icon-danger:hover { color: var(--red-ink); border-color: var(--red); background: var(--red-wash); }
.icon[disabled] { opacity: .3; cursor: not-allowed; }
.icon[disabled]:hover { color: var(--text-3); border-color: transparent; background: none; }

.x {
  width: 24px; height: 24px;
  padding: 0;
  font-size: 13px;
  color: var(--text-3);
  background: none;
  border: 0;
  cursor: pointer;
}
.x:hover { color: var(--text); }

/* ------------------------------ Meldungen ------------------------------ */

.msg {
  margin: 0 0 16px;
  padding: 9px 12px;
  font-size: 13px;
  border-left: 2px solid;
  background: var(--surface-2);
}
.msg-error { border-color: var(--red); color: var(--red-ink); background: var(--red-wash); }
.msg-warn { border-color: var(--amber); color: var(--amber-ink); background: var(--amber-wash); }

/* ------------------------------ Anmeldung ------------------------------ */

.auth-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-box {
  width: min(380px, 100%);
  border-top: 3px solid var(--red);
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 30px 30px 26px;
}

.auth-logo { display: block; width: 150px; height: auto; color: var(--text); margin-bottom: 26px; }

.auth-head { margin-bottom: 22px; }
.auth-head h1 { font-size: 18px; }
.auth-head p { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }

.auth-box form .field + .field { margin-top: 12px; }
.auth-box form .note { margin: 12px 0; }
.auth-box form button { margin-top: 18px; }

.auth-foot {
  margin: 22px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-3);
}

/* ------------------------------ Kopfzeile ------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-logo { width: 84px; height: auto; color: var(--text); flex: none; }

.topbar-title { min-width: 0; padding-left: 16px; border-left: 1px solid var(--line-2); }
.topbar-title strong { display: block; font-size: 14px; font-weight: 700; }
.topbar-title span { display: block; font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-nav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar-nav form { display: contents; }

.whoami { font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 7px; }
.tag-admin {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 1px 5px;
  color: var(--red-ink);
  border: 1px solid var(--red);
}

main { max-width: 1560px; margin: 0 auto; padding: 18px 20px 40px; }

/* ------------------------------ Kennzahlen ------------------------------ */

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.sum-item { font-size: 12.5px; color: var(--text-2); display: inline-flex; align-items: baseline; gap: 6px; }
.sum-item b {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sum-item.is-warn b { color: var(--amber-ink); }
.sum-item.is-over b { color: var(--red-ink); }

/* ------------------------------ Werkzeugleiste ------------------------------ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.toolbar .search { flex: 0 1 300px; min-width: 190px; }
.toolbar-actions { margin-left: auto; display: flex; gap: 8px; }

.filters { display: flex; flex-wrap: wrap; }

.filter {
  padding: 7px 11px;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--line-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.filter + .filter { border-left: 0; }
.filter:first-child { border-radius: 2px 0 0 2px; }
.filter:last-child { border-radius: 0 2px 2px 0; }
.filter:hover { color: var(--text); background: var(--surface-2); }
.filter i { font-style: normal; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.filter[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.filter[aria-pressed="true"] + .filter { border-left-color: var(--red); }
.filter[aria-pressed="true"] i { color: rgba(255, 255, 255, .75); }

.bulkbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--red-wash);
  border-left: 2px solid var(--red);
  font-size: 13px;
}
.bulkbar .label { font-weight: 600; margin-right: auto; }

/* ------------------------------ Tabelle ------------------------------ */

.table-wrap { overflow-x: auto; border-top: 1px solid var(--line-2); }

table { width: 100%; border-collapse: collapse; }

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); }
thead th .arrow { display: inline-block; width: 9px; font-style: normal; }
thead th[data-dir="asc"] { color: var(--text); }
thead th[data-dir="desc"] { color: var(--text); }
thead th[data-dir="asc"] .arrow::after { content: "\2191"; }
thead th[data-dir="desc"] .arrow::after { content: "\2193"; }

tbody td { padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
tbody tr.member-row:hover > td { background: var(--surface); }
tbody tr.is-overdue > td { background: var(--red-wash); }
tbody tr.is-overdue > td:first-child { box-shadow: inset 2px 0 0 var(--red); }
tbody tr.is-warn > td { background: var(--amber-wash); }
tbody tr.is-warn > td:first-child { box-shadow: inset 2px 0 0 var(--amber); }
tbody tr.is-selected > td:first-child { box-shadow: inset 3px 0 0 var(--red-ink); }

td.col-check, th.col-check { width: 34px; }
td.col-toggle, th.col-toggle { width: 24px; padding-left: 0; padding-right: 0; }
td.col-mid, th.col-mid { text-align: center; width: 66px; }
td.col-actions { text-align: right; white-space: nowrap; }

.empty-row td { padding: 40px 12px; text-align: center; color: var(--text-2); }

.toggle {
  width: 18px; height: 18px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  color: var(--text-3);
  background: none;
  border: 0;
  cursor: pointer;
  transition: transform .12s;
}
.toggle:hover { color: var(--text); }
.toggle.is-open { transform: rotate(90deg); color: var(--text); }

.code {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--text);
}
.code-solid {
  font-weight: 700;
  padding: 2px 7px;
  background: var(--red);
  color: #fff;
}

.counts { display: inline-flex; align-items: center; gap: 6px; }
.counts b { font-variant-numeric: tabular-nums; min-width: 12px; display: inline-block; }

.tag {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 5px;
  white-space: nowrap;
  border: 1px solid;
}
.tag-bgv { color: var(--magenta-ink); border-color: color-mix(in srgb, var(--magenta-ink) 40%, transparent); }
.tag-plenum { color: var(--red-ink); border-color: color-mix(in srgb, var(--red-ink) 40%, transparent); }

.days { display: inline-flex; align-items: baseline; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.days i { font-style: normal; font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.days-warn i { color: var(--amber-ink); }
.days-over { color: var(--red-ink); font-weight: 600; }
.days-over i { color: var(--red-ink); }

input.note {
  padding: 3px 6px;
  font-size: 13px;
  background: transparent;
  border: 1px solid transparent;
  min-width: 110px;
}
input.note:hover { border-color: var(--line-2); }
input.note:focus { background: var(--surface-2); border-color: var(--red); }

.detail-row > td { padding: 0; background: var(--surface); }
.detail { padding: 10px 14px 14px 68px; }
.detail-head {
  display: flex; align-items: center; gap: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 9px;
}
.entries { display: flex; flex-wrap: wrap; gap: 6px; }
.entry {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 4px 3px 6px;
  border: 1px solid var(--line-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.entry button {
  width: 16px; height: 16px;
  padding: 0;
  font-size: 10px;
  line-height: 1;
  color: var(--text-3);
  background: none;
  border: 0;
  cursor: pointer;
}
.entry button:hover { color: var(--red-ink); }

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--text-3);
}
.legend .swatch { width: 9px; height: 9px; display: inline-block; }
.legend .swatch-red { background: var(--red); }
.legend .swatch-amber { background: var(--amber); }
.legend .sep { width: 1px; height: 11px; background: var(--line-2); margin: 0 4px; }

/* ------------------------------ Dialoge ------------------------------ */

dialog {
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-top: 3px solid var(--red);
  border-radius: 2px;
  width: min(460px, calc(100vw - 28px));
  max-height: calc(100dvh - 40px);
}
dialog.wide { width: min(760px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(0, 0, 0, .68); }

dialog header {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
dialog header h2 { font-size: 15px; flex: 1; }
dialog .body { padding: 18px 16px; }
dialog .body > * + * { margin-top: 16px; }
dialog footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* Buchstaben-Eingabe */

.namecode { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.namecode-group > span { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.namecode .boxes { display: flex; gap: 5px; }
.letter {
  width: 44px; height: 52px;
  padding: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  color: var(--text);
}
.letter:focus { border-color: var(--red); background: var(--surface-3); }

.namecode-out { margin-left: auto; text-align: right; }
.namecode-out span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.namecode-out b { font-family: var(--mono); font-size: 22px; letter-spacing: .14em; }
.namecode-out b.placeholder { color: var(--text-3); }

.code-out {
  padding: 20px;
  background: var(--red);
  color: #fff;
  text-align: center;
}
.code-out > span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.code-out > b { display: block; font-family: var(--mono); font-size: 42px; font-weight: 700; letter-spacing: .1em; margin: 6px 0 8px; }
.code-out > span:last-child { text-transform: none; letter-spacing: 0; font-size: 12.5px; opacity: .9; }
.code-out > span:last-child b { font-family: var(--mono); letter-spacing: .08em; }

.code-list { display: flex; flex-wrap: wrap; gap: 5px; max-height: 120px; overflow-y: auto; }

/* Benutzerverwaltung */

.user-table { border-top: 1px solid var(--line-2); }
.user-table th {
  position: static;
  background: none;
  padding: 7px 8px;
}
.user-table td { padding: 8px; vertical-align: middle; font-size: 13.5px; }
.user-table td:first-child b { font-weight: 600; }
.user-table .self {
  font-style: normal;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  border: 1px solid var(--line-2);
  padding: 0 4px;
  margin-left: 6px;
}
.user-table .col-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }

.user-form { border-top: 1px solid var(--line); padding-top: 16px; }
.user-form h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 12px; }
.user-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.user-form-grid .field + .field { margin-top: 0; }
.user-form .check { margin-top: 14px; }
.user-form .note { margin-top: 10px; }
.user-form button[type="submit"] { margin-top: 14px; }

.cred-out { border: 1px solid var(--line-2); }
.cred-out > div { display: flex; align-items: baseline; gap: 14px; padding: 11px 13px; }
.cred-out > div + div { border-top: 1px solid var(--line); }
.cred-out span { font-size: 12px; color: var(--text-2); width: 116px; flex: none; }
.cred-out b { font-family: var(--mono); font-size: 15px; word-break: break-all; }

/* ------------------------------ Hinweise ------------------------------ */

.toasts {
  position: fixed;
  left: 20px; bottom: 20px;
  z-index: 100;
  display: grid;
  gap: 6px;
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  padding: 9px 13px;
  font-size: 13px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--text-3);
}
.toast-ok { border-left-color: var(--green-ink); }
.toast-err { border-left-color: var(--red); color: var(--red-ink); }
.toast-info { border-left-color: var(--red); }

/* ------------------------------ Schmale Schirme ------------------------------ */

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 10px 14px; }
  .topbar-title { padding-left: 14px; }
  .topbar-nav { margin-left: auto; gap: 14px; }
  .toolbar-actions { margin-left: 0; }
  .toolbar .search { flex: 1 1 100%; }
  td.hide-sm, th.hide-sm { display: none; }
  .user-form-grid { grid-template-columns: 1fr; }
  .detail { padding-left: 20px; }
}

@media print {
  .topbar, .toolbar, .bulkbar, .summary, .legend, .toasts,
  .col-check, .col-toggle, .col-actions { display: none !important; }
  body { background: #fff; color: #000; }
  .table-wrap { overflow: visible; }
  tbody td { border-color: #ccc; }
}
