/* WoltLab Packager — GrischaMedia Design System */

:root {
  /* Standard-Dark-Mode (neutral, klar — kein Milchgrau) */
  --bg: #0c0c0e;
  --bg-subtle: #09090b;
  --surface: #141416;
  --surface2: #1c1c1f;
  --surface3: #27272a;
  --border: #2e2e32;
  --border-light: #3f3f46;
  --text: #fafafa;
  --text-soft: #d4d4d8;
  --muted: #a1a1aa;
  --accent: #fafafa;
  --accent-hover: #ffffff;
  --accent-dim: #e4e4e7;
  --accent-text: #fafafa;
  --on-primary: #18181b;
  --accent-soft: rgba(255, 255, 255, 0.06);
  --accent-border: rgba(255, 255, 255, 0.12);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.12);
  --toggle-on: #4ade80;
  --toggle-on-border: #22c55e;
  --toggle-knob-on: #0c0c0e;
  --link: #7dd3fc;
  --link-hover: #bae6fd;
  --link-visited: #93c5fd;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --container: 1080px;
  --sidebar-width: 248px;
  --content-gutter: clamp(20px, 2.5vw, 40px);
  --content-max: 1680px;
}

*, *::before, *::after { box-sizing: border-box; }

body.web-app {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Text-Links (Dark Mode, hoher Kontrast) ── */
body.web-app a:where(:not(.sidebar-link):not(.sidebar-brand):not(.sidebar-user):not(.sidebar-logout):not(.app-footer-copy):not(.web-menu-link):not(.web-brand):not(.web-btn):not(.web-btn-ghost):not(.web-btn-primary):not(.web-btn-secondary):not(.btn):not(.btn-p):not(.btn-s):not(.btn-dl)),
body.auth-page a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: rgba(125, 211, 252, 0.5);
  text-underline-offset: 2px;
}

body.web-app a:where(:not(.sidebar-link):not(.sidebar-brand):not(.sidebar-user):not(.sidebar-logout):not(.app-footer-copy):not(.web-menu-link):not(.web-brand):not(.web-btn):not(.web-btn-ghost):not(.web-btn-primary):not(.web-btn-secondary):not(.btn):not(.btn-p):not(.btn-s):not(.btn-dl)):hover,
body.auth-page a:hover {
  color: var(--link-hover);
  text-decoration-color: currentColor;
}

body.web-app a:where(:not(.sidebar-link):not(.sidebar-brand):not(.sidebar-user):not(.sidebar-logout):not(.app-footer-copy):not(.web-menu-link):not(.web-brand):not(.web-btn):not(.web-btn-ghost):not(.web-btn-primary):not(.web-btn-secondary):not(.btn):not(.btn-p):not(.btn-s):not(.btn-dl)):visited,
body.auth-page a:visited {
  color: var(--link-visited);
}

body.web-app a:where(:not(.sidebar-link):not(.sidebar-brand):not(.sidebar-user):not(.sidebar-logout):not(.app-footer-copy):not(.web-menu-link):not(.web-brand):not(.web-btn):not(.web-btn-ghost):not(.web-btn-primary):not(.web-btn-secondary):not(.btn):not(.btn-p):not(.btn-s):not(.btn-dl)):focus-visible,
body.auth-page a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── App-Shell (Sidebar + Arbeitsfläche + Footer) ── */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-subtle);
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar-top {
  flex-shrink: 0;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  padding: 4px 6px;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.sidebar-brand:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-brand-mark {
  width: 40px;
  height: 40px;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  line-height: 1.25;
}

.sidebar-brand-accent {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.sidebar-brand-line {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.sidebar-spacer {
  flex: 1;
  min-height: 12px;
}

.sidebar-nav {
  flex-shrink: 0;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav--primary {
  flex: 0 0 auto;
  padding-top: 16px;
}

.sidebar-nav--meta {
  padding-top: 4px;
  padding-bottom: 8px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-link--meta {
  font-size: 13px;
  padding: 9px 12px;
  color: var(--muted);
}

.sidebar-link--meta:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border);
}

.sidebar-link--meta.is-active {
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--link);
}

.sidebar-nav-label {
  display: block;
  padding: 0 12px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.85;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-link:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border-light);
}

.sidebar-link:hover .sidebar-icon {
  opacity: 1;
  color: var(--text);
}

.sidebar-link.is-active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-light);
  box-shadow: inset 3px 0 0 var(--ok);
}

