/* Mobile report layouts; desktop report styles remain unchanged. */
@media screen and (max-width:760px) {
  .report-workspace-heading,
  .report-workspace-heading > div,
  .report-workspace-tabs,
  #report-filters,
  #report-results,
  #report-results > *,
  #report-results .card {
    min-width:0;
    max-width:100%;
  }

  .report-workspace-heading p {
    max-width:none;
    overflow-wrap:anywhere;
  }

  .report-workspace-tabs {
    flex-wrap:wrap;
    gap:6px;
    border-bottom:0;
    overflow:visible;
  }

  .report-workspace-tab {
    flex:1 1 calc(33.333% - 6px);
    min-width:0;
    min-height:44px;
    justify-content:center;
    padding:10px 12px;
    border:1px solid var(--line);
    border-bottom-width:2px;
    border-radius:7px;
    background:#fff;
    font-size:13px;
    line-height:1.5;
    white-space:normal;
    text-align:center;
  }

  .report-workspace-tab svg { flex-shrink:0; }
  .report-workspace-tab span { min-width:0; overflow-wrap:anywhere; }
  .report-workspace-tab.active { border-color:#a7cfc4; border-bottom-color:var(--teal); background:var(--teal-light); }
  .report-workspace-tab:hover { border-radius:7px; }

  #report-filters { padding-inline:16px; }
  #report-filters .report-toolbar { align-items:stretch; gap:12px; }
  #report-filters .report-time-choice { display:block; min-width:0; width:100%; }
  #report-filters .report-time-choice > strong { display:block; margin:0 0 10px; }
  #report-filters .range-presets { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); width:100%; gap:6px; }
  #report-filters .range-presets .button { min-width:0; min-height:44px; padding:8px 5px; font-size:12px; white-space:normal; }
  #report-filters .report-applied-range { margin-left:0; white-space:normal; overflow-wrap:anywhere; font-size:12px; }
  #report-filters .report-custom-fields { grid-template-columns:repeat(2,minmax(0,1fr)); min-width:0; }
  #report-filters .report-custom-fields > .button { grid-column:1/-1; }
  #report-filters .report-filter-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
  #report-filters .report-filter-grid > .field:last-child:nth-child(odd) { grid-column:auto; }
  #report-filters .field,
  #report-filters .report-filter-grid > div { min-width:0; max-width:100%; }
  #report-filters input:not([type=hidden]),
  #report-filters select { width:100%; max-width:100%; min-width:0; min-height:44px; font-size:16px; }
  #report-filters .report-quick-search { min-width:0; align-items:flex-end; }
  #report-filters .report-quick-search > .button { flex-shrink:0; }
  #report-filters .report-extra-filters > summary { max-width:100%; min-height:44px; padding-block:10px; font-size:13px; overflow-wrap:anywhere; }
  #report-filters .report-extra-filters[open] > summary { margin-bottom:10px; }
  #report-filters .report-extra-actions { flex-wrap:wrap; gap:8px; }
  #report-filters .report-extra-actions .button { flex:1 1 130px; }
  #report-filters .button { min-height:44px; white-space:normal; }
  #report-filters .report-filter-pending { overflow-wrap:anywhere; }

  .report-summary-heading { align-items:flex-start; flex-wrap:wrap; gap:7px; }
  .report-summary-heading > span { overflow-wrap:anywhere; }
  #report-results .report-simple-metrics,
  #report-results .report-simple-metrics.four-metrics,
  #report-results .report-simple-metrics.two-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  #report-results .report-simple-metrics > .stat-card { min-width:0; padding:17px; }
  #report-results .stat-value { max-width:100%; font-size:clamp(22px,4.5vw,30px); overflow-wrap:anywhere; }
  #report-results .metric-label,
  #report-results .report-metric-help { overflow-wrap:anywhere; }

  .profit-overview,
  .profit-visual-grid { grid-template-columns:minmax(0,1fr); }
  .profit-hero { padding:22px; min-height:0; }
  .profit-hero-top { flex-wrap:wrap; gap:9px; }
  .profit-date-chip { max-width:100%; white-space:normal; overflow-wrap:anywhere; font-size:11px; }
  .profit-hero-value { max-width:100%; margin-top:22px; font-size:clamp(28px,8vw,40px); line-height:1.25; overflow-wrap:anywhere; }
  .profit-hero.unknown .profit-hero-value { font-size:clamp(25px,7vw,30px); }
  .profit-hero-bottom { align-items:flex-start; flex-wrap:wrap; }
  .profit-equation { padding:20px; }
  .profit-section-title { flex-wrap:wrap; align-items:flex-start; min-width:0; gap:8px; }
  .profit-section-title > div { min-width:0; }
  .profit-equation-line,
  .profit-equation-total { flex-wrap:wrap; gap:7px 14px; }
  .profit-equation-line > span,
  .profit-equation-total > span { min-width:0; overflow-wrap:anywhere; }
  .profit-equation-line strong,
  .profit-equation-total strong { max-width:100%; margin-left:auto; white-space:normal; overflow-wrap:anywhere; text-align:right; }
  .profit-equation-line strong { font-size:20px; }
  .profit-equation-total strong { font-size:24px; }
  .profit-facts { gap:10px 18px; align-items:flex-start; }
  .profit-facts > div { min-width:0; max-width:100%; padding:0; border-left:0; flex-wrap:wrap; overflow-wrap:anywhere; }
  .profit-facts > div:last-child { display:flex; margin-left:0; }
  .profit-facts svg { flex-shrink:0; }

  .report-stock-overview { padding:18px; gap:16px; }
  .report-stock-overview-title { min-width:0; flex-basis:100%; gap:10px; }
  .report-stock-overview-title > div { min-width:0; overflow-wrap:anywhere; }
  .report-stock-overview-value { min-width:0; max-width:100%; flex-basis:100%; text-align:left; }
  .report-stock-overview-value strong { font-size:clamp(23px,6vw,28px); overflow-wrap:anywhere; }
  .report-stock-overview > .button { min-height:44px; min-width:0; width:100%; font-size:13px; white-space:normal; }

  /* Keep the SVG's axis labels legible; swiping stays inside its own card. */
  .profit-chart-card { overflow-x:auto; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; }
  .profit-chart-card .profit-section-title { position:sticky; left:0; max-width:100%; padding-inline:0; }
  .profit-legend { flex-wrap:wrap; font-size:11px; white-space:normal; gap:10px; }
  .profit-trend-svg { width:100%; min-width:560px; max-width:none; min-height:0; margin-top:15px; overflow:hidden; }
  .profit-chart-empty { min-width:0; overflow-wrap:anywhere; }
  .profit-reading-card { grid-template-columns:33px minmax(0,1fr); padding:18px; }
  .profit-reading-card > *,
  .profit-warning > div { min-width:0; overflow-wrap:anywhere; }
  .profit-warning { padding:14px; }

  #report-results .report-result-card .card-heading,
  .profit-detail-heading { align-items:flex-start; flex-wrap:wrap; padding:18px; gap:13px; }
  #report-results .report-result-card .card-heading > div,
  .profit-detail-heading > div { flex:1 1 240px; min-width:0; overflow-wrap:anywhere; }
  .profit-detail-heading p { max-width:none; font-size:12px; }
  #report-results .card-heading .button,
  .profit-detail-heading .button { flex-shrink:0; min-height:44px; padding:10px 13px; font-size:13px; white-space:normal; }
  #report-results .card-heading .button svg,
  .profit-detail-heading .button svg { display:block; flex-shrink:0; }
  .profit-detail-tabs { width:auto; max-width:calc(100% - 36px); margin:0 18px 18px; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; }
  .profit-detail-tabs button { min-width:0; min-height:44px; padding:9px 6px; font-size:12px; line-height:1.5; overflow-wrap:anywhere; }

  /* Every column stays available; only the table viewport scrolls horizontally. */
  #report-results .table-scroll { min-width:0; width:100%; max-width:100%; overflow:auto; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; }
  #report-results .table-scroll table { width:100%; }
  #report-results .table-scroll th { white-space:nowrap; }
  #report-results .table-scroll :is(th,td) { padding:14px 16px; }
  #report-results .table-scroll td:not(.right) { min-width:140px; max-width:260px; white-space:normal; overflow-wrap:anywhere; }
  #report-results .table-scroll td:first-child { min-width:180px; max-width:260px; }
  #report-results .table-scroll td:first-child strong,
  #report-results .table-scroll .table-secondary { overflow-wrap:anywhere; white-space:normal; }
  #report-results .table-scroll .right,
  #report-results .report-serial-price { white-space:nowrap; }
  #report-results .report-money-details { min-width:0; max-width:100%; padding:16px; }
  #report-results .report-money-details .table-scroll { margin:0; }
  #report-results .report-money-details > summary { min-height:44px; max-width:100%; padding-block:9px; overflow-wrap:anywhere; }
  #report-results .report-pagination { align-items:flex-start; flex-direction:column; padding:16px; gap:12px; overflow-wrap:anywhere; }
  #report-results .report-pagination > div { width:100%; min-width:0; margin-left:0; flex-wrap:wrap; align-items:center; gap:8px; }
  #report-results .report-pagination .button { flex:1 1 80px; min-height:44px; font-size:13px; }
  #report-results .report-page-number { padding:0 3px; }
  .report-bottom-note,
  .profit-method { overflow-wrap:anywhere; font-size:12px; }
  .profit-method summary { min-height:44px; max-width:100%; padding-block:10px; }
}

@media screen and (max-width:480px) {
  .report-workspace-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .report-workspace-tab:last-child:nth-child(odd) { grid-column:1/-1; }
  #report-filters .report-custom-fields,
  #report-filters .report-filter-grid { grid-template-columns:minmax(0,1fr); }
  #report-filters .report-quick-search { flex-wrap:wrap; }
  #report-filters .report-quick-search > .field { flex-basis:100%; }
  #report-filters .report-quick-search > .button { width:100%; }
  #report-results .report-simple-metrics,
  #report-results .report-simple-metrics.four-metrics,
  #report-results .report-simple-metrics.two-metrics { grid-template-columns:minmax(0,1fr); }
  #report-results .report-simple-metrics > .stat-card { grid-column:auto; min-height:0; }
  #report-results .stat-value,
  #report-results .report-primary-metric .stat-value { font-size:28px; }
  #report-results .card-heading .button,
  .profit-detail-heading .button { width:100%; }
}

@media screen and (max-width:360px) {
  #report-filters .range-presets { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .profit-hero { padding:18px; }
  .profit-equation { padding:17px; }
  .profit-detail-tabs { margin-inline:12px; max-width:calc(100% - 24px); }
  .profit-detail-tabs button { font-size:11px; }
}
