/* FlächenDigital v6 Clean – Benutzerverwaltung
 * Theme-eigene Darstellung für das vom Core gelieferte Verwaltungs-Markup.
 * Keine Geschäftslogik, keine historischen Positionierungs-Overrides.
 */

.fp-user-management{
  --fd-user-admin-max:1680px;
  --fd-user-admin-width:94vw;
  position:relative;
  min-height:100vh;
  padding:24px 0 30px;
  overflow:hidden;
  color:var(--fd-text);
}

.fp-user-management .fp-user-management-shell{
  position:relative;
  width:min(var(--fd-user-admin-width),var(--fd-user-admin-max));
  max-width:var(--fd-user-admin-max);
  margin-inline:auto;
}

.fp-user-management .fp-user-management-top{
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom:30px;
}

.fp-user-management .fp-user-management-logo,
.fp-user-management .fp-user-management-logo .fp-brand,
.fp-user-management .fp-user-management-logo a{
  display:inline-flex;
  justify-content:center;
}

.fp-user-management .fp-user-management-logo img{
  width:116px;
  height:auto;
  filter:none;
}

/* Der große Wrapper ist nur Layoutträger. Sichtbare Materialität gehört
   Suche, Tabelle, Details und mobilen Kontaktkarten. */
.fp-user-management .fp-user-management-card{
  position:relative;
  width:100%;
  margin:0;
  padding:40px;
  border:0;
  border-radius:28px;
  background:transparent;
  box-shadow:none;
}

.fp-user-management .fd-user-management-heading{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  margin-bottom:32px;
}

.fp-user-management .fp-user-management-title{
  min-width:0;
  margin:0;
  color:var(--fd-text);
  font-size:clamp(42px,4.4vw,var(--fd-user-management-heading-font,58px));
  line-height:.98;
  font-weight:700;
  letter-spacing:-.052em;
}

.fp-user-management .fd-user-management-logout{
  flex:0 0 auto;
}

.fp-user-management .fp-user-management-card .fd-user-management-logout a{
  white-space:nowrap;
}

.fp-user-management .fp-portal-user-admin{
  position:relative;
  margin:0;
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
}

/* Core liefert diese beiden Zeilen weiterhin für eigenständige Nutzung des
   Shortcodes. Auf der Theme-Seite besitzt der Kopf Logout und Kontext selbst. */
.fp-user-management .fp-portal-user-admin > p:first-child,
.fp-user-management .fp-portal-user-admin > p:nth-child(2){
  display:none;
}

/* Hinweise aus dem Core */
.fp-user-management-card > p{
  margin:0 0 18px;
  padding:14px 16px;
  border:1px solid var(--fd-border);
  border-radius:14px;
  background:var(--fd-surface);
  color:var(--fd-text);
  line-height:1.55;
}

.fp-user-management-card > ul{
  margin:0 0 22px;
  padding:0;
  list-style:none;
}

.fp-user-management-card > ul li{
  margin-top:8px;
  padding:10px 12px;
  border:1px solid var(--fd-border);
  border-radius:12px;
  background:var(--fd-surface);
}

/* Suche + Einladung */
.fp-user-management-card #fp-portal-invite-form > p:first-of-type{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(245px,285px);
  gap:22px;
  align-items:center;
  margin:0 0 26px;
}

.fp-user-management-card input[type="search"]{
  width:100%;
  min-width:0;
  min-height:60px;
  margin:0;
  padding:0 20px 0 54px;
  border:1px solid var(--fd-border-strong);
  border-radius:16px;
  outline:0;
  background-color:var(--fd-surface);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2360706a' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.8-3.8'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:20px center;
  background-size:21px;
  color:var(--fd-text);
  font-size:17px;
  box-shadow:none;
  transition:border-color .16s ease,background-color .16s ease,box-shadow .16s ease;
}

.fp-user-management-card input[type="search"]::placeholder{
  color:var(--fd-text-muted);
}

.fp-user-management-card input[type="search"]:focus{
  border-color:var(--fp-green);
  background-color:var(--fd-surface);
  box-shadow:0 0 0 4px var(--fd-focus);
}

.fp-user-management .fp-user-management-card #fp-portal-invite-form > p:first-of-type > button{
  width:100%;
}

.fp-user-management .fp-user-management-card #fp-portal-invite-form > p:first-of-type > button::before{
  content:"＋";
  margin-right:2px;
  font-size:20px;
  line-height:1;
  font-weight:400;
}

/* Kontaktliste */
.fp-user-management-card #fp-portal-contact-table{
  width:100%;
  table-layout:fixed;
  margin:0;
  border:1px solid var(--fd-border);
  border-collapse:separate;
  border-spacing:0;
  border-radius:20px;
  overflow:hidden;
  background:var(--fd-surface);
  box-shadow:var(--fd-shadow-soft);
}

