/* ScoutYou mobile UX refinements v1.2.9 */
:root {
  --sy-touch: 46px;
  --sy-mobile-gap: 12px;
  --sy-mobile-card: 18px;
}

.sy-scroll-top {
  position: fixed;
  right: 14px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 80;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(35, 193, 107, .94);
  color: #04130b;
  font-weight: 900;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .32);
  cursor: pointer;
}

.sy-scroll-top[hidden] {
  display: none !important;
}

.sy-admin-toolbar {
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
}

.sy-admin-tabs,
.sy-admin-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.sy-admin-tabs::-webkit-scrollbar,
.sy-admin-filters::-webkit-scrollbar {
  display: none;
}

.sy-admin-chip {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
  color: inherit;
  padding: 0 13px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.sy-admin-chip.active {
  border-color: rgba(35, 193, 107, .75);
  background: rgba(35, 193, 107, .18);
  color: #d8ffe8;
}

.sy-admin-search {
  width: 100%;
  min-height: var(--sy-touch);
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 16px;
  background: rgba(255, 255, 255, .06);
  color: inherit;
  padding: 0 14px;
  font: inherit;
}

.sy-admin-search::placeholder {
  color: rgba(226, 232, 240, .58);
}

.sy-admin-empty-filter {
  grid-column: 1 / -1;
  border: 1px dashed rgba(148, 163, 184, .24);
  border-radius: 18px;
  padding: 14px;
  color: #94a3b8;
  background: rgba(255, 255, 255, .035);
}

@media (max-width: 900px) {
  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 780px) {
  html {
    scroll-padding-top: calc(92px + env(safe-area-inset-top));
  }

  body {
    overflow-x: hidden;
  }

  .app-shell {
    min-height: 100svh;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 70;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: center;
    padding: calc(8px + env(safe-area-inset-top)) 12px 10px !important;
    background: rgba(3, 8, 18, .92);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(148, 163, 184, .12);
  }

  .brand {
    min-width: 0;
  }

  .brand small {
    display: none !important;
  }

  .brand strong {
    font-size: 16px;
  }

  .brand-mark,
  .brand-mark img {
    width: 36px !important;
    height: 36px !important;
  }

  .public-site-nav {
    display: none !important;
  }

  .public-site-menu {
    justify-self: end;
  }

  #top-nav.top-nav {
    grid-column: 1 / -1;
    width: 100%;
    display: flex !important;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 3px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  #top-nav.top-nav::-webkit-scrollbar {
    display: none;
  }

  #top-nav .nav-pill,
  #top-nav .icon-btn,
  .tab-btn,
  .btn {
    min-height: var(--sy-touch);
  }

  #top-nav .nav-pill,
  #top-nav .icon-btn {
    flex: 0 0 auto;
    border-radius: 999px;
    padding-inline: 14px;
  }

  .app-main {
    width: 100%;
    padding: 14px 12px calc(42px + env(safe-area-inset-bottom)) !important;
  }

  .dashboard,
  .card-list,
  .form-stack {
    gap: var(--sy-mobile-gap) !important;
  }

  .card,
  .panel,
  .flat,
  .hero,
  .paywall-card,
  .profile-card,
  .recommendation {
    border-radius: var(--sy-mobile-card) !important;
  }

  .card,
  .panel,
  .flat {
    padding: 15px !important;
  }

  .grid-2,
  .grid-3,
  .form-grid,
  .role-selector-layout,
  .profile-edit-layout,
  .discover-layout,
  .premium-grid,
  .media-grid,
  .stats-grid,
  .admin-stats {
    grid-template-columns: 1fr !important;
  }

  .section-title-row {
    align-items: flex-start !important;
    gap: 10px !important;
  }

  .section-title-row:not(.compact) {
    flex-direction: column;
  }

  .table-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    align-items: stretch !important;
    padding: 12px !important;
  }

  .row-actions,
  .actions,
  .admin-registrant-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100%;
  }

  .row-actions .btn,
  .actions .btn,
  .admin-registrant-actions .btn {
    flex: 1 1 auto;
  }

  .admin-registrant-actions [data-admin-action="view-profile"] {
    flex-basis: 100%;
  }

  .admin-registrant-actions [data-admin-action="delete-profile"] {
    margin-top: 2px;
  }

  label.field,
  .field {
    gap: 7px !important;
  }

  input,
  select,
  textarea {
    min-height: var(--sy-touch) !important;
    font-size: 16px !important;
  }

  textarea {
    min-height: 118px !important;
  }

  .tabs {
    display: flex !important;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tabs .tab-btn {
    flex: 0 0 auto;
    border-radius: 999px;
    padding-inline: 14px;
  }

  .toast {
    left: 12px !important;
    right: 12px !important;
    bottom: calc(14px + env(safe-area-inset-bottom)) !important;
    max-width: none !important;
  }

  .sy-admin-toolbar {
    position: sticky;
    top: calc(92px + env(safe-area-inset-top));
    z-index: 35;
    margin-inline: -4px;
    padding: 10px 4px;
    background: rgba(7, 15, 29, .92);
    backdrop-filter: blur(16px);
    border-radius: 18px;
  }

  .sy-admin-search {
    font-size: 16px;
  }

  .sy-admin-chip {
    min-height: 40px;
  }

  #admin-profile-viewer-modal .admin-profile-card {
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .app-main {
    padding-inline: 10px !important;
  }

  .card,
  .panel,
  .flat {
    padding: 14px !important;
  }

  h1 {
    font-size: clamp(28px, 9vw, 36px) !important;
  }

  h2 {
    font-size: clamp(22px, 7vw, 29px) !important;
  }

  .btn,
  .tab-btn,
  .sy-admin-chip {
    font-size: 14px;
  }
}
