:root {
  --bg: #0d0f1a;
  --bg-2: #121526;
  --surface: #171a2e;
  --surface-2: #1e2238;
  --surface-3: #262b45;
  --line: #2a2f4b;
  --line-soft: #222740;
  --text: #e9ebf8;
  --text-2: #a6abc8;
  --text-3: #6f7596;
  --accent: #8b7cff;
  --accent-2: #6d5ef0;
  --accent-soft: rgba(139, 124, 255, 0.14);
  --paid: #34d399;
  --paid-bg: rgba(52, 211, 153, 0.14);
  --open: #f87171;
  --open-bg: rgba(248, 113, 113, 0.1);
  --paused: #fbbf6b;
  --paused-bg: rgba(251, 191, 107, 0.14);
  --exempt: #60a5fa;
  --exempt-bg: rgba(96, 165, 250, 0.14);
  --none-bg: rgba(255, 255, 255, 0.025);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.6);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f4f5fb;
    --bg-2: #eceef8;
    --surface: #ffffff;
    --surface-2: #f6f7fc;
    --surface-3: #eceef7;
    --line: #dfe2f0;
    --line-soft: #eceef6;
    --text: #171a2e;
    --text-2: #555b7c;
    --text-3: #8a90ad;
    --accent: #6d5ef0;
    --accent-2: #5a4ae0;
    --accent-soft: rgba(109, 94, 240, 0.1);
    --paid: #0f9f6e;
    --paid-bg: rgba(16, 185, 129, 0.13);
    --open: #dc4b4b;
    --open-bg: rgba(239, 68, 68, 0.08);
    --paused: #c27a12;
    --paused-bg: rgba(245, 158, 11, 0.16);
    --exempt: #2f74d0;
    --exempt-bg: rgba(59, 130, 246, 0.12);
    --none-bg: rgba(20, 24, 50, 0.035);
    --shadow: 0 10px 40px -16px rgba(30, 35, 80, 0.25);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 24px;
  padding: 20px 14px;
  background: var(--bg-2);
  border-right: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; color: var(--text); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), #c06cf6);
  box-shadow: 0 6px 20px -6px var(--accent);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-mark path { fill: rgba(255,255,255,.18); stroke: #fff; stroke-width: 1.6; }
.brand-mark .tick { fill: none; stroke-width: 2.6; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-family: var(--display); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--text-3); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active svg { color: var(--accent); }
body:not(.is-admin) .admin-only { display: none !important; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.mode-pill {
  font-size: 12px; padding: 8px 10px; border-radius: 10px;
  background: var(--paused-bg); color: var(--paused); line-height: 1.4;
}

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar h1 { font-family: var(--display); font-size: 20px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; }
.view { padding: 28px 32px 48px; min-width: 0; }

.loading { display: flex; align-items: center; gap: 12px; color: var(--text-2); padding: 40px 0; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons & Inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent-2); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--open); }
.btn-danger:hover { background: var(--open-bg); }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center;
  border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-2); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; }
.search .input { padding-left: 34px; height: 38px; }

