/*
 * SwissBauArchiv mobile clarity pass
 * Visual-only layer: preserves navigation, permissions and server actions.
 */

@media (max-width: 767px) {
  .portal-shell .mobile-portal-topbar,
  .customer-portal-shell.sba-vnext .mobile-portal-topbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: calc(66px + env(safe-area-inset-top, 0px));
    padding: calc(10px + env(safe-area-inset-top, 0px)) 10px 10px;
  }

  .portal-shell .mobile-portal-brand {
    min-width: 0;
    justify-content: flex-start;
    gap: 6px;
    overflow: hidden;
  }

  .portal-shell .mobile-portal-brand img {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
  }

  .portal-shell .mobile-portal-brand strong {
    min-width: 0;
    max-width: 100%;
    font-size: 0.92rem;
    letter-spacing: -0.018em;
  }

  .portal-shell .mobile-topbar-actions {
    min-width: 0;
    gap: 4px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.46);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.8), 0 10px 24px rgba(24, 29, 38, 0.06);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
    backdrop-filter: blur(18px) saturate(130%);
  }

  .portal-shell .mobile-topbar-actions > :where(button, a) {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 15px;
    background: transparent;
    box-shadow: none;
  }

  .portal-shell .mobile-topbar-actions > :where(button, a):active,
  .portal-shell .mobile-topbar-actions > :where(button, a):focus-visible {
    background: rgba(255, 255, 255, 0.72);
  }

  .portal-shell .mobile-topbar-actions .mobile-avatar-button {
    padding: 2px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(255, 255, 255, 0.9);
  }

  .portal-shell .mobile-topbar-actions .mobile-topbar-avatar {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
  }

  .portal-shell .mobile-bell-button em {
    top: -2px;
    right: -2px;
  }

  .customer-portal-shell.sba-vnext {
    font-size: 15px;
    line-height: 1.48;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-page {
    padding: 18px 12px 38px;
  }

  .customer-portal-shell.sba-vnext :where(h1, h2, h3, h4, p, strong, small, dt, dd) {
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-heading {
    gap: 10px;
    margin-bottom: 14px;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-heading :where(h1, h2) {
    max-width: 100%;
    font-size: clamp(28px, 8vw, 34px);
    line-height: 1.08;
    letter-spacing: -0.025em;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-heading p {
    margin-top: 7px;
    font-size: 14px;
    line-height: 1.42;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-section__head {
    gap: 10px;
    margin-bottom: 12px;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-section__head :where(h2, h3) {
    font-size: clamp(20px, 5.8vw, 24px);
    line-height: 1.12;
  }

  .customer-portal-shell.sba-vnext .project-command-heading {
    flex-direction: column;
    gap: 8px;
  }

  .customer-portal-shell.sba-vnext .project-command-heading h2 {
    font-size: clamp(22px, 6vw, 28px);
    line-height: 1.12;
  }

  .customer-portal-shell.sba-vnext .project-data-stamp {
    align-self: flex-start;
    max-width: 100%;
    font-size: 11px;
    white-space: normal;
  }

  .customer-portal-shell.sba-vnext :is(.sba-vnext-command-grid, .project-command-grid) > * {
    min-height: 0;
    padding: 16px;
  }

  .customer-portal-shell.sba-vnext .project-command-card {
    min-height: 0;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    padding: 16px;
    border-radius: 20px;
  }

  .customer-portal-shell.sba-vnext .project-command-card span:not(.project-command-icon) {
    font-size: 11px;
    line-height: 1.25;
    overflow-wrap: break-word;
  }

  .customer-portal-shell.sba-vnext .project-command-card :where(strong, h2, h3, h4) {
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .customer-portal-shell.sba-vnext .project-command-card strong,
  .customer-portal-shell.sba-vnext .project-command-card.next strong {
    font-size: clamp(18px, 5.2vw, 25px);
    line-height: 1.14;
  }

  .customer-portal-shell.sba-vnext .project-command-card p {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.42;
    overflow-wrap: break-word;
    -webkit-line-clamp: 4;
  }

  .customer-portal-shell.sba-vnext .project-cost-dashboard {
    padding: 16px;
  }

  .customer-portal-shell.sba-vnext .project-cost-dashboard-head {
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }

  .customer-portal-shell.sba-vnext .project-cost-dashboard-head strong {
    max-width: 100%;
    margin-top: 3px;
    font-size: clamp(18px, 5vw, 23px);
    line-height: 1.15;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .customer-portal-shell.sba-vnext .project-cost-dashboard-head small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: break-word;
  }

  .customer-portal-shell.sba-vnext .project-cost-ring {
    grid-column: 2;
    grid-row: 2;
    width: 72px;
    height: 72px;
    margin-top: 4px;
  }

  .customer-portal-shell.sba-vnext .project-cost-balance {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 14px;
  }

  .customer-portal-shell.sba-vnext .project-cost-balance > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 42%);
    align-items: baseline;
    gap: 10px;
    padding: 11px 12px;
  }

  .customer-portal-shell.sba-vnext .project-cost-balance span {
    font-size: 11px;
    line-height: 1.3;
    overflow-wrap: break-word;
  }

  .customer-portal-shell.sba-vnext .project-cost-balance strong {
    max-width: 100%;
    margin-top: 0;
    font-size: 15px;
    line-height: 1.16;
    text-align: right;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .customer-portal-shell.sba-vnext .project-cost-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .customer-portal-shell.sba-vnext .project-cost-legend > span {
    font-size: 11px;
    line-height: 1.25;
  }

  .customer-portal-shell.sba-vnext .project-cost-legend :is(b, small) {
    overflow-wrap: break-word;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card {
    min-height: 124px;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 5px 10px;
    padding: 14px;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > strong {
    font-size: 14px;
    line-height: 1.22;
    overflow-wrap: break-word;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > em {
    max-width: 100%;
    font-size: 18px;
    line-height: 1.14;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > small {
    font-size: 12px;
    line-height: 1.34;
    overflow-wrap: break-word;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-list-row {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 10px;
    min-height: 80px;
    padding: 10px;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-list-row__main :where(h3, h4, strong) {
    display: -webkit-box;
    white-space: normal;
    text-overflow: clip;
    overflow-wrap: break-word;
    -webkit-line-clamp: 2;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-list-row__main p {
    display: -webkit-box;
    margin-top: 4px;
    white-space: normal;
    overflow-wrap: break-word;
    -webkit-line-clamp: 2;
  }

  .customer-portal-shell.sba-vnext .customer-mobile-bottom-nav {
    gap: 3px;
    margin-right: 8px;
    margin-left: 8px;
    padding: 6px;
    border-radius: 22px;
  }

  .customer-portal-shell.sba-vnext .customer-mobile-bottom-nav > button {
    min-height: 58px;
    gap: 4px;
    padding: 6px 2px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.05;
    white-space: nowrap;
  }

  .customer-portal-shell.sba-vnext .customer-mobile-bottom-nav > button :where(svg, .svg-icon) {
    width: 22px;
    height: 22px;
  }

  .portal-shell .mobile-nav-drawer {
    width: min(90vw, 360px);
    padding-left: 14px;
    padding-right: 14px;
  }

  .portal-shell .mobile-drawer-nav {
    gap: 8px;
  }

  .portal-shell .mobile-drawer-item {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    min-height: 52px;
    padding: 0 14px;
    border-radius: 17px;
    font-size: 15px;
  }

  .portal-shell .mobile-drawer-item > :where(svg, .svg-icon) {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 620px) {
  .customer-portal-shell.sba-vnext :is(
    .sba-vnext-quick-grid,
    .sba-vnext-summary-grid,
    .sba-vnext-command-grid,
    .project-command-grid,
    .project-widget-grid
  ) {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-portal-shell.sba-vnext :is(.sba-vnext-command-grid, .project-command-grid) > :first-child {
    grid-column: auto;
  }

  .customer-portal-shell.sba-vnext .project-command-grid .project-cost-dashboard {
    grid-column: auto;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-portal-shell.sba-vnext .project-cost-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .customer-portal-shell.sba-vnext .sba-vnext-page {
    padding-right: 10px;
    padding-left: 10px;
  }

  .customer-portal-shell.sba-vnext .project-cost-legend {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-portal-shell.sba-vnext .customer-mobile-bottom-nav > button {
    font-size: 10px;
  }
}

@media (max-width: 360px) {
  .portal-shell .mobile-portal-brand strong {
    display: none;
  }

  .portal-shell .mobile-portal-brand {
    justify-content: center;
  }
}
/* SwissBauArchiv responsive Bento system */
.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(154px, auto);
  gap: 14px;
  align-items: stretch;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card {
  --widget-tint: #64748b;
  --widget-wash: rgba(100, 116, 139, 0.14);
  position: relative;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  min-width: 0;
  min-height: 154px;
  padding: 18px !important;
  gap: 7px 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.86) !important;
  border-radius: 24px !important;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(245, 248, 252, 0.82)),
    radial-gradient(circle at 100% 0%, var(--widget-wash), transparent 58%);
  box-shadow:
    0 14px 34px rgba(24, 34, 49, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  isolation: isolate;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card::before {
  position: absolute;
  inset: -76px -58px auto auto;
  width: 168px;
  height: 168px;
  content: "";
  background: radial-gradient(circle, var(--widget-wash), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:has(.widget-icon.green) {
  --widget-tint: #16a34a;
  --widget-wash: rgba(34, 197, 94, 0.18);
}
.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:has(.widget-icon.blue) {
  --widget-tint: #2563eb;
  --widget-wash: rgba(59, 130, 246, 0.17);
}
.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:has(.widget-icon.orange) {
  --widget-tint: #ea580c;
  --widget-wash: rgba(249, 115, 22, 0.17);
}
.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:has(.widget-icon.violet) {
  --widget-tint: #7c3aed;
  --widget-wash: rgba(139, 92, 246, 0.16);
}
.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:has(.widget-icon.teal) {
  --widget-tint: #0f766e;
  --widget-wash: rgba(20, 184, 166, 0.16);
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > .widget-icon {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  border-radius: 15px !important;
  box-shadow: 0 8px 18px rgba(24, 34, 49, 0.08);
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > strong,
.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > em,
.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > small,
.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > .widget-subdetail {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > strong {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  padding-top: 2px;
  color: #667085;
  font-size: clamp(12px, 1.05vw, 14px) !important;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > em {
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: center;
  color: #111827;
  font-size: clamp(22px, 2.2vw, 34px) !important;
  font-style: normal;
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > small {
  grid-column: 1 / -1;
  grid-row: 3;
  align-self: end;
  color: #667085;
  font-size: clamp(12px, 1vw, 14px) !important;
  line-height: 1.35;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > .widget-subdetail {
  grid-column: 1 / -1;
  grid-row: 4;
  color: #8a94a6;
  font-size: 12px;
  line-height: 1.3;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > .widget-status-bar {
  grid-column: 1 / -1;
  grid-row: 5;
  align-self: end;
  min-width: 0;
  margin-top: 4px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(24, 34, 49, 0.06);
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:first-child,
.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:has(.widget-status-bar) {
  grid-column: span 2;
}

@media (hover: hover) and (pointer: fine) {
  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 1) !important;
    box-shadow:
      0 20px 42px rgba(24, 34, 49, 0.15),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:focus-within {
  border-color: rgba(220, 38, 74, 0.32) !important;
  box-shadow:
    0 18px 38px rgba(24, 34, 49, 0.14),
    0 0 0 3px rgba(220, 38, 74, 0.10);
}

@media (max-width: 1280px) {
  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card {
    min-height: 148px;
  }
}

@media (max-width: 767px) {
  .portal-shell .mobile-portal-topbar,
  .customer-portal-shell.sba-vnext .mobile-portal-topbar {
    position: relative !important;
    isolation: isolate;
    overflow: visible !important;
  }

  .portal-shell .mobile-search-sheet,
  .customer-portal-shell.sba-vnext .mobile-search-sheet {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - 104px) !important;
    margin: 0 !important;
    padding: 10px !important;
    overflow: auto !important;
    z-index: 650 !important;
    border: 1px solid rgba(255, 255, 255, 0.94) !important;
    border-radius: 24px !important;
    background: rgba(248, 251, 255, 0.98) !important;
    box-shadow:
      0 22px 54px rgba(24, 34, 49, 0.24),
      0 0 0 1px rgba(110, 139, 173, 0.10);
    -webkit-backdrop-filter: blur(22px) saturate(130%);
    backdrop-filter: blur(22px) saturate(130%);
  }

  .portal-shell .mobile-search-sheet .global-search.mobile,
  .customer-portal-shell.sba-vnext .mobile-search-sheet .global-search.mobile,
  .portal-shell .mobile-search-sheet .global-search {
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr) !important;
    align-items: center;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px;
    gap: 8px;
    padding: 6px 12px 6px 8px !important;
    border: 1px solid rgba(148, 163, 184, 0.32) !important;
    border-radius: 17px !important;
    background: rgba(255, 255, 255, 0.94) !important;
    box-shadow: 0 6px 16px rgba(24, 34, 49, 0.06);
  }

  .portal-shell .mobile-search-sheet .global-search.mobile:focus-within,
  .customer-portal-shell.sba-vnext .mobile-search-sheet .global-search.mobile:focus-within,
  .portal-shell .mobile-search-sheet .global-search:focus-within {
    border-color: rgba(220, 38, 74, 0.42) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 74, 0.10);
  }

  .portal-shell .mobile-search-sheet .global-search.mobile input,
  .customer-portal-shell.sba-vnext .mobile-search-sheet .global-search.mobile input,
  .portal-shell .mobile-search-sheet .global-search input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 34px;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    color: #172033;
    font-size: 16px !important;
    line-height: 1.25;
    box-shadow: none !important;
  }

  .portal-shell .mobile-search-sheet .global-search-panel,
  .customer-portal-shell.sba-vnext .mobile-search-sheet .global-search-panel {
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    margin-top: 8px !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .portal-shell .mobile-search-sheet .search-result-item,
  .customer-portal-shell.sba-vnext .mobile-search-sheet .search-result-item {
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) !important;
    align-items: start;
    width: 100% !important;
    min-width: 0;
    min-height: 58px;
    gap: 10px;
    margin: 6px 0 !important;
    padding: 10px 12px !important;
    border: 1px solid rgba(214, 222, 233, 0.76);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
  }

  .portal-shell .mobile-search-sheet .search-result-item :where(strong, h3, h4, p, small, span),
  .customer-portal-shell.sba-vnext .mobile-search-sheet .search-result-item :where(strong, h3, h4, p, small, span) {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
  }

  .portal-shell .mobile-search-sheet .search-empty,
  .customer-portal-shell.sba-vnext .mobile-search-sheet .search-empty {
    min-height: auto !important;
    padding: 18px 12px !important;
    color: #667085;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(142px, auto);
    gap: 10px;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card {
    min-height: 142px;
    padding: 14px !important;
    gap: 6px 9px;
    border-radius: 21px !important;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > .widget-icon {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px;
    border-radius: 13px !important;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > strong {
    font-size: 11px !important;
    line-height: 1.18;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > em {
    font-size: clamp(18px, 5.8vw, 27px) !important;
    line-height: 1.08;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > small {
    font-size: 11px !important;
    line-height: 1.3;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:first-child,
  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:has(.widget-status-bar) {
    grid-column: span 2;
  }
}

@media (max-width: 359px) {
  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:first-child,
  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card:has(.widget-status-bar) {
    grid-column: auto;
  }
}

/*
 * Full responsive clarity pass
 * 2026-09-07 — layout-only overrides for admin and customer surfaces.
 * No data, navigation, permissions or actions are changed here.
 */

:where(.portal-shell, .customer-portal-shell.sba-vnext),
:where(.portal-shell, .customer-portal-shell.sba-vnext) * {
  box-sizing: border-box;
  min-width: 0;
}

:where(.portal-shell, .customer-portal-shell.sba-vnext) {
  max-width: 100%;
}

:where(.portal-shell, .customer-portal-shell.sba-vnext) :where(
  h1, h2, h3, h4, h5, p, strong, em, small, span, label, dt, dd, li, button
) {
  max-width: 100%;
  word-break: normal !important;
  overflow-wrap: break-word;
  hyphens: none;
  text-overflow: clip !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: initial !important;
}

:where(.portal-shell, .customer-portal-shell.sba-vnext) :where(
  input, select, textarea, button, a
) {
  max-width: 100%;
}

/* Admin: preserve full words and let cards grow with their content. */
.portal-shell:not(.customer-portal-shell) main,
.portal-shell:not(.customer-portal-shell) main > *,
.portal-shell:not(.customer-portal-shell) main article,
.portal-shell:not(.customer-portal-shell) main section {
  min-width: 0;
  max-width: 100%;
}

.portal-shell:not(.customer-portal-shell) main :where(
  h1, h2, h3, h4, h5, p, strong, em, small, span, label, dt, dd, li, button
) {
  overflow: visible !important;
  white-space: normal !important;
}

.portal-shell:not(.customer-portal-shell) main :where(
  input, select, textarea
) {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.portal-shell:not(.customer-portal-shell) main h1 {
  max-inline-size: 100%;
  font-size: clamp(2.2rem, 4vw, 4rem) !important;
  line-height: 1.02 !important;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.portal-shell:not(.customer-portal-shell) main :where(h2, h3, h4) {
  text-wrap: pretty;
}

/* User and registration cards: no narrow name/email columns or floating actions. */
.portal-shell:not(.customer-portal-shell) main article:has(input[type="email"]),
.portal-shell:not(.customer-portal-shell) main article:has(input[placeholder*="@"]) {
  min-width: 0;
  overflow: visible !important;
}

.portal-shell:not(.customer-portal-shell) main article:has(input[type="email"]) > *,
.portal-shell:not(.customer-portal-shell) main article:has(input[placeholder*="@"]) > *,
.portal-shell:not(.customer-portal-shell) main article:has(input[type="email"]) :where(form, [class*="grid"], [class*="row"]),
.portal-shell:not(.customer-portal-shell) main article:has(input[placeholder*="@"]) :where(form, [class*="grid"], [class*="row"]) {
  min-width: 0;
  max-width: 100%;
}

.portal-shell:not(.customer-portal-shell) main article:has(input[type="email"]) :where(h2, h3, h4, strong),
.portal-shell:not(.customer-portal-shell) main article:has(input[placeholder*="@"]) :where(h2, h3, h4, strong) {
  width: auto;
  max-width: 100%;
  white-space: normal !important;
}

.portal-shell:not(.customer-portal-shell) main article:has(input[placeholder="Sicheres Startpasswort"]) {
  overflow: visible !important;
}

.portal-shell:not(.customer-portal-shell) main article:has(input[placeholder="Sicheres Startpasswort"]) :where(
  button, input, select, textarea
) {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  min-width: 0;
  max-width: 100%;
}

.portal-shell:not(.customer-portal-shell) main article:has(input[placeholder="Sicheres Startpasswort"]) button {
  justify-self: start;
  width: auto;
}

/* Customer project detail: appointments, open items and Bento cards must grow. */
.customer-portal-shell.sba-vnext .sba-vnext-project-detail :where(
  article, section, button, .project-flow-list, .project-widget-card
) {
  min-width: 0;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail :where(
  h1, h2, h3, h4, p, strong, em, small, span, time, button
) {
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: initial !important;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-flow-list {
  display: grid;
  grid-auto-rows: auto;
  align-content: start;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-flow-list > * {
  min-width: 0;
  max-width: 100%;
}

/* The five-part appointment row must fit the project panel on desktop too. */
.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-flow-row {
  grid-template-columns: minmax(104px, .85fr) minmax(150px, 1.35fr)
    minmax(120px, 1fr) minmax(150px, 1.35fr) minmax(128px, 1fr) !important;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-flow-row > * {
  min-width: 0;
  max-width: 100%;
  width: auto;
  overflow-wrap: break-word;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .flow-state,
.customer-portal-shell.sba-vnext .sba-vnext-project-detail .flow-state :where(
  button, small, span
) {
  min-width: 0;
  max-width: 100%;
  width: auto;
  white-space: normal !important;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-grid {
  grid-auto-rows: auto !important;
  align-items: stretch;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card {
  grid-template-rows: auto auto auto auto auto !important;
  align-content: start;
}

.customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-widget-card > :where(
  strong, em, small, .widget-subdetail, .widget-status-bar
) {
  min-width: 0;
  max-width: 100%;
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
}

/* Customer lists and finance cards: values stay readable instead of becoming ellipses. */
.customer-portal-shell.sba-vnext :where(
  article, .sba-vnext-quick-card, .sba-vnext-list-row, .sba-vnext-list-row__main,
  .sba-vnext-list-row__aside
) {
  min-width: 0;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.customer-portal-shell.sba-vnext .sba-vnext-list-row__main {
  min-width: 0;
}

.customer-portal-shell.sba-vnext .sba-vnext-list-row__aside {
  width: auto;
  max-width: 44%;
  white-space: normal !important;
  overflow-wrap: anywhere;
  text-overflow: clip !important;
}

.customer-portal-shell.sba-vnext :where(
  .sba-vnext-quick-card, .sba-vnext-list-row, article
) :where(h1, h2, h3, h4, p, strong, em, small, span, time) {
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: initial !important;
}

/* Tablet and phone: keep every grid item inside the viewport. */
@media (max-width: 900px) {
  .portal-shell:not(.customer-portal-shell) main {
    width: 100%;
    max-width: 100%;
  }

  .portal-shell:not(.customer-portal-shell) main :where(
    [class*="grid"], [class*="cards"], [class*="columns"]
  ) {
    min-width: 0;
    max-width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .portal-shell:not(.customer-portal-shell) main :where(
    [class*="grid"], [class*="cards"], [class*="columns"]
  ) > * {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 620px) {
  .portal-shell:not(.customer-portal-shell) main h1 {
    font-size: clamp(2rem, 10vw, 3rem) !important;
    line-height: 1.04 !important;
  }

  .portal-shell:not(.customer-portal-shell) main :where(
    [class*="grid"], [class*="cards"], [class*="columns"]
  ) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .portal-shell:not(.customer-portal-shell) main article:has(input[type="email"]),
  .portal-shell:not(.customer-portal-shell) main article:has(input[placeholder*="@"]) {
    width: 100%;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-list-row__aside {
    max-width: 48%;
  }

  .customer-portal-shell.sba-vnext .sba-vnext-project-detail .project-flow-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 420px) {
  .customer-portal-shell.sba-vnext .sba-vnext-list-row__aside {
    max-width: 46%;
    font-size: 0.9em;
  }
}


/* Admin tablet split: prevent the generic two-column mobile fallback from narrowing user cards. */
@media (max-width: 900px) {
  .portal-shell:not(.customer-portal-shell) main .split-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}


/* Admin customer preview: wrap all preview destinations instead of clipping the last tab. */
@media (max-width: 900px) {
  .admin-shell .admin-preview-nav {
    flex-wrap: wrap;
    overflow: visible;
  }

  .admin-shell .admin-preview-nav :is(button, a) {
    flex: 1 1 160px;
    width: auto;
    min-width: min(160px, 100%);
    white-space: normal;
  }
}


/* Admin users: stack the create form and user cards at the page container width. */
.admin-shell main:has(.user-row) > .stack-view > .split-grid {
  grid-template-columns: minmax(0, 1fr) !important;
}


/* Admin customer preview: keep the property hero full-width after the mobile grid fallback. */
@media (max-width: 900px) {
  .admin-shell .admin-preview-surface.customer-portal-shell.sba-vnext .sba-vnext-start-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}


/* Admin B2B and work mode: adapt to the available portal content width. */
@media (max-width: 1280px) {
  .admin-shell main:has(.partner-info-row) .split-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 620px) {
  .admin-shell .admin-customer-tabs {
    flex-wrap: wrap;
    overflow: visible;
  }

  .admin-shell .admin-customer-tab {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    white-space: normal;
  }
}
