/* Site-wide responsive layer. Keep visual language in page CSS; fix layout reach. */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
}

img,
canvas,
video {
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

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

.table-wrap,
.account-table-wrap,
.canvas-wrap,
.line-chart-scroll,
.scatter-wrap,
.record-pane,
.category-list,
.report-nav {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.page,
.container,
.nav-page,
.account-main,
.report-main,
.card,
.section,
.account-panel,
.account-card,
.report-shell,
.report-main,
.table-wrap {
  min-width: 0;
}

.cell-wrap,
.profile-snippet,
.scenario-note,
.source-item,
.panel,
.account-card,
.nav-link,
.detail-value,
.query-value {
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .account-header,
  .site-header,
  .topbar,
  .top-bar,
  .report-topbar {
    flex-wrap: wrap;
  }

  .account-topnav,
  .topnav,
  .toolbar,
  .actions,
  .filter-row,
  .filter-line,
  .dashboard-control-row,
  .nav {
    flex-wrap: wrap;
  }

  .account-main,
  .account-main.wide,
  .page,
  .container,
  .report-main {
    max-width: 100%;
  }

  body[data-help-title="配置能力清单"] .record-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: minmax(260px, 1fr) minmax(300px, 1fr);
  }

  body[data-help-title="UX-Audit"] .ranking-hero,
  body[data-help-title="UX-Audit"] .knowledge-spine,
  body[data-help-title="UX-Audit"] .profile-card-sections {
    grid-template-columns: 1fr 1fr !important;
  }

  body[data-help-title="UX-Audit"].test-audit-mode .col-rule,
  body[data-help-title="UX-Audit"].test-audit-mode .col-detail {
    width: 260px;
  }
}

@media (max-width: 1024px) {
  .app-container {
    display: block;
  }

  .header {
    position: sticky;
    height: auto;
    min-height: var(--header-height, 60px);
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
  }

  .header-left,
  .header-right {
    min-width: 0;
    flex-wrap: wrap;
  }

  .sidebar {
    position: sticky;
    top: var(--header-height, 60px);
    left: auto;
    bottom: auto;
    width: 100%;
    max-height: 48vh;
    transform: none !important;
    border-right: 0;
    border-bottom: 1px solid var(--border-color, #e8e0d5);
    overflow: auto;
  }

  .sidebar-menu {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
  }

  .menu-item {
    flex: 0 0 auto;
    margin: 0;
  }

  .menu-link {
    white-space: nowrap;
  }

  .submenu {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  body[data-help-title="功能编辑平台"] .canvas-viewport {
    inset: 0 0 min(36vh, 300px) 0;
  }

  body[data-help-title="功能编辑平台"] .bottom-dock {
    height: min(36vh, 300px);
  }

  body[data-help-title="功能编辑平台"] .detail-actions {
    margin-right: 0;
    flex-wrap: wrap;
  }

  body[data-help-title="功能编辑平台"] .detail-grid,
  body[data-help-title="功能编辑平台"] .node-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .account-header,
  .site-header,
  .topbar,
  .top-bar,
  .report-topbar {
    align-items: flex-start;
    gap: 10px;
    padding-left: 18px;
    padding-right: 18px;
  }

  .account-topnav,
  .topnav,
  .topbar-main,
  .toolbar,
  .actions,
  .filter-row,
  .filter-line,
  .vehicle-picker,
  .report-nav {
    width: 100%;
  }

  .actions,
  .export-controls,
  .filter-info {
    margin-left: 0 !important;
  }

  .nav-page {
    width: min(100% - 28px, 800px);
    margin: 36px auto;
    padding: 0;
  }

  .account-main,
  .account-nav-page,
  .legal-page,
  .page,
  .container,
  .report-main {
    width: min(100% - 28px, 1180px);
    margin-left: auto;
    margin-right: auto;
  }

  .account-main {
    padding-top: 28px;
    padding-bottom: 42px;
  }

  .section,
  .card,
  .account-panel,
  .account-card,
  .legal-card {
    padding: 16px;
  }

  .section-heading,
  .intro,
  .main-grid,
  .record-grid,
  .ranking-hero,
  .knowledge-spine,
  .profile-card-sections,
  .metric-grid,
  .timeline,
  .analysis-grid,
  .cause-map,
  .source-grid,
  .two-column {
    grid-template-columns: 1fr !important;
  }

  .table-wrap,
  .account-table-wrap,
  .canvas-wrap {
    max-width: 100%;
    overflow-x: auto;
  }

  .data-table,
  .account-table,
  .table-wrap > table {
    min-width: 760px;
  }

  body[data-help-title="AI语音评测"].testing-mode .table-wrap,
  body[data-help-title="UX-Audit"].test-audit-mode .table-wrap {
    overflow-x: auto !important;
  }

  body[data-help-title="AI语音评测"].testing-mode table,
  body[data-help-title="UX-Audit"].test-audit-mode table {
    width: max-content;
    min-width: 100%;
  }

  body[data-help-title="AI语音评测"].testing-mode .filter-line,
  body[data-help-title="UX-Audit"].test-audit-mode .filter-line {
    align-items: stretch;
  }

  body[data-help-title="AI语音评测"].testing-mode .mode-buttons,
  body[data-help-title="UX-Audit"].test-audit-mode .mode-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  body[data-help-title="车型配置对比"] .vehicle-sticky-head {
    left: 14px !important;
    right: 14px;
    width: auto !important;
    max-width: calc(100vw - 28px);
  }

  body[data-help-title="车型配置对比"] .vehicle-sticky-spacer {
    max-width: 100%;
    overflow: hidden;
  }

  body[data-help-title="车型配置对比"] .category-panel,
  body[data-help-title="车型配置对比"] .table-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body[data-help-title="车型配置对比"] .category-tools {
    width: 100%;
  }

  body[data-help-title="车型配置对比"] .category-list {
    width: 100%;
    max-width: 100%;
  }

  body[data-help-title="评价数据库"] .main-content {
    width: auto !important;
    padding-left: 12px;
    padding-right: 12px;
  }

  body[data-help-title="评价数据库"] .main-content > .container {
    width: 100%;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body[data-help-title="评价数据库"] .rank-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
  }

  body[data-help-title="评价数据库"] .rank-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-help-title="评价数据库"] .rank-price,
  body[data-help-title="评价数据库"] .rank-score {
    min-width: 0;
  }

  body[data-help-title="评价数据库"] .rank-bar {
    grid-column: 2 / 4;
    width: 100%;
    min-width: 0;
  }

  body[data-help-title="评价数据库"] .table-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  body[data-help-title="评价数据库"] .pagination {
    flex-wrap: wrap;
  }

  body[data-help-title="信息目录"] .info-layout,
  body[data-help-title="信息目录"] .info-section,
  body[data-help-title="信息目录"] .info-table-wrap {
    min-width: 0;
    max-width: 100%;
  }

  body[data-help-title="信息目录"] .info-table-wrap {
    overflow-x: auto;
  }

  .rule-section {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
  }

  .rule-table {
    min-width: 540px;
  }
}

@media (max-width: 760px) {
  .account-header,
  .site-header,
  .topbar,
  .top-bar,
  .report-topbar {
    padding: 12px 14px;
  }

  .account-brand-logo,
  .brand-logo,
  .title-logo,
  .help-brand img {
    width: 74px;
  }

  .account-page-name,
  .site-page-name,
  .brand-title,
  .title-block h1,
  .top-bar h1,
  h1 {
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  .account-topnav,
  .topnav,
  .actions,
  .top-search,
  .mode-buttons,
  .filter-line,
  .pager,
  .section-head,
  .dashboard-section-head,
  .chart-head,
  .vehicle-card-head,
  .scenario-card-head {
    align-items: stretch;
  }

  .account-topnav a,
  .account-topnav button,
  .account-button,
  .topnav a,
  .actions button,
  .actions .link-btn,
  .filter-line button,
  .mode-buttons button,
  .nav a {
    min-width: 0;
  }

  input[type="text"],
  input[type="search"],
  input[type="number"],
  select,
  textarea {
    min-width: 0;
  }

  .filter-row input,
  .filter-row select,
  .filter-line input,
  .filter-line select,
  .top-search input,
  .search-box,
  input.search-box {
    width: 100% !important;
    flex: 1 1 160px;
  }

  .account-registration-notice {
    position: static;
    width: min(100% - 28px, 520px);
    margin: 12px auto 0;
    justify-content: center;
  }

  .account-section-title,
  .account-list-header,
  .account-filter-field,
  .modal-actions,
  .staged-actions,
  .empty-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .account-filter-field select,
  .staged-panel,
  .model-menu-panel,
  .car-menu-panel {
    width: min(100vw - 28px, 420px) !important;
  }

  .stat-card,
  .workflow-step,
  .score-row {
    align-items: flex-start;
  }

  .stats,
  .hero-meta,
  .legend,
  .rb {
    gap: 8px;
  }

  .canvas-wrap > svg,
  .chart-viewport svg {
    max-width: none;
  }

  .vp,
  .chart-viewport,
  #viewport {
    height: min(70vh, 640px) !important;
    min-height: 360px;
    overflow: auto !important;
    touch-action: pan-x pan-y;
  }

  body[data-help-title="功能编辑平台"] {
    overflow: hidden;
  }

  body[data-help-title="功能编辑平台"] .app {
    min-height: 0;
    height: auto;
    flex: 1 1 auto;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  body[data-help-title="功能编辑平台"] .top-chrome {
    flex-wrap: wrap;
    height: auto;
    min-height: 46px;
  }

  body[data-help-title="功能编辑平台"] .toolbar {
    height: auto;
    overflow: hidden;
  }

  body[data-help-title="功能编辑平台"] .workspace {
    min-height: 0;
    overflow: hidden;
  }

  body[data-help-title="功能编辑平台"] .canvas-viewport {
    position: absolute;
    inset: 0 0 min(44vh, 300px) 0;
    height: auto;
    min-height: 0;
  }

  body[data-help-title="功能编辑平台"] .bottom-dock {
    position: absolute;
    height: min(44vh, 300px);
    flex-direction: column;
    overflow: hidden;
  }

  body[data-help-title="功能编辑平台"] .ability-panel,
  body[data-help-title="功能编辑平台"] .dock-fill {
    width: 100%;
    min-width: 0;
  }

  body[data-help-title="功能编辑平台"] .ability-panel {
    height: 140px;
    flex: 0 0 140px;
  }

  body[data-help-title="功能编辑平台"] .dock-fill {
    min-height: 0;
    flex: 1 1 auto;
  }

  body[data-help-title="功能编辑平台"] .detail-panel {
    position: absolute;
    min-height: 0;
  }

  body[data-help-title="功能编辑平台"] .detail-head {
    align-items: center;
    flex-direction: row;
  }

  body[data-help-title="功能编辑平台"] .detail-subtitle {
    display: none;
    margin-left: 0;
  }

  body[data-help-title="功能编辑平台"] .detail-grid,
  body[data-help-title="功能编辑平台"] .node-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-help-url*="story-"] .header {
    gap: 6px;
  }

  body[data-help-url*="story-"] .search-box,
  body[data-help-url*="story-"] .float-search {
    left: 12px;
    right: 12px;
    top: 72px;
    width: auto;
    transform: none;
  }

  body[data-help-url*="story-"] .search-results {
    left: 12px;
    right: 12px;
    top: 110px;
    width: auto;
    transform: none;
  }

  body[data-help-url*="story-"] .side-panels {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 48px;
    width: auto;
    max-height: 42vh;
    overflow: auto;
  }

  body[data-help-url*="story-"] .route-panel,
  body[data-help-url*="story-"] #detailCard {
    max-height: 38vh;
    overflow: auto;
  }

  body[data-help-url*="story-"] #legendPanel {
    max-width: calc(100vw - 24px);
    bottom: 88px;
  }

  body[data-help-url*="story-"] .ctrl-group {
    top: 118px;
  }

  body[data-help-title="用户画像"] {
    overflow: auto;
  }

  body[data-help-title="用户画像"] .page {
    width: 100%;
    max-width: 100%;
    overflow: auto;
    padding-left: 10px;
    padding-right: 10px;
  }

  body[data-help-title="用户画像"] .top {
    flex-wrap: wrap;
  }

  body[data-help-title="用户画像"] .top h1 {
    flex: 1 0 100%;
    order: 3;
    text-align: left;
  }

  body[data-help-title="用户画像"] .gen {
    flex-wrap: wrap;
    gap: 8px;
  }

  body[data-help-title="用户画像"] .gen .sp {
    display: none;
  }

  body[data-help-title="用户画像"] .p {
    width: min(42vw, 140px);
  }

  body[data-help-title="用户画像"] .social {
    flex-wrap: wrap;
  }

  body[data-help-title="用户画像"] .social .p {
    width: min(42vw, 150px);
  }
}

@media (max-width: 560px) {
  .account-title,
  .nav-page h1,
  .page h1,
  .hero h1 {
    font-size: clamp(22px, 7vw, 30px);
  }

  .account-card,
  .nav-link,
  .section,
  .card,
  .cap-section,
  .metric,
  .panel {
    border-radius: 8px;
  }

  .data-table,
  .account-table,
  .table-wrap > table {
    min-width: 680px;
  }

  body[data-help-title="AI语音评测"].testing-mode .table-wrap {
    overflow-x: hidden !important;
  }

  body[data-help-title="AI语音评测"].testing-mode table {
    width: 100%;
    min-width: 0;
  }

  body[data-help-title="UX-Audit"] .ranking-metrics {
    grid-template-columns: 1fr !important;
  }

  body[data-help-url*="story-"] .nav {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}