.chips { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); }
.chips button {
  border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 8px;
  color: var(--text-2); font-weight: 600; font-size: 12px; cursor: pointer;
}
.chips button.on { background: var(--surface-3); color: var(--text); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head .btn { margin-left: auto; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }

/* ---------- Welcome ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 36px 36px 32px; border-radius: 20px;
  background:
    radial-gradient(600px 260px at 85% -20%, rgba(192, 108, 246, .35), transparent 70%),
    radial-gradient(500px 300px at 0% 120%, rgba(109, 94, 240, .35), transparent 70%),
    var(--surface);
  border: 1px solid var(--line-soft);
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 32px 32px; opacity: .35;
  mask-image: radial-gradient(ellipse at 70% 0%, #000, transparent 70%);
}
.hero > * { position: relative; z-index: 1; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.hero h2 { font-family: var(--display); font-size: clamp(26px, 4vw, 40px); line-height: 1.1; margin: 10px 0 12px; letter-spacing: -.02em; }
.hero p { max-width: 640px; color: var(--text-2); margin: 0 0 8px; white-space: pre-line; }
.hero-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.stat { padding: 18px 20px; }
.stat .label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.stat .value { font-family: var(--display); font-size: 28px; font-weight: 600; margin-top: 6px; letter-spacing: -.02em; }
.stat .value small { font-size: 15px; color: var(--text-3); font-weight: 500; }
.stat .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: 12px; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--paid), #6ee7b7); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.announce { padding: 14px 0; border-top: 1px solid var(--line-soft); display: flex; gap: 12px; }
.announce:first-of-type { border-top: 0; padding-top: 0; }
.announce h3 { margin: 0 0 3px; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.announce p { margin: 0; color: var(--text-2); white-space: pre-line; }
.announce time { font-size: 12px; color: var(--text-3); }
.announce .grow { flex: 1; min-width: 0; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.empty { color: var(--text-3); padding: 18px 0; text-align: center; }

.open-list { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow: auto; margin: 0 -8px; }
.open-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; }
.open-row:hover { background: var(--surface-2); }
.avatar {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 12px; color: #fff;
}
.open-row .name { font-weight: 600; }
.open-row .count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--open); background: var(--open-bg); padding: 3px 9px; border-radius: 99px; }

/* ---------- Beitragstabelle ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { width: 260px; max-width: 100%; }
.toolbar .spacer { flex: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

.table-wrap {
  overflow: auto; max-height: calc(100vh - 230px);
  border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface);
}
table.fees { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.fees th, .fees td { border-bottom: 1px solid var(--line-soft); padding: 0; height: 48px; }
.fees thead th {
  position: sticky; top: 0; z-index: 3; background: var(--surface-2);
  font-size: 12px; font-weight: 600; color: var(--text-2); text-align: center; height: 52px;
}
.fees thead th .y { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; }
.fees thead th.current { color: var(--accent); }
.fees thead th.current::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px; background: var(--accent); }
.fees .c-name, .fees .c-tier { position: sticky; z-index: 2; background: var(--surface); text-align: left; }
.fees thead .c-name, .fees thead .c-tier { z-index: 4; background: var(--surface-2); padding: 0 14px; }
.fees .c-name { left: 0; width: 240px; min-width: 240px; padding: 0 14px; }
.fees .c-tier { left: 240px; width: 104px; min-width: 104px; padding: 0 10px; border-right: 1px solid var(--line); box-shadow: 6px 0 12px -10px rgba(0,0,0,.6); }
.fees tbody tr:hover td { background-color: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.fees tbody tr:hover .c-name, .fees tbody tr:hover .c-tier { background: var(--surface-2); }
.member-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.member-cell .avatar { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.member-cell .txt { min-width: 0; line-height: 1.25; }
.member-cell .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 170px; }
.member-cell .sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 170px; }
.tier { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tier.t0 { background: rgba(251, 191, 36, .14); color: #f5c451; }
.tier.t1 { background: rgba(52, 211, 153, .14); color: var(--paid); }
.tier.t2 { background: rgba(192, 132, 252, .16); color: #c99cff; }
.tier.t3 { background: rgba(96, 165, 250, .14); color: var(--exempt); }

.fees td.m { width: 92px; min-width: 92px; text-align: center; }
.cell {
  width: 100%; height: 100%; border: 0; background: transparent; cursor: default;
  display: flex; align-items: center; justify-content: center; gap: 4px; padding: 6px;
  font-size: 11.5px; font-weight: 600; position: relative;
}
body.can-edit .cell { cursor: pointer; }
.cell .dot {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  transition: transform .12s;
}
body.can-edit .cell:hover .dot { transform: scale(1.12); }
.cell .dot svg { width: 14px; height: 14px; stroke-width: 2.6; }
.cell.s-paid { background: var(--paid-bg); }
.cell.s-paid .dot { background: var(--paid); color: #06281c; }
.cell.s-open .dot { border: 1.6px dashed color-mix(in srgb, var(--open) 70%, transparent); }
.cell.s-open.past { background: var(--open-bg); }
.cell.s-paused { background: var(--paused-bg); color: var(--paused); }
.cell.s-paused .dot { background: color-mix(in srgb, var(--paused) 25%, transparent); color: var(--paused); }
.cell.s-exempt { background: var(--exempt-bg); color: var(--exempt); }
.cell.s-exempt .dot { background: color-mix(in srgb, var(--exempt) 25%, transparent); color: var(--exempt); }
.cell.s-none { background: repeating-linear-gradient(135deg, var(--none-bg) 0 6px, transparent 6px 12px); }
.cell.s-none .dot { width: 10px; height: 2px; border-radius: 2px; background: var(--line); }
.cell .note-txt { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.cell.has-note::after { content: ''; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cell.flash { animation: flash .5s; }
@keyframes flash { from { box-shadow: inset 0 0 0 2px var(--accent); } to { box-shadow: inset 0 0 0 2px transparent; } }
.fees tfoot td {
  position: sticky; bottom: 0; z-index: 3; background: var(--surface-2); font-size: 12px; text-align: center;
  color: var(--text-2); font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; height: 44px;
}
.fees tfoot .c-name, .fees tfoot .c-tier { z-index: 4; background: var(--surface-2); }
.mini-bar { width: 52px; height: 4px; border-radius: 4px; background: var(--surface-3); margin: 4px auto 0; overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--paid); }

/* ---------- Mitglieder ---------- */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.member-card { padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.member-card .avatar { width: 42px; height: 42px; border-radius: 12px; font-size: 14px; }
.member-card .info { flex: 1; min-width: 0; }
.member-card h3 { margin: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-card dl { margin: 8px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; }
.member-card dt { color: var(--text-3); }
.member-card dd { margin: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-card .streak { display: flex; gap: 3px; margin-top: 10px; }
.member-card .streak i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-3); }
.member-card .streak i.paid { background: var(--paid); }
.member-card .streak i.paused { background: var(--paused); }
.member-card .streak i.exempt { background: var(--exempt); }
.member-card .streak i.open { background: transparent; box-shadow: inset 0 0 0 1.5px var(--open); }
.member-card .streak i.none { background: var(--none-bg); box-shadow: inset 0 0 0 1px var(--line-soft); }

/* ---------- Settings ---------- */
.settings { display: grid; gap: 14px; max-width: 860px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.month-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.month-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line-soft); font-size: 12px; font-weight: 600; }
.month-chip button { width: 22px; height: 22px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: var(--text-3); display: grid; place-items: center; }
.month-chip button:hover { background: var(--open-bg); color: var(--open); }
.month-chip svg { width: 12px; height: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Modal / Popover / Toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(5, 6, 15, .6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); animation: pop .18s; }
.modal-head { display: flex; align-items: center; padding: 18px 20px 6px; }
.modal-head h3 { margin: 0; font-family: var(--display); font-size: 18px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 12px 20px; display: grid; gap: 14px; }
.modal-foot { padding: 12px 20px 20px; display: flex; gap: 8px; justify-content: flex-end; }
.modal-foot .left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.popover {
  position: fixed; z-index: 50; width: 260px; padding: 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); animation: pop .12s;
}
.popover h4 { margin: 0 0 10px; font-size: 13px; }
.popover h4 span { color: var(--text-3); font-weight: 500; }
.status-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.status-opt { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 9px; border: 1px solid var(--line-soft); background: var(--surface-2); cursor: pointer; font-size: 12px; font-weight: 600; text-align: left; }
.status-opt:hover { border-color: var(--line); }
.status-opt.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.status-opt i { width: 12px; height: 12px; border-radius: 4px; }
.sw-paid { background: var(--paid); }
.sw-open { box-shadow: inset 0 0 0 1.6px var(--open); }
.sw-paused { background: var(--paused); }
.sw-exempt { background: var(--exempt); }
.sw-none { background: repeating-linear-gradient(135deg, var(--text-3) 0 2px, transparent 2px 4px); }

