.mobile-menu-toggle {
  display: none;
}

.invite-admin {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.invite-admin h2,
.section-heading {
  margin: 0;
}

.invite-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 150px 150px auto;
  gap: .75rem;
  align-items: end;
}

.invite-list {
  display: grid;
  gap: .6rem;
}

.invite-list article {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.invite-list article > div:first-child {
  display: grid;
  gap: .2rem;
  min-width: 0;
}

.invite-list article span:not(.badge) {
  color: var(--muted);
  font-size: .85rem;
}

.invite-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 0 0 auto;
}

.invite-active { background: #dcfce7; color: #166534; }
.invite-used,
.invite-expired,
.invite-revoked { background: #eef2f7; color: #526278; }

.invite-code {
  overflow-wrap: anywhere;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px dashed var(--brand);
  border-radius: 12px;
  background: #effafa;
  color: var(--brand);
  font: 800 clamp(1rem, 5vw, 1.4rem)/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .06em;
  text-align: center;
}

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

  .invite-form .field:first-child,
  .invite-form .btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

  .topbar {
    position: sticky;
    gap: .5rem;
    padding: 9px 10px;
  }

  .topbar .brand {
    min-width: 0;
    padding: 6px 8px;
  }

  .brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    flex: 0 0 auto;
  }

  .top-actions {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    right: 10px;
    left: 10px;
    z-index: 30;
    gap: .5rem;
    padding: .75rem;
    border: 1px solid var(--line);
    border-radius: 0 0 16px 16px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 42, 58, .2);
  }

  .top-actions.is-open {
    display: grid;
  }

  .top-actions .server-badge {
    justify-content: center;
  }

  .top-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  .application-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .application-row > .actions {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    width: 100%;
    padding: 0;
    margin: 0;
  }

  .application-row > .actions > * {
    min-width: 0;
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .toolbar .field {
    min-width: 0;
  }

  .form-grid,
  .invite-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .server-form,
  .server-form > *,
  .server-form .form-grid,
  .server-form .field,
  .server-form input,
  .server-form select,
  .server-form textarea {
    min-width: 0;
    max-width: 100%;
  }

  .server-form .step-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .server-form .complete-fields,
  .server-form .form-section,
  .server-form .form-section > summary,
  .server-form .form-section > .form-grid {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .server-form .form-section > summary {
    overflow-wrap: anywhere;
  }

  .server-form .step-nav button {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .form-grid > *,
  .invite-form > *,
  .invite-form .field:first-child,
  .invite-form .btn {
    grid-column: auto;
  }

  .invite-list article {
    align-items: stretch;
    flex-direction: column;
  }

  .invite-actions {
    justify-content: space-between;
  }

  .auth {
    align-items: start;
    padding: 10px;
  }

  .auth-card {
    padding: 16px;
  }

  .auth-card h1 {
    overflow-wrap: anywhere;
  }

  dialog {
    max-height: calc(100dvh - 16px);
    max-width: calc(100vw - 16px);
    overflow: auto;
  }

  .modal {
    padding: 18px;
  }

  .modal .actions {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 0;
  }

  .modal .actions .btn {
    width: 100%;
  }

  .legal-links {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .brand-name {
    max-width: 128px;
  }

  .mobile-menu-toggle {
    padding-inline: 10px;
  }

  .application-row > .actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Dieser Status wird ausschließlich nach erfolgreichem PDF-Export gesetzt. */
#application-form option[value="pdf_created"] {
  display: none;
}
