/* iPhone Web-App: keep the cockpit header below the iOS status bar.
   Safari and desktop are intentionally unaffected. */
@media (max-width: 980px) {
  html.standalone-app .topbar {
    /* iOS sometimes reports a safe-area inset that is technically present,
       but still too small for the Dynamic Island/status-bar content. Keep a
       guaranteed clear zone and render the regular cockpit header below it. */
    --pwa-top-clearance: max(68px, calc(env(safe-area-inset-top) + 14px));
    height: calc(68px + var(--pwa-top-clearance)) !important;
    padding: var(--pwa-top-clearance) 18px 0 !important;
  }

  /* Every full-screen mobile surface starts below the iOS status bar.
     This covers the navigation, notifications, profile, lead details and
     every other drawer that uses the shared scroll surface. */
  html.standalone-app .mobile-menu-backdrop > .overlay-scroll-surface,
  html.standalone-app .drawer-backdrop > .overlay-scroll-surface {
    /* Some iOS Web-App launches incorrectly report the safe inset as 0px.
       The fixed fallback keeps Dynamic Island, time and battery clear even
       in that faulty state. */
    padding-top: 82px !important;
    padding-top: max(82px, calc(24px + env(safe-area-inset-top))) !important;
  }
}

/* The production CSP intentionally blocks inline scripts. Therefore the
   installed-app layout must also work without the `standalone-app` class.
   These native display-mode queries only match an installed Web App and do
   not change the already correct mobile Safari layout. */
@media (max-width: 980px) and (display-mode: standalone),
       (max-width: 980px) and (display-mode: fullscreen) {
  .topbar {
    --pwa-top-clearance: max(68px, calc(env(safe-area-inset-top) + 14px));
    height: calc(68px + var(--pwa-top-clearance)) !important;
    padding: var(--pwa-top-clearance) 18px 0 !important;
  }

  .mobile-menu-backdrop > .overlay-scroll-surface,
  .drawer-backdrop > .overlay-scroll-surface {
    padding-top: 82px !important;
    padding-top: max(82px, calc(24px + env(safe-area-inset-top))) !important;
  }
}

/* Distinguish automatic first distribution from a personal handoff. */
.automatic-assignment-attention-card {
  border-color: rgba(73, 233, 121, 0.36) !important;
  border-left-color: var(--green) !important;
  background: linear-gradient(145deg, rgba(18, 55, 37, 0.92), rgba(8, 28, 18, 0.9)) !important;
}

.automatic-assignment-attention-card .attention-icon {
  color: var(--green) !important;
  border-color: rgba(73, 233, 121, 0.3) !important;
  background: rgba(73, 233, 121, 0.08) !important;
}

.seller-assignment-alert.automatic {
  border-color: rgba(73, 233, 121, 0.32) !important;
  background: linear-gradient(135deg, rgba(18, 55, 37, 0.92), rgba(8, 28, 18, 0.9)) !important;
}

.seller-assignment-alert.automatic:hover {
  border-color: rgba(73, 233, 121, 0.5) !important;
}

.seller-assignment-alert.automatic .seller-assignment-icon {
  color: var(--green) !important;
  background: rgba(73, 233, 121, 0.09) !important;
}

.seller-assignment-alert.automatic small {
  color: var(--green) !important;
}

.website-check-pending {
  margin: 18px 0 0;
  color: #9aab9f;
  line-height: 1.55;
}

.website-check-results {
  margin-top: 16px;
}

.website-check-findings {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.website-check-findings li {
  position: relative;
  padding-left: 18px;
  color: #b6c2b9;
  line-height: 1.45;
}

.website-check-findings li::before {
  content: "·";
  position: absolute;
  left: 2px;
  color: #49e979;
  font-weight: 800;
}

.website-review-card {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid rgba(184, 243, 74, 0.38);
  border-radius: 16px;
  background: rgba(184, 243, 74, 0.07);
}

.website-review-card > strong {
  display: block;
  color: #f4f3e8;
  font-size: 1rem;
}

.website-review-card > p {
  margin: 8px 0 16px;
  color: #acb9af;
  line-height: 1.5;
}

.website-review-card > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.website-review-card button {
  min-height: 48px;
}

.website-check-ready,
.website-check-rejected {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.45;
}

.website-check-ready {
  color: #8ef4ab;
  background: rgba(73, 233, 121, 0.08);
  border: 1px solid rgba(73, 233, 121, 0.25);
}

.website-check-rejected {
  color: #ffb3b3;
  background: rgba(255, 104, 104, 0.08);
  border: 1px solid rgba(255, 104, 104, 0.24);
}

@media (max-width: 680px) {
  .website-review-card > div {
    grid-template-columns: 1fr;
  }
}

/* Website-Prüfungen: every current and future manual review is visible in
   the overview before the lead is opened. */
.website-review-overview-alert {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
  padding: 15px 18px;
  border: 1px solid rgba(196, 243, 63, 0.42);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(196, 243, 63, 0.11), rgba(73, 233, 121, 0.055));
  box-shadow: inset 3px 0 0 rgba(196, 243, 63, 0.9);
}

.website-review-overview-icon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  color: #c4f33f;
  border: 1px solid rgba(196, 243, 63, 0.34);
  border-radius: 50%;
  background: rgba(196, 243, 63, 0.09);
}

.website-review-overview-alert > span:last-child {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.website-review-overview-alert strong {
  color: #f4f3e8;
  font-size: 15px;
  line-height: 1.35;
}

.website-review-overview-alert small {
  color: #aebbb1;
  font-size: 13px;
  line-height: 1.45;
}

.website-check-overview-row.requires-review {
  background: linear-gradient(90deg, rgba(196, 243, 63, 0.075), rgba(73, 233, 121, 0.025));
  box-shadow: inset 4px 0 0 rgba(196, 243, 63, 0.82);
}

.website-check-overview-row.requires-review:hover {
  background: linear-gradient(90deg, rgba(196, 243, 63, 0.12), rgba(73, 233, 121, 0.05));
}

.website-review-list-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  color: #d8ff67;
  border: 1px solid rgba(196, 243, 63, 0.55);
  border-radius: 8px;
  background: rgba(196, 243, 63, 0.09);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}

.website-review-list-badge.pending {
  color: #9bb0a1;
  border-color: rgba(167, 207, 184, 0.24);
  background: rgba(167, 207, 184, 0.055);
  font-weight: 650;
}

@media (max-width: 680px) {
  .website-review-overview-alert {
    align-items: flex-start;
    margin: 16px 0;
    padding: 14px;
  }

  .website-review-overview-alert strong {
    font-size: 16px;
  }

  .website-review-overview-alert small {
    font-size: 14px;
  }

  .workspace-page--website-checks .website-check-overview-row {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 14px !important;
    min-height: 0 !important;
    padding: 18px 16px !important;
  }

  .workspace-page--website-checks .website-check-overview-row .company-cell {
    align-items: flex-start;
    width: 100%;
  }

  .workspace-page--website-checks .website-check-overview-row .company-cell > span:last-child {
    min-width: 0;
    flex: 1;
  }

  .workspace-page--website-checks .website-check-overview-row .company-cell strong {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .workspace-page--website-checks .website-check-overview-row > span:nth-child(4) {
    display: flex;
    align-items: stretch;
    width: 100%;
    padding-top: 13px;
    border-top: 1px solid var(--line);
  }

  .workspace-page--website-checks .website-review-list-badge {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
  }
}