.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 11px 16px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 500; animation: pop .2s; max-width: 340px; }
.toast.err { border-color: color-mix(in srgb, var(--open) 50%, var(--line)); color: var(--open); }

.lock { min-height: 70vh; display: grid; place-items: center; }
.lock .card { width: min(380px, 100%); text-align: center; }
.lock h2 { font-family: var(--display); margin: 0 0 6px; }

.scrim { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 70; width: 268px; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,.5); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; }
  .view { padding: 16px 16px 40px; }
  .hero { padding: 26px 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .fees .c-name { width: 150px; min-width: 150px; padding: 0 10px; }
  .fees .c-tier { display: none; }
  .member-cell .avatar { display: none; }
  .member-cell .nm, .member-cell .sub { max-width: 130px; }
  .fees td.m { width: 72px; min-width: 72px; }
  .toolbar .search { width: 100%; }
  .table-wrap { max-height: calc(100vh - 260px); }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 22px; }
  .topbar-actions .btn span { display: none; }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .tier.t0 { background: rgba(217, 119, 6, .12); color: #b45309; }
  :root:not([data-theme='dark']) .tier.t2 { background: rgba(147, 51, 234, .1); color: #7e22ce; }
}

/* ---------- Konten ---------- */
.user-box { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-soft); }
.user-box .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
.user-box .who { min-width: 0; flex: 1; line-height: 1.25; }
.user-box .who strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-box .who small { color: var(--text-3); font-size: 11.5px; }
.user-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.role { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.role.admin { background: var(--accent-soft); color: var(--accent); }
.role.officer { background: var(--exempt-bg); color: var(--exempt); }
.role.member { background: var(--surface-3); color: var(--text-2); }
.role.off { background: var(--open-bg); color: var(--open); }
.users-table { width: 100%; border-collapse: collapse; }
.users-table th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 600; padding: 0 10px 10px; border-bottom: 1px solid var(--line-soft); }
.users-table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.users-table tr:last-child td { border-bottom: 0; }
.users-table tr.is-off td { opacity: .55; }
.users-table .u { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.users-table .u .avatar { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }
.users-table .you { font-size: 11px; color: var(--text-3); font-weight: 500; }
.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.role-card { padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-soft); font-size: 12.5px; color: var(--text-2); }
.role-card .role { margin-bottom: 8px; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 99px; background: var(--surface-3); position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent-2); }
.switch input:checked::after { transform: translateX(18px); }
.pw-row { display: flex; gap: 6px; }
.pw-row .input { flex: 1; }
.lock .field label { text-align: left; }
@media (max-width: 820px) {
  .role-grid { grid-template-columns: 1fr; }
  .users-table .hide-sm { display: none; }
}

