/* Login-, Konto- und Admin-Seiten. Baut auf /app/styles.css auf (Tokens, Buttons, Inputs, Tabellen). */
body { overflow: auto; min-height: 100%; }
html, body { height: auto; min-height: 100%; }
[hidden] { display: none !important; }

/* ---------- Auth-Seiten (zentrierte Karte) ---------- */
.sp-auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  padding: calc(24px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  background: radial-gradient(1000px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.sp-auth-brand { display: flex; align-items: center; gap: 10px; }
.sp-auth-brand .brand-name { font-size: 18px; }
.sp-auth-card { width: min(420px, 100%); background: var(--bg-elev); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 26px; }
.sp-auth-card.wide { width: min(520px, 100%); }
.sp-auth-card h1 { font-size: 20px; letter-spacing: -0.015em; margin: 0 0 6px; }
.sp-auth-card .lead { color: var(--text-2); font-size: 13.5px; line-height: 1.5; margin-bottom: 18px; }
.sp-form { display: flex; flex-direction: column; gap: 14px; }
.sp-form .btn.lg { width: 100%; }
.sp-auth-foot { font-size: 12.5px; color: var(--text-3); text-align: center; }
.sp-auth-foot a, .sp-links a { color: var(--accent); text-decoration: none; }
.sp-auth-foot a:hover, .sp-links a:hover { text-decoration: underline; }
.sp-links { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; flex-wrap: wrap; }
.sp-msg { margin: 0; }
.input.code { font-family: var(--mono); font-size: 22px; letter-spacing: 0.3em; text-align: center; height: 52px; }

/* QR-Code & Backup-Codes */
.sp-qr { display: flex; justify-content: center; padding: 14px; background: #fff; border-radius: 14px; border: 1px solid var(--border); width: max-content; margin: 0 auto; }
.sp-qr svg { display: block; width: 196px; height: 196px; }
.sp-secret { font-family: var(--mono); font-size: 13px; padding: 10px 12px; border-radius: 9px; background: var(--bg-sunk); border: 1px solid var(--border); word-break: break-all; user-select: all; text-align: center; letter-spacing: 0.08em; }
.sp-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-family: var(--mono); font-size: 14px; }
.sp-codes div { padding: 8px 10px; border-radius: 8px; background: var(--bg-sunk); border: 1px solid var(--border); text-align: center; }
.sp-step { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.sp-step .badge { flex: none; margin-top: 1px; }

/* ---------- Kopfzeile (Konto/Admin) ---------- */
.sp-top { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 18px; min-height: 60px;
  padding: env(safe-area-inset-top) calc(24px + env(safe-area-inset-right)) 0 calc(24px + env(safe-area-inset-left));
  background: var(--sidebar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); }
.sp-top-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: none; }
.sp-top-brand .brand-logo { width: 30px; height: 30px; border-radius: 9px; }
.sp-top-nav { display: flex; gap: 4px; flex: 1; min-width: 0; }
.sp-top-link { padding: 8px 12px; border-radius: 9px; color: var(--text-2); text-decoration: none; font-weight: 550; min-height: 36px; display: inline-flex; align-items: center; }
.sp-top-link:hover { background: var(--bg-sunk); color: var(--text); }
.sp-top-link.active { background: var(--accent-soft); color: var(--accent); }
.sp-top-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sp-top-mail { max-width: 220px; }

.sp-page { max-width: 1080px; margin: 0 auto; padding: 28px calc(24px + env(safe-area-inset-right)) calc(56px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 20px; }
.sp-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sp-page-head h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0; }
.sp-page-head p { color: var(--text-3); margin-top: 4px; }
.sp-section { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.sp-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sp-section-head h2 { font-size: 15px; }
.sp-section-head .sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.sp-section-body { padding: 18px; }
.sp-section-body.flush { padding: 0; }
.sp-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.sp-inline .field { flex: 1 1 200px; min-width: 0; }
.sp-inline .btn { flex: none; }
.sp-kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; font-size: 13.5px; align-items: center; }
.sp-kv dt { color: var(--text-3); }
.sp-kv dd { margin: 0; min-width: 0; }
.sp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sp-table-wrap .table th { position: static; }
.sp-table-wrap .table tr:last-child td { border-bottom: 0; }
.sp-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.sp-empty { padding: 22px 18px; color: var(--text-3); font-size: 13px; }
.sp-orgs { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-callout-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.sp-support-bar { background: var(--bad); color: #fff; border-radius: var(--radius); padding: 12px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sp-support-bar .grow { min-width: 200px; }
.sp-support-bar .btn { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.sp-details { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); max-width: 420px; white-space: pre-wrap; word-break: break-word; }
.sp-row-off td { opacity: 0.55; }
.sp-filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.sp-filter .field { min-width: 160px; flex: 1 1 160px; }
.sp-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; min-height: 36px; cursor: pointer; }
.sp-more { display: flex; justify-content: center; padding: 14px; }
.sp-file { font-size: 13px; }

@media (max-width: 820px) {
  .sp-top { gap: 10px; padding-left: calc(14px + env(safe-area-inset-left)); padding-right: calc(14px + env(safe-area-inset-right)); flex-wrap: wrap; }
  .sp-top-brand .brand-name { display: none; }
  .sp-top-mail { display: none; }
  .sp-top-nav { overflow-x: auto; }
  .sp-top-link { min-height: 44px; }
  .sp-page { padding: 18px calc(14px + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left)); gap: 16px; }
  .sp-page-head h1 { font-size: 20px; }
  .sp-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .sp-kv dd { margin-bottom: 10px; }
  .sp-section-body { padding: 14px; }
  .sp-section-head { padding: 14px; }
  .sp-auth-card { padding: 20px; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; }
  .input, .select { height: 44px; font-size: 16px; }
  .textarea { font-size: 16px; }
  .modal-backdrop { place-items: end stretch; }
  .modal { width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; max-height: calc(100dvh - 12px - env(safe-area-inset-top)); }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }
  #toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  /* Tabellen als gestapelte Karten */
  .sp-table-wrap .table, .sp-table-wrap .table tbody, .sp-table-wrap .table tr, .sp-table-wrap .table td { display: block; width: 100%; }
  .sp-table-wrap .table thead { display: none; }
  .sp-table-wrap .table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .sp-table-wrap .table tr:last-child { border-bottom: 0; }
  .sp-table-wrap .table td { border: 0; padding: 3px 0; white-space: normal; }
  .sp-table-wrap .table td:empty { display: none; }
  .sp-table-wrap .table td[data-label]::before { content: attr(data-label) ': '; color: var(--text-3); font-size: 12px; }
  .sp-table-wrap .sp-details { display: inline; }
  .sp-table-wrap .sp-actions { justify-content: flex-start; margin-top: 6px; }
  .sp-details { max-width: 100%; }
}
a.btn { text-decoration: none; }
