:root {
  --color-bg: #ffffff;
  --color-orange: #ea580c;
  --color-orange-dark: #c2410c;
  --color-orange-tint: #fff2ea;
  --color-black: #111111;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-black);
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
}

/* Logo als grosses, sehr transparentes Wasserzeichen im Hintergrund */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("org.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: min(140vw, 1100px);
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}

.topbar,
.page {
  position: relative;
  z-index: 1;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

/* Kopfzeile mit SEND26-Logo und Sprachumschalter */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 10px;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 18px;
}

.brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-orange);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  display: block;
  height: 44px;
  width: auto;
}

.topbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.user-info {
  font-size: 0.85rem;
  color: var(--color-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 45vw;
}

.lang-switch {
  display: flex;
  border: 1.5px solid var(--color-orange);
  border-radius: 999px;
  overflow: hidden;
}

.lang-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #ffffff;
  color: var(--color-orange);
  border: none;
  cursor: pointer;
}

.lang-btn.active {
  background: var(--color-orange);
  color: #ffffff;
}

.header {
  padding: 8px 0 0;
}

.header h1 {
  font-size: 1.4rem;
  text-align: center;
  margin: 0 0 12px;
  color: var(--color-black);
  font-weight: 700;
}

.intro {
  text-align: center;
  font-size: 0.95rem;
  color: var(--color-black);
  margin-bottom: 28px;
}

.card {
  background: #ffffff;
  border: 1.5px solid rgba(17, 17, 17, 0.1);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 2px 10px rgba(17, 17, 17, 0.06);
}

.field {
  margin-bottom: 18px;
}

.field:last-of-type {
  margin-bottom: 0;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 6px;
  color: var(--color-black);
}

.required {
  color: var(--color-orange);
}

.optional {
  font-weight: normal;
  color: rgba(17, 17, 17, 0.55);
  font-size: 0.85rem;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  font-size: 1rem;
  border: 1.5px solid rgba(17, 17, 17, 0.15);
  border-radius: 10px;
  background: #fff;
  color: var(--color-black);
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-orange);
  box-shadow: 0 0 0 3px var(--color-orange-tint);
}

textarea {
  resize: vertical;
}

.hint {
  margin: 6px 2px 0;
  font-size: 0.82rem;
  color: rgba(17, 17, 17, 0.6);
}

.hidden {
  display: none !important;
}

.submit-btn {
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  background: var(--color-orange);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.submit-btn:hover {
  background: var(--color-orange-dark);
}

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

.logout-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-orange);
  background: #ffffff;
  border: 1.5px solid var(--color-orange);
  border-radius: 999px;
  cursor: pointer;
}

.logout-btn:hover {
  background: var(--color-orange-tint);
}

.form-message {
  margin-top: 16px;
  text-align: center;
  font-weight: 600;
  min-height: 1.4em;
}

.form-message.success {
  color: var(--color-orange-dark);
}

.form-message.error {
  color: #111111;
  background: var(--color-orange-tint);
  border: 1px solid var(--color-orange);
  border-radius: 8px;
  padding: 8px;
}

.page-narrow {
  max-width: 420px;
}

.page-narrow .topbar,
.page-narrow .header {
  max-width: 420px;
}

.card-title {
  text-align: center;
  font-size: 1.1rem;
  margin: 0 0 20px;
  color: var(--color-black);
  font-weight: 700;
}

.switch-link {
  margin-top: 20px;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(17, 17, 17, 0.7);
}

.switch-link a {
  color: var(--color-orange);
  font-weight: 700;
  text-decoration: none;
}

.switch-link a:hover {
  text-decoration: underline;
}

/* Persoenliche Begruessung */
.welcome-message {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-orange-dark);
  margin: 0 0 6px;
}

/* Vision-Block mit Icon */
.vision-block {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 28px;
  padding: 14px 16px;
  background: var(--color-orange-tint);
  border: 1px solid rgba(234, 88, 12, 0.25);
  border-radius: var(--radius);
}

.vision-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  color: var(--color-orange);
}

.vision-text {
  margin: 0;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--color-black);
}

/* Admin-Bereich */
.page-admin {
  max-width: 780px;
}

.page-admin .topbar,
.page-admin .header {
  max-width: 780px;
}

.stat-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  flex: 1 1 200px;
  background: #ffffff;
  border: 1.5px solid rgba(17, 17, 17, 0.1);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(17, 17, 17, 0.06);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--color-orange);
}

.stat-label {
  font-size: 0.85rem;
  color: rgba(17, 17, 17, 0.65);
  font-weight: 600;
}

.admin-section {
  margin-bottom: 24px;
}

.admin-section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: rgba(17, 17, 17, 0.65);
}

.sort-btn {
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #ffffff;
  color: var(--color-orange);
  border: 1.5px solid var(--color-orange);
  border-radius: 999px;
  cursor: pointer;
}

.sort-btn.active {
  background: var(--color-orange);
  color: #ffffff;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(17, 17, 17, 0.1);
}

.admin-table thead th {
  color: rgba(17, 17, 17, 0.6);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table-total-row td {
  font-weight: 800;
  border-top: 2px solid var(--color-orange);
  border-bottom: none;
}

.user-search-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.user-search-form input {
  flex: 1;
}

.user-search-btn {
  width: auto;
  margin-top: 0;
  padding: 11px 20px;
}

.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 10px;
}

.user-row-empty {
  justify-content: center;
  color: rgba(17, 17, 17, 0.6);
}

.user-row-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.user-email {
  color: rgba(17, 17, 17, 0.6);
  font-size: 0.85rem;
}

.tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tag-admin {
  background: var(--color-orange-tint);
  color: var(--color-orange-dark);
}

.tag-super {
  background: var(--color-orange);
  color: #ffffff;
}

.user-row-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (min-width: 480px) {
  .header h1 {
    font-size: 1.6rem;
  }
}

/* Feinschliff fuer kleine Mobilbildschirme */
@media (max-width: 480px) {
  .topbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand-logo {
    height: 34px;
  }

  .brand {
    font-size: 1.2rem;
    gap: 6px;
  }

  .card {
    padding: 18px;
  }

  .header h1 {
    font-size: 1.2rem;
  }

  .intro {
    font-size: 0.88rem;
  }

  /* Nur wenn User-Info (eingeloggter Bereich) vorhanden ist auf volle Breite spannen */
  .topbar-right:has(.user-info) {
    justify-content: space-between;
    width: 100%;
  }

  .user-info {
    max-width: 60vw;
  }
}

@media (max-width: 360px) {
  .brand-logo {
    height: 28px;
  }

  .brand {
    font-size: 1.05rem;
  }
}

/* Meine Kontakte */
.contact-card {
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 10px;
  padding: 14px;
}

.contact-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 1.02rem;
}

.contact-card-date {
  font-size: 0.82rem;
  color: rgba(17, 17, 17, 0.6);
}

.contact-detail-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 12px;
  row-gap: 6px;
  margin: 0;
  font-size: 0.88rem;
}

.contact-detail-grid dt {
  color: rgba(17, 17, 17, 0.6);
  font-weight: 600;
}

.contact-detail-grid dd {
  margin: 0;
  word-break: break-word;
}

.contact-detail-grid a {
  color: var(--color-orange);
  font-weight: 600;
  text-decoration: none;
}

.contact-detail-grid a:hover {
  text-decoration: underline;
}

@media (max-width: 420px) {
  .contact-detail-grid {
    grid-template-columns: 1fr;
    row-gap: 2px;
  }

  .contact-detail-grid dd {
    margin-bottom: 6px;
  }
}