/* ---------- FWC, Kicken, Historie ---------- */
body:not(.can-edit) .edit-only { display: none !important; }
/* Rein FWC: eigener Status in Magenta */
:root { --fwc: #e879f9; --fwc-bg: rgba(232, 121, 249, .14); }
@media (prefers-color-scheme: light) { :root:not([data-theme='dark']) { --fwc: #a21caf; --fwc-bg: rgba(192, 38, 211, .1); } }
.sw-fwc { background: var(--fwc); }
.cell.s-fwc { background: var(--fwc-bg); color: var(--fwc); }
.cell.s-fwc .dot { width: auto; min-width: 34px; padding: 0 5px; background: color-mix(in srgb, var(--fwc) 24%, transparent); color: var(--fwc); }
.member-card .streak i.fwc { background: var(--fwc); }
.st-fwc { background: var(--fwc-bg); color: var(--fwc); }

.fees .c-name { position: sticky; }
.row-kick {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-3); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .12s, color .12s, background .12s;
}
.row-kick svg { width: 15px; height: 15px; }
.fees tbody tr:hover .row-kick, .row-kick:focus-visible { opacity: 1; }
.row-kick:hover { color: var(--open); background: var(--open-bg); border-color: color-mix(in srgb, var(--open) 40%, var(--line)); }
@media (hover: none) { .row-kick { opacity: .7; } }

.kick-warn { padding: 10px 12px; border-radius: 10px; background: var(--open-bg); color: var(--open); font-weight: 600; font-size: 13px; }
.reason-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.reason-chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px; padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.reason-chip:hover { border-color: var(--accent); color: var(--text); }
.btn-kick { background: var(--open); color: #fff; border-color: transparent; }
.btn-kick:hover { background: color-mix(in srgb, var(--open) 85%, #000); }

.count-open { font-size: 12px; font-weight: 600; color: var(--open); background: var(--open-bg); padding: 3px 9px; border-radius: 99px; }
.hist-table td { vertical-align: middle; }
.hist-table .btn svg { width: 14px; height: 14px; }
.hist-log { padding: 4px 0; }
.hist-row { display: grid; grid-template-columns: 130px 180px 1fr auto; gap: 14px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.hist-row:last-child { border-bottom: 0; }
.hist-row time { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.hist-who a { color: var(--text); font-weight: 600; }
.hist-who a:hover { color: var(--accent); }
.hist-what { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hist-by { font-size: 12px; white-space: nowrap; }
.st-chip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.st-paid { background: var(--paid-bg); color: var(--paid); }
.st-open { background: var(--open-bg); color: var(--open); }
.st-paused { background: var(--paused-bg); color: var(--paused); }
.st-exempt { background: var(--exempt-bg); color: var(--exempt); }
.st-kick { background: var(--open); color: #fff; }
.st-empty { background: transparent; color: var(--text-3); }
@media (max-width: 820px) {
  .hist-row { grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 14px; }
  .hist-row time { grid-column: 2; grid-row: 1; text-align: right; }
  .hist-who { grid-column: 1; grid-row: 1; }
  .hist-what { grid-column: 1 / -1; }
  .hist-by { grid-column: 1 / -1; }
}

/* ---------- Kompakte Beitragstabelle ---------- */
.fees th, .fees td { height: 32px; }
.fees thead th { height: 40px; line-height: 1.15; }
.fees thead th .y { font-size: 10.5px; }
.fees tfoot td { height: 34px; line-height: 1.1; }
.mini-bar { margin-top: 2px; height: 3px; }
.fees .c-name { width: 260px; min-width: 260px; padding: 0 10px; }
.fees .c-tier { left: 260px; width: 92px; min-width: 92px; padding: 0 8px; }
.member-cell { gap: 8px; }
.member-cell .avatar { width: 20px; height: 20px; border-radius: 6px; font-size: 9px; }
.member-cell .txt { display: flex; align-items: baseline; gap: 6px; min-width: 0; line-height: 1.2; }
.member-cell .nm { max-width: 150px; font-size: 13px; }
.member-cell .sub { max-width: 90px; font-size: 11px; }
.tier { padding: 1px 8px; font-size: 11px; }
.fees td.m { width: 76px; min-width: 76px; }
.cell { padding: 3px; font-size: 11px; }
.cell .dot { width: 20px; height: 20px; border-radius: 6px; }
.cell .dot svg { width: 12px; height: 12px; }
.cell.s-fwc .dot { min-width: 30px; height: 18px; }
.cell .note-txt { max-width: 68px; font-size: 10.5px; }
.cell.has-note::after { top: 3px; right: 3px; width: 5px; height: 5px; }
.row-kick { width: 24px; height: 24px; border-radius: 7px; right: 4px; }
.row-kick svg { width: 13px; height: 13px; }
@media (max-width: 820px) {
  .fees .c-name { width: 140px; min-width: 140px; }
  .member-cell .sub { display: none; }
  .member-cell .nm { max-width: 110px; }
  .fees td.m { width: 64px; min-width: 64px; }
}

/* ---------- Zuletzt bezahlt ---------- */
.lastpaid { display: inline-flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; margin-bottom: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-soft); max-width: 100%; }
.lp-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--paid); color: #06281c; flex: none; }
.lp-icon svg { width: 15px; height: 15px; stroke-width: 2.6; }
.lp-body { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; font-size: 13px; }
.lp-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.lp-meta { font-size: 12px; color: var(--text-3); }
.lastpaid .icon-btn { width: 30px; height: 30px; }
.lastpaid .icon-btn svg { width: 15px; height: 15px; }

/* ---------- Einklappbare Navigation ---------- */
.menu-btn { display: inline-grid; }
.app { transition: grid-template-columns .2s ease; }
.user-actions .btn svg { width: 14px; height: 14px; }
#authBox .btn-block svg { width: 16px; height: 16px; }
@media (min-width: 821px) {
  body.nav-collapsed .app { grid-template-columns: 72px 1fr; }
  body.nav-collapsed .sidebar { padding: 20px 12px; align-items: center; }
  body.nav-collapsed .brand { padding: 4px 0; }
  body.nav-collapsed .brand-text,
  body.nav-collapsed .mode-pill,
  body.nav-collapsed .user-box .who,
  body.nav-collapsed .user-actions span,
  body.nav-collapsed #authBox .btn-block span { display: none; }
  body.nav-collapsed .nav { width: 100%; }
  body.nav-collapsed .nav a { justify-content: center; font-size: 0; gap: 0; padding: 11px 0; }
  body.nav-collapsed .nav a svg { width: 20px; height: 20px; }
  body.nav-collapsed .sidebar-foot { width: 100%; align-items: center; }
  body.nav-collapsed .user-box { padding: 6px; justify-content: center; background: transparent; border: 0; }
  body.nav-collapsed .user-actions { grid-template-columns: 1fr; width: 100%; }
  body.nav-collapsed .user-actions .btn, body.nav-collapsed #authBox .btn-block { padding: 0; width: 44px; margin: 0 auto; }
}

/* Kick-Button immer sichtbar (dezent), beim Überfahren deutlich */
.row-kick { opacity: .5; }
.fees tbody tr:hover .row-kick { opacity: 1; }
.card-actions { display: flex; flex-direction: column; gap: 2px; }
.kick-btn:hover { color: var(--open); background: var(--open-bg); }