.fp-user-management-card #fp-portal-contact-table th:nth-child(1),
.fp-user-management-card #fp-portal-contact-table td:nth-child(1){width:58px;text-align:center}
.fp-user-management-card #fp-portal-contact-table th:nth-child(2),
.fp-user-management-card #fp-portal-contact-table td:nth-child(2){width:25%}
.fp-user-management-card #fp-portal-contact-table th:nth-child(3),
.fp-user-management-card #fp-portal-contact-table td:nth-child(3){width:30%}
.fp-user-management-card #fp-portal-contact-table th:nth-child(4),
.fp-user-management-card #fp-portal-contact-table td:nth-child(4){width:18%}
.fp-user-management-card #fp-portal-contact-table th:nth-child(5),
.fp-user-management-card #fp-portal-contact-table td:nth-child(5){width:22%}

.fp-user-management-card #fp-portal-contact-table thead th{
  padding:18px;
  border:0;
  border-bottom:1px solid var(--fd-line);
  background:var(--fd-surface-soft);
  color:var(--fd-text-muted);
  text-align:left;
  font-size:12px;
  line-height:1.2;
  font-weight:700;
  letter-spacing:.14em;
  text-transform:uppercase;
  white-space:nowrap;
}

.fp-user-management-card #fp-portal-contact-table tbody td{
  padding:24px 18px;
  border:0;
  border-bottom:1px solid var(--fd-line);
  background:transparent;
  color:var(--fd-text);
  vertical-align:top;
  font-size:15px;
  line-height:1.58;
  overflow-wrap:anywhere;
}

.fp-user-management-card #fp-portal-contact-table tbody tr:last-child td{
  border-bottom:0;
}

.fp-user-management-card #fp-portal-contact-table tbody tr{
  transition:background .16s ease;
}

.fp-user-management-card #fp-portal-contact-table tbody tr:hover td{
  background:var(--fd-surface-soft);
}

.fp-user-management-card #fp-portal-contact-table tbody td strong{
  display:inline-block;
  margin-bottom:3px;
  color:var(--fd-text);
  font-size:18px;
  font-weight:700;
  letter-spacing:-.02em;
}

.fp-user-management-card #fp-portal-contact-table tbody td:nth-child(3) strong{
  font-size:19px;
}

.fp-user-management-card input[type="checkbox"]{
  width:19px;
  height:19px;
  accent-color:var(--fp-green);
}

/* Zugeordnete Immobilien */
.fp-user-management-card details{
  margin-top:12px;
}

.fp-user-management-card summary{
  display:flex;
  align-items:center;
  gap:9px;
  width:100%;
  max-width:100%;
  padding:10px 13px;
  border:1px solid var(--fd-border);
  border-radius:11px;
  background:var(--fd-surface-soft);
  color:var(--fd-text);
  font-size:13px;
  line-height:1.35;
  font-weight:600;
  list-style:none;
  cursor:pointer;
  transition:background .16s ease,border-color .16s ease;
}

.fp-user-management-card summary:hover{
  border-color:var(--fd-border-strong);
  background:var(--fd-accent-soft);
}

.fp-user-management-card summary::-webkit-details-marker{display:none}
.fp-user-management-card summary::before{content:"⌄";color:var(--fd-text-muted);font-size:18px;line-height:.8}
.fp-user-management-card details[open] summary::before{content:"⌃"}

.fp-user-management-card details ul{
  display:grid;
  gap:8px;
  margin:12px 0 0;
  padding:0;
  list-style:none;
}

.fp-user-management-card details li,
.fp-user-management-card details p{
  margin:0;
  padding:11px 13px;
  border:1px solid var(--fd-border);
  border-radius:12px;
  background:var(--fd-surface-soft);
  color:var(--fd-text);
  font-size:13px;
  line-height:1.45;
}

.fp-user-management-card details li{
  position:relative;
  padding-left:40px;
}

.fp-user-management-card details li::before{
  content:"▦";
  position:absolute;
  top:12px;
  left:14px;
  color:var(--fd-text-muted);
  font-size:15px;
}

.fp-user-management-card .fd-estate-id{
  display:block;
  margin-bottom:2px;
  color:var(--fd-text);
  font-weight:700;
}

.fp-user-management-card .fd-estate-title{
  display:block;
  color:var(--fd-text-muted);
}

/* Portalstatus */
.fp-user-management-card #fp-portal-contact-table tbody td:nth-child(4){
  position:relative;
  padding-left:42px;
}

.fp-user-management-card #fp-portal-contact-table tbody td:nth-child(4)::before{
  content:"";
  position:absolute;
  top:31px;
  left:18px;
  width:12px;
  height:12px;
  border-radius:50%;
  background:var(--fp-green);
  box-shadow:0 0 0 3px rgba(108,240,164,.08);
}

