/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* Ensure hidden attribute always works even when CSS sets display */
[hidden] { display: none !important; }

:root {
  --c-primary: #2563eb;
  --c-primary-hover: #1d4ed8;
  --c-bg: #f1f5f9;
  --c-surface: #ffffff;
  --c-border: #e2e8f0;
  --c-text: #1e293b;
  --c-text-muted: #64748b;
  --c-success: #16a34a;
  --c-error: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Login ────────────────────────────────────────────── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-sub {
  color: var(--c-text-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--c-text-muted);
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  transition: border-color .15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--c-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--c-primary-hover); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--c-border);
  color: var(--c-text);
}
.btn-outline:hover { background: var(--c-bg); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { font-size: 16px; }

/* ── Topbar ───────────────────────────────────────────── */
.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

.topbar h1 { font-size: 18px; font-weight: 700; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--c-text-muted);
}

/* ── Main ─────────────────────────────────────────────── */
.main { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--c-border);
}

.tab {
  padding: 10px 20px;
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  color: var(--c-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}

.tab:hover { color: var(--c-text); }
.tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Tab Header ───────────────────────────────────────── */
.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.tab-header h2 { font-size: 20px; font-weight: 600; }

.tab-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.count-badge {
  background: var(--c-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
}

.count-badge:empty { display: none; }

.sync-time {
  font-size: 12px;
  color: var(--c-text-muted);
}

/* ── Status / Error ───────────────────────────────────── */
.status-msg {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 12px;
}

.status-msg.loading { background: #eff6ff; color: #1d4ed8; }
.status-msg.success { background: #f0fdf4; color: var(--c-success); }
.status-msg.error   { background: #fef2f2; color: var(--c-error); }

.error-msg {
  color: var(--c-error);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ── Table ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 14px;
}

thead { background: #f8fafc; }

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}

th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--c-text-muted);
  cursor: pointer;
  user-select: none;
}

th:hover { color: var(--c-text); }

tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--c-text-muted);
  font-size: 15px;
}

/* ── Notiz-Feld (inline edit) ─────────────────────────── */
.notiz-cell {
  position: relative;
  white-space: normal;
}

.notiz-input {
  width: 180px;
  min-height: 32px;
  max-height: 80px;
  padding: 4px 8px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  transition: border-color .15s;
}

.notiz-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}

.notiz-status {
  margin-left: 4px;
  font-size: 13px;
  vertical-align: middle;
}

.notiz-save-ok { color: var(--c-success); }
.notiz-save-err { color: var(--c-error); }

/* ── Mitglied-Dropdown (inline select) ────────────────── */
.mitglied-cell {
  position: relative;
  white-space: nowrap;
}

.mitglied-select {
  width: 200px;
  padding: 4px 8px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  background: var(--c-surface);
  cursor: pointer;
  transition: border-color .15s;
}

.mitglied-select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}

.mitglied-select:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.mitglied-status {
  margin-left: 4px;
  font-size: 13px;
  vertical-align: middle;
}

.mitglied-save-ok { color: var(--c-success); }
.mitglied-save-err { color: var(--c-error); }

/* ── Spinner ──────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .main { padding: 16px; }
  .tab-header { flex-direction: column; align-items: flex-start; }
  .tab-actions { flex-wrap: wrap; }
  th, td { padding: 8px 10px; font-size: 13px; }
}