.sidebar-link-text {
  flex: 1;
  min-width: 0;
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.sidebar-icon svg {
  width: 18px;
  height: 18px;
}

.sidebar-bottom {
  flex-shrink: 0;
  padding: 14px 12px 16px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

a.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
}

a.sidebar-user:hover {
  border-color: var(--border-light);
  background: var(--surface3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

a.sidebar-user.is-active {
  border-color: var(--border-light);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-user-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-hint {
  font-size: 11px;
  color: var(--muted);
}

.sidebar-user-badge {
  flex-shrink: 0;
  font-size: 9px;
  padding: 2px 6px;
}

.sidebar-logout {
  display: block;
  text-align: center;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.sidebar-logout:hover {
  color: #fca5a5;
  background: var(--danger-soft);
}

/* Arbeitsfläche (rechts von der Sidebar) */
.app-workspace {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.app-content-frame {
  flex: 1;
  width: 100%;
  max-width: none;
  padding: var(--content-gutter);
  box-sizing: border-box;
}

.app-content-frame--packager {
  padding: 0;
}

.app-main-page {
  display: flex;
  flex-direction: column;
}

.app-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: none;
  margin: 0;
}

.app-page--wide {
  max-width: none;
}

/* Einstellungsseite — ausführliche Beschriftungen */
.settings-form-verbose .settings-section {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.settings-form-verbose .settings-section:last-of-type {
  border-bottom: none;
}
.settings-section-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.4;
}
.settings-section-intro {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.55;
}
.settings-fields {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 100%;
}
.settings-field-block label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
}
.settings-field-hint {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
}
.settings-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* Profil */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.profile-card h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
}

.profile-intro {
  margin: -8px 0 16px;
}

.profile-meta {
  margin: 0;
  display: grid;
  gap: 14px;
}

.profile-meta dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.profile-meta dd {
  margin: 0;
  font-size: 14px;
}

.profile-badge-user {
  background: var(--surface3);
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}

.profile-admin-link a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.profile-admin-link a:hover {
  color: var(--link-hover);
}

.profile-grid > .profile-card:first-child {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

/* Benutzerverwaltung */
.page-grid--admin {
  grid-template-columns: minmax(280px, 340px) 1fr;
}

.web-card--table {
  min-width: 0;
}

.user-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.user-inline-form input[type="text"],
.user-inline-form input[type="password"] {
  min-width: 140px;
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.user-inline-form input[type="text"] {
  max-width: 180px;
}


/* ── Header ── */
.web-header {
  background: linear-gradient(180deg, var(--surface) 0%, rgba(21, 25, 34, 0.97) 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.web-header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.web-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.web-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--surface3);
  color: var(--text);
  border: 1px solid var(--border-light);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px var(--accent-glow);
  flex-shrink: 0;
}

.web-brand-text {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.web-brand-text em {
  font-style: normal;
  color: var(--accent);
  font-weight: 600;
}

.web-menu {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.web-menu-link {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.web-menu-link:hover {
  color: var(--text);
  background: var(--surface2);
}

.web-menu-link.is-active {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.web-account {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.web-account-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.web-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface3);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.web-account-name {
  font-size: 13px;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
}

.web-badge-admin {
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
  margin-top: 4px;
  display: inline-block;
}

.web-btn-ghost {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.web-btn-ghost:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border);
}

.web-btn-ghost.is-active {
  color: #93c5fd;
  background: var(--accent-soft);
}

.web-btn-logout:hover {
  color: #fca5a5;
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.2);
}

/* ── Toolbar (Projekte) ── */
.web-toolbar {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.web-toolbar-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.web-toolbar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.web-toolbar-label svg { opacity: 0.7; }

.web-toolbar-hint {
  font-size: 12px;
  color: var(--ok);
  margin-left: auto;
}

/* ── Main ── */
.web-main {
  flex: 1;
  padding: 28px 0 48px;
}

.web-container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.web-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ── Page chrome ── */
.page-head {
  margin-bottom: 0;
}

.page-head h1 {
  margin: 0 0 10px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-head p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 24px;
  align-items: start;
  width: 100%;
}

@media (max-width: 1100px) {
  .page-grid--admin { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .page-grid { grid-template-columns: 1fr; }
  .web-menu { display: none; }
  .web-header-inner { gap: 12px; }
}

/* ── Cards ── */
.web-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: none;
}

.web-card h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.app-page .web-card + .web-card {
  margin-top: 0;
}

/* ── Forms ── */
.web-form label,
.web-field label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.web-form input[type="text"],
.web-form input[type="password"],
.web-form input[type="email"],
.web-field input,
.web-select,
.web-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.web-form input:focus,
.web-field input:focus,
.web-select:focus,
.web-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.web-form .web-field,
.web-field { margin-bottom: 14px; }

.web-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  font-size: 14px;
  cursor: pointer;
}

.web-checkbox input { width: auto; accent-color: var(--toggle-on); }

.web-select {
  width: auto;
  min-width: 220px;
}

/* ── Buttons ── */
.web-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}

.web-btn-primary {
  background: var(--accent);
  color: var(--on-primary);
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.web-btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  filter: brightness(1.05);
}

.web-btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}

.web-btn-secondary:hover {
  border-color: var(--border-light);
  background: var(--surface3);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.web-btn-danger {
  background: var(--danger);
  color: #fff;
}

.web-btn-danger-outline {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
  background: transparent;
}

.web-btn-danger-outline:hover {
  background: var(--danger-soft);
}

.web-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.web-btn-block { width: 100%; }

/* Legacy packager buttons in toolbar */
.web-profiles-bar .btn.btn-s,
.web-toolbar .btn.btn-s {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
}

/* ── Alerts ── */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin: 0;
  font-size: 14px;
  border: 1px solid transparent;
}

.alert.error {
  background: var(--danger-soft);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.25);
}

.alert.ok, .alert.success {
  background: var(--ok-soft);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.25);
}

/* ── Benutzerverwaltung (Karten) ── */
.admin-users-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 24px;
  align-items: start;
}

.admin-users-create {
  position: sticky;
  top: 24px;
}

.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.user-admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: border-color 0.15s;
}

.user-admin-card:hover {
  border-color: var(--border-light);
}

.user-admin-card--self {
  border-color: var(--accent-border);
}

.user-admin-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.user-admin-card-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.user-admin-card-meta p {
  margin: 4px 0 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.user-admin-card-date {
  font-size: 12px;
  color: var(--muted);
}

.user-admin-card-note {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.user-admin-card-note a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.user-admin-card-note a:hover {
  color: var(--link-hover);
}

.user-admin-card-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.user-admin-action {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  align-items: center;
}

.user-admin-action-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-admin-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.user-admin-form input {
  flex: 1;
  min-width: 160px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.user-admin-form input:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.user-admin-action--buttons {
  grid-template-columns: 1fr;
}

.user-admin-action--buttons > form,
.user-admin-action--buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.web-avatar-lg {
  width: 44px;
  height: 44px;
  font-size: 16px;
}

@media (max-width: 900px) {
  .admin-users-layout {
    grid-template-columns: 1fr;
  }
  .admin-users-create {
    position: static;
  }
  .user-admin-action {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ── User table (Legacy) ── */
.user-table-wrap { overflow-x: auto; }

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.user-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.user-table th:first-child { border-radius: var(--radius) 0 0 0; }
.user-table th:last-child { border-radius: 0 var(--radius) 0 0; }

.user-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.user-table tr:last-child td { border-bottom: none; }

.user-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-cell-name { font-weight: 500; }

.user-cell-meta { font-size: 12px; color: var(--muted); }

.user-cell-meta a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.user-cell-meta a:hover {
  color: var(--link-hover);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.user-reset-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.user-reset-form input {
  width: 140px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 0;
}

.stat-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.stat-card strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-card span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Footer (global) ── */
.app-footer {
  flex-shrink: 0;
  width: 100%;
  padding: 14px var(--content-gutter);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-sizing: border-box;
}

.app-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  width: 100%;
}

.app-footer-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-soft);
}

.app-footer-version {
  margin: 0 0 0 auto;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  white-space: nowrap;
}

.app-footer-copy strong {
  font-weight: 600;
  color: var(--text);
}

.app-footer-sep {
  margin: 0 10px;
  color: var(--border-light);
}

.app-footer-copy a {
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
}

.app-footer-copy a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app-footer--auth {
  margin-top: 24px;
  border-top: none;
}

/* ── Auth (Login) ── */
body.auth-page {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.auth-page {
  min-height: 100vh;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  color: var(--text);
}

.auth-hero-inner {
  max-width: 380px;
}

.auth-hero-mark {
  width: 56px;
  height: 56px;
  font-size: 22px;
  margin-bottom: 20px;
}

.auth-hero h2 {
  margin: 0 0 12px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.auth-hero p {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.55;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--bg);
  color: var(--text);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  color: var(--text);
}

.auth-brand {
  margin-bottom: 24px;
}

.auth-brand h1 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth-brand p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
}

.auth-page .web-field label {
  color: var(--text-soft);
}

.auth-page .web-field input {
  background: var(--bg-subtle);
  border-color: var(--border-light);
  color: var(--text);
}

.auth-page .web-field input::placeholder {
  color: var(--muted);
}

.auth-page .alert {
  margin-bottom: 16px;
}

/* ── Page toolbar ── */
.page-head--toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Dialog ── */
.web-dialog {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  max-width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}

.web-dialog--wide {
  max-width: min(720px, calc(100vw - 24px));
  width: 100%;
}

.version-edit-form {
  padding: 0;
  max-height: min(90vh, 880px);
  display: flex;
  flex-direction: column;
}

.version-edit-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px 0;
}

.version-edit-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.version-edit-hint {
  margin: 8px 22px 0;
}

.version-edit-fields {
  flex: 1;
  overflow-y: auto;
  padding: 16px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.version-edit-fields .web-field {
  margin-bottom: 12px;
}

.version-edit-checkbox {
  margin: 4px 0 12px;
}

.versions-json-input {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  min-height: 80px;
  resize: vertical;
}

.versions-json-full {
  min-height: 280px;
}

.versions-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.versions-pairs-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.versions-pairs-grid {
  display: grid;
  grid-template-columns: 1fr 140px 36px;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}

.versions-pairs-row {
  display: grid;
  grid-template-columns: 1fr 140px 36px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.versions-pairs-row input {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.versions-pairs-add {
  margin-top: 4px;
}

.versions-pairs-rm {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.version-edit-form .web-dialog-actions {
  padding: 12px 22px 20px;
  border-top: 1px solid var(--border);
  margin-top: 0;
}

.web-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.web-dialog .web-form:not(.version-edit-form) {
  padding: 24px 22px;
}

.web-dialog h2 {
  margin: 0 0 18px;
  font-size: 1.15rem;
}

.web-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ── Versions ── */
.versions-filter {
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.versions-table-wrap { overflow-x: auto; }

.versions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.versions-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.versions-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.versions-table tr:last-child td { border-bottom: none; }

.versions-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px !important;
}

.versions-date {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.versions-actions {
  white-space: nowrap;
  text-align: right;
}

/* ── Benutzerliste ── */
.user-list-wrap { overflow-x: auto; }

.user-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.user-list-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.user-list-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.user-list-table tr:last-child td { border-bottom: none; }

.user-row-menu summary {
  list-style: none;
  cursor: pointer;
}

.user-row-menu summary::-webkit-details-marker { display: none; }

.user-row-panel {
  margin-top: 12px;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 260px;
}

.user-row-form {
  margin-bottom: 12px;
}

.user-row-form:last-child { margin-bottom: 0; }

.user-row-form label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}

.user-row-form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.user-row-form-row input {
  flex: 1;
  min-width: 140px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.user-row-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Mobile ── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(0, 0, 0, 0.55);
}

@media (max-width: 900px) {
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
    width: min(var(--sidebar-width), 88vw);
  }

  .app-content-frame {
    padding: 56px 16px 20px !important;
  }

  .app-footer {
    padding: 12px 16px;
  }

  .app-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .app-footer-version {
    margin-left: 0;
  }

  .app-page,
  .app-page--wide {
    max-width: none;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    display: none;
  }

  .stats-row {
    flex-direction: column;
  }

  .page-head--toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .page-head-actions .web-btn,
  .page-head-actions .versions-filter {
    width: 100%;
  }

  .versions-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
  }

  .versions-actions .web-btn {
    width: 100%;
  }
}

.muted { color: var(--muted); font-size: 14px; }

.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }

.hint a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hint a:hover {
  color: var(--link-hover);
}

/* Settings form from JS */
#settings-form-root .web-field { margin-bottom: 12px; }
#settings-form-root .web-btn-primary { margin-top: 8px; }

/* Lizenzverwaltung */
.license-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.license-list-table th,
.license-list-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.license-list-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.license-excerpt {
  color: var(--muted);
  max-width: 420px;
}
.license-actions {
  white-space: nowrap;
}
.license-empty {
  color: var(--muted);
  text-align: center;
  padding: 28px 16px !important;
}
.license-preset-select {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
}

.license-xml-preview {
  display: block;
  margin-top: 6px;
  padding: 10px 12px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-soft);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  word-break: break-word;
}

.license-preview-field label {
  color: var(--muted);
  font-size: 12px;
}

/* Packager.html compatibility — legacy class names */
.web-topnav, .web-topnav-inner, .web-profiles-bar { display: none; }
