

/* ---------- Mobile filter drawer & compact cards ---------- */

html body .mobile-filter-bar,
html body .mobile-card-toggle {
  display: none;
}

@media (max-width: 767.98px) {
  html body .mobile-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.75rem 0;
  }

  html body .mobile-filter-toggle {
    min-height: 32px;
    padding-inline: 0.7rem;
    border-radius: 999px;
    font-size: 0.76rem;
  }

  html body .mobile-filter-chips {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  html body .mobile-filter-chips:empty {
    display: none;
  }

  html body .mobile-filter-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0.16rem 0.5rem;
    border: 1px solid var(--ui-border);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--ui-text);
    font-size: 0.68rem;
    line-height: 1.35;
  }

  html body .mobile-filter-chip--muted {
    color: var(--ui-subtle);
  }

  html body .mobile-filter-reset {
    display: inline-flex;
    align-items: center;
    padding: 0.16rem 0.4rem;
    color: var(--ui-accent-deep);
    font-size: 0.68rem;
    font-weight: 600;
    text-decoration: none;
  }

  html body .card[data-mobile-filter="1"]:not(.is-filter-open) > .card-body {
    display: none;
  }

  html body .card[data-mobile-filter="1"].is-filter-open > .card-body {
    display: block;
  }

  /* Compact mobile list cards: show key fields, reveal the rest on demand. */
  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td {
    display: none;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td[data-mobile-priority="control"],
  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td[data-mobile-priority="primary"],
  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td[data-mobile-priority="compact"],
  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td[data-mobile-priority="action"] {
    display: flex;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr {
    position: relative;
    gap: 0.34rem 0.6rem;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td[data-mobile-priority="control"] {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0 0.34rem !important;
    border-bottom: 1px dashed var(--ui-border);
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td[data-mobile-priority="control"]::before {
    content: "选择 / 基准";
    color: var(--ui-subtle);
    font-size: 0.62rem;
    font-weight: 600;
    margin-right: 0.15rem;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr.is-expanded > td {
    display: flex;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td[data-mobile-priority="compact"] {
    font-size: 0.82rem;
    font-weight: 600;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr:not(.is-expanded) .quality-details__body,
  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr:not(.is-expanded) .quality-more {
    display: none;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr:not(.is-expanded) .quality-details[open] .quality-details__body {
    display: block;
  }

  html body table[data-mobile-card="1"] tbody td.num,
  html body table[data-mobile-card="1"] tbody td.kpi-positive,
  html body table[data-mobile-card="1"] tbody td.kpi-negative,
  html body table[data-mobile-card="1"] tbody td.num-flat,
  html body table[data-mobile-card="1"] tbody td.num-up,
  html body table[data-mobile-card="1"] tbody td.num-down {
    text-align: left;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr:not(.is-expanded) .quality-cell {
    padding-right: 0 !important;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td[data-mobile-priority="compact"]::before {
    font-size: 0.62rem;
    font-weight: 600;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td[data-mobile-priority="action"] {
    padding-top: 0.42rem !important;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td[data-mobile-priority="action"] .toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    width: 100%;
  }

  html body table[data-mobile-card="1"][data-mobile-compact="1"] tbody tr > td[data-mobile-priority="action"] .btn {
    width: auto;
    flex: 1 1 auto;
  }

  html body .mobile-card-toggle {
    display: inline-flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: center;
    margin-top: 0.18rem;
    padding: 0.38rem 0.5rem;
    border: 1px dashed var(--ui-border);
    border-radius: 8px;
    background: #fbfcfe;
    color: var(--ui-muted);
    font-size: 0.72rem;
    font-weight: 600;
  }

  html body .mobile-card-toggle:hover {
    border-color: var(--ui-border-strong);
    background: #f4f7fb;
    color: var(--ui-accent-deep);
  }

  html[data-theme="dark"] body .mobile-filter-chip {
    border-color: var(--ui-border);
    background: rgba(148, 163, 184, 0.10);
    color: #c7d2e3;
  }

  html[data-theme="dark"] body .mobile-card-toggle {
    border-color: var(--ui-border);
    background: #0b1322;
    color: #9fb0c7;
  }
}

/* ---------- Run detail responsive ---------- */

@media (max-width: 991.98px) {
  html body .run-detail-card > .run-detail-header {
    flex-direction: column;
    align-items: stretch;
  }

  html body .run-detail-actions {
    justify-content: flex-start;
  }

  /* 指标带的列数由 design-system.css 统一管理，这里不再覆盖。 */
}

@media (max-width: 767.98px) {
  html body .run-detail-card > .run-detail-header {
    padding: 0.85rem 0.9rem 0.75rem;
  }

  html body .run-detail-panel {
    padding: 0.85rem 0.9rem 1rem;
  }

  html body .run-detail-actions {
    width: 100%;
    gap: 0.4rem;
  }

  html body .run-detail-actions > .btn,
  html body .run-detail-actions > .dropdown {
    flex: 1 1 auto;
  }

  html body .run-detail-actions > .dropdown > .btn {
    width: 100%;
  }

  html body .run-detail-tabs {
    padding: 0 0.7rem;
  }

  html body .run-detail-title {
    font-size: 1.2rem;
  }

  html body .run-position-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html body .trade-ticket-section > .d-flex:first-child {
    flex-direction: column;
    align-items: stretch;
  }

  html body .trade-ticket-section > .d-flex:first-child > .d-flex:last-child {
    width: 100%;
    margin-left: 0 !important;
    justify-content: flex-start !important;
  }

  html body .trade-ticket-section .strategy-collapse-toggle {
    align-self: flex-start;
  }

  html body .page-hero .hero-tags {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  html body .page-hero .hero-tags::-webkit-scrollbar {
    display: none;
  }

  html body .page-hero .hero-tag {
    flex: 0 0 auto;
  }
}