/* iPhone 6s / iOS 15 Safari 与企业微信内置浏览器兼容层 */
html,
body,
#root {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  -webkit-overflow-scrolling: touch;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

/* iOS 聚焦小于 16px 的输入框会自动放大页面；统一为 16px。 */
input,
select,
textarea {
  font-size: 16px;
}

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

@media (max-width: 820px) {
  .main-shell {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .content-wrap {
    width: 100%;
    max-width: 100%;
    padding: 20px 14px calc(82px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 58px;
    height: auto;
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .top-actions {
    min-width: 0;
    gap: 8px;
  }

  .search-box {
    width: min(42vw, 170px);
  }

  .search-box input {
    min-width: 0;
    font-size: 16px;
  }

  .panel,
  .section-heading,
  .metrics-grid,
  .dashboard-grid,
  .score-ranking-layout,
  .location-grid,
  .upload-layout {
    max-width: 100%;
    min-width: 0;
  }

  .history-table,
  .member-table,
  .records-table {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .auth-shell {
    display: block;
    min-height: 100vh;
    min-height: 100svh;
  }

  .auth-art {
    display: none;
  }

  .auth-panel {
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  }

  .auth-copy {
    margin-top: 42px;
  }

  .mobile-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 390px) {
  .content-wrap {
    padding-right: 12px;
    padding-left: 12px;
  }

  .topbar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .search-box {
    width: 38vw;
  }

  .profile-text,
  .breadcrumb span:not(:last-child) {
    display: none;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}