.fp-user-management-card #fp-portal-contact-table tbody td[data-fd-status="invited"]::before{background:#b8c9c0}
.fp-user-management-card #fp-portal-contact-table tbody td[data-fd-status="blocked"]::before{background:#e9a75e}
.fp-user-management-card #fp-portal-contact-table tbody td[data-fd-status="removed"]::before{background:#8d9c94}

/* Aktionen */
.fp-user-management-card #fp-portal-contact-table tbody td:nth-child(5){
  padding-right:18px;
}

.fp-user-management-card #fp-portal-contact-table tbody td:nth-child(5) br{
  display:block;
  height:4px;
  line-height:0;
}

.fp-user-management .fp-user-management-card #fp-portal-contact-table tbody td:nth-child(5) button,
.fp-user-management .fp-user-management-card #fp-portal-contact-table tbody td:nth-child(5) input[type="submit"]{
  width:calc(50% - 5px);
  min-height:44px;
  margin:4px 6px 4px 0;
  padding:0 18px;
  font-size:13px;
}

.fp-user-management-card a{
  color:var(--fd-text);
}

@media(max-width:1180px){
  .fp-user-management{--fd-user-admin-width:96vw}
  .fp-user-management .fp-user-management-card{padding:28px;overflow-x:auto}
  .fp-user-management-card #fp-portal-contact-table{min-width:1080px}
}

@media(max-width:760px){
  .fp-user-management{
    --fd-user-admin-width:calc(100vw - 24px);
    min-height:100svh;
    padding:16px 0 22px;
  }

  .fp-user-management .fp-user-management-top{margin-bottom:18px}
  .fp-user-management .fp-user-management-logo img{width:min(116px,34vw)}

  .fp-user-management .fp-user-management-card{
    padding:22px 16px;
    overflow:visible;
    border-radius:22px;
  }

  .fp-user-management .fd-user-management-heading{
    align-items:flex-start;
    flex-direction:column;
    gap:18px;
    margin-bottom:24px;
  }

  .fp-user-management .fp-user-management-title{
    font-size:clamp(34px,11vw,46px);
  }

  .fp-user-management .fp-user-management-card .fd-user-management-logout a{
    min-height:42px;
    padding:0 14px;
    font-size:13px;
  }

  .fp-user-management-card #fp-portal-invite-form > p:first-of-type{
    grid-template-columns:1fr;
    gap:12px;
  }

  .fp-user-management-card #fp-portal-contact-table,
  .fp-user-management-card #fp-portal-contact-table tbody,
  .fp-user-management-card #fp-portal-contact-table tr,
  .fp-user-management-card #fp-portal-contact-table td{
    display:block;
    width:100%;
    min-width:0;
  }

  .fp-user-management-card #fp-portal-contact-table{
    min-width:0;
    border:0;
    background:transparent;
    box-shadow:none;
    overflow:visible;
  }

  .fp-user-management-card #fp-portal-contact-table thead{display:none}

  .fp-user-management-card #fp-portal-contact-table tbody tr{
    position:relative;
    margin-bottom:14px;
    padding:18px;
    border:1px solid var(--fd-border);
    border-radius:18px;
    background:var(--fd-surface);
    box-shadow:var(--fd-shadow-soft);
  }

  .fp-user-management-card #fp-portal-contact-table tbody tr:hover td{background:transparent}

  .fp-user-management-card #fp-portal-contact-table tbody td{
    padding:8px 0;
    border:0;
    background:transparent;
  }

  .fp-user-management-card #fp-portal-contact-table tbody td:first-child{
    position:absolute;
    top:18px;
    right:18px;
    width:auto;
    padding:0;
  }

  .fp-user-management-card #fp-portal-contact-table tbody td:nth-child(2){padding-right:42px}

  .fp-user-management-card #fp-portal-contact-table tbody td:nth-child(3){
    margin-top:8px;
    padding-top:14px;
    border-top:1px solid var(--fd-line);
  }

  .fp-user-management-card #fp-portal-contact-table tbody td:nth-child(4){padding-left:24px}
  .fp-user-management-card #fp-portal-contact-table tbody td:nth-child(4)::before{top:14px;left:0}

  .fp-user-management-card #fp-portal-contact-table tbody td:nth-child(5){
    margin-top:6px;
    padding-top:12px;
    padding-right:0;
    border-top:1px solid var(--fd-line);
  }

  .fp-user-management-card #fp-portal-contact-table tbody td:nth-child(5) button,
  .fp-user-management-card #fp-portal-contact-table tbody td:nth-child(5) input[type="submit"]{
    width:100%;
    margin:6px 0 0;
  }
}
