/* Phone/tablet presentation only. Export canvases retain their desktop geometry. */
@media screen and (max-width: 900px) {
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export),
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) {
    width:100%; min-width:0; max-width:none; grid-template-columns:minmax(0,1fr);
    padding-left:env(safe-area-inset-left); padding-right:env(safe-area-inset-right);
  }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.content,.grid,.panel,.card,.chart-body,.management-layout,.main) { min-width:0; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .topbar { display:flex; flex-direction:column; align-items:stretch; gap:12px; padding:18px 16px; white-space:normal; height:auto; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.title-wrap,.title-line) { flex-wrap:wrap; gap:10px; width:100%; min-width:0; flex:1 1 100%; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) h1 { font-size:25px; line-height:1.3; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .toolbar { display:flex; flex-wrap:wrap; justify-content:flex-start; gap:8px; min-width:0; width:100%; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(button,select,.header-btn,.dashboard-entry) { min-height:44px; height:auto; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(select,input[type=date]) { font-size:16px; max-width:100%; min-width:0; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .content { padding:12px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.chart-grid,.charts,.management-layout,.bottom) { display:grid; grid-template-columns:minmax(0,1fr); gap:14px; }
  /* Clear desktop named areas too: otherwise they create an implicit second
     column and squeeze auto-placed panels into a nearly zero-width track. */
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .management-layout { grid-template-areas:none; grid-template-rows:none; grid-auto-flow:row; grid-auto-rows:auto; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .management-layout > * { grid-area:auto; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.panel-head,.section-head) { flex-wrap:wrap; gap:6px; height:auto; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.panel-title,.section-head h2) { font-size:17px; line-height:1.5; white-space:normal; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.panel-subtitle,.section-head h2 small) { display:block; font-size:12px; line-height:1.6; margin:3px 0 0; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.chart-wrap,.table-scroll,.table-wrap) { min-width:0; max-width:100%; overflow-x:auto; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .chart-wrap:has(svg) { height:auto; padding-bottom:8px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .chart-wrap > svg { width:760px; min-width:760px; max-width:none; height:auto; display:block; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .chart-panel:has(svg)::after,
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .chart-body:has(svg)::after { content:'左右滑动查看完整图表 →'; display:block; font-size:12px; color:#687da4; padding:8px 4px 2px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.table-panel,.responsibility-section) > :is(.panel-head,.section-head)::after { content:'左右滑动查看全部列 →'; font-size:12px; color:#687da4; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .performance-table { min-width:1260px; font-size:13px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.legend,.chart-tools) { flex-wrap:wrap; white-space:normal; gap:8px 12px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.kpi-grid,.kpis) { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.kpi-card,.kpi) { grid-column:auto; min-width:0; min-height:180px; padding:13px 11px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .kpi-title { font-size:13px; line-height:1.5; white-space:normal; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .kpi-value { font-size:clamp(22px,5.7vw,32px); line-height:1.35; white-space:normal; overflow-wrap:anywhere; margin:10px 0; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .kpi-value em { font-size:13px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.kpi-row,.kpi-foot,.kpi-support,.progress-meta) { font-size:12px; flex-wrap:wrap; gap:4px; white-space:normal; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.kpi-row,.kpi-foot,.kpi-support,.progress-meta) strong { white-space:normal; overflow-wrap:anywhere; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .classification-values { grid-template-columns:1fr; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .time-line { display:flex; flex-wrap:wrap; gap:5px; font-size:12px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .time-line .mini-track { flex:1; min-width:35px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.dept-cards,.rank-groups) { grid-template-columns:minmax(0,1fr); }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .dept-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .dept-card { min-width:0; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .dept-card-head { flex-wrap:wrap; gap:8px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .audit-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) :is(.audit-item,.broadcast-text,.alert-body,.footer) { white-space:normal; overflow-wrap:anywhere; font-size:13px; line-height:1.7; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)):not(.is-exporting):not(.portrait-export) .footer { display:grid; gap:10px; padding-bottom:calc(70px + env(safe-area-inset-bottom)); }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) .date-box { display:flex; gap:12px; flex:1 0 100%; justify-content:space-between; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) .date-value { flex:1; width:auto; min-width:180px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) .periods { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); width:100%; gap:5px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) .period-btn { padding:5px 2px; min-width:0; font-size:13px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) .secondary-tools { display:flex; flex-wrap:wrap; width:100%; gap:8px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) .secondary-tools :is(a,button) { display:flex; align-items:center; justify-content:center; flex:1; white-space:normal; font-size:13px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) .secondary-tools .project-entry { display:none; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) :is(.compare-row,.compare-axis) { grid-template-columns:minmax(90px,1fr) minmax(80px,1.5fr) 48px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) .compare-panel .chart-wrap-tall { height:auto; min-height:0; flex:none; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) .compare-axis-scale > span:not(:first-child):not(:last-child) { display:none; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) .compare-reference { margin:8px 18px 0; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).dashboard-shell:not(.is-exporting):not(.portrait-export) .compare-name { white-space:normal; font-size:12px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) { padding:12px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .toolbar { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .toolbar > label { align-self:center; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .date-select { grid-column:span 3; width:100%; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .toolbar .mode { padding:6px 0; min-width:0; font-size:13px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) :is(.toolbar .primary,.secondary-actions,.custom-range) { grid-column:1/-1; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .secondary-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .secondary-actions > * { display:flex; align-items:center; justify-content:center; padding:4px; min-width:0; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .custom-range:not([hidden]) { display:grid; grid-template-columns:24px minmax(0,1fr); gap:8px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .custom-range[hidden] { display:none; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .custom-range input { width:100%; min-height:44px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .summary-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .summary-card { padding:13px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .summary-card .amount { font-size:24px; overflow-wrap:anywhere; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .mini-layers { grid-template-columns:1fr; gap:6px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .mini-layer { display:flex; flex-wrap:wrap; gap:4px 8px; align-items:center; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .mini-layer b { font-size:16px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .broadcast-copy-head { flex-wrap:wrap; gap:10px; }
  #captureArea:where(:has(#mgActual),:has(#kpi1Value)).shell:not(.is-exporting):not(.portrait-export) .broadcast-copy-text { font-size:14px; min-height:260px; }
  #rangeDialog { width:calc(100% - 24px); max-width:520px; max-height:calc(100dvh - 32px); padding:18px; overflow:auto; }
  #rangeDialog .range-grid { grid-template-columns:1fr; }
  #rangeDialog :is(button,input) { min-height:44px; }
  #rangeDialog input { font-size:16px; min-width:0; width:100%; }
  #costModal { padding:12px; }
  #costModal .modal-panel { width:100%; min-width:0; max-height:calc(100dvh - 24px); }
  #costModal :is(.modal-head,.modal-tools,.modal-foot) { padding:14px; }
  #costModal :is(button,.filter) { min-height:44px; }
  #costModal .modal-body { min-width:0; overflow:auto; }
  #costModal .detail-table { min-width:1050px; font-size:13px; }
}
@media screen and (max-width: 600px) {
  .portal-provider .portal-home-topbar { height:auto; min-height:64px; padding:12px max(14px,env(safe-area-inset-left)); gap:8px; flex-wrap:wrap; }
  .portal-provider .portal-brand { gap:8px; }
  .portal-provider .portal-brand strong { font-size:17px; }
  .portal-provider .portal-brand small { font-size:11px; }
  .portal-provider .portal-brand-mark { width:36px; height:36px; }
  .portal-provider .portal-user-actions { gap:4px; }
  .portal-provider .portal-avatar { display:none; }
  .portal-provider .portal-user-actions button { min-height:44px; padding:4px 8px; min-width:44px; }
  .portal-provider .portal-home { padding:18px 14px calc(24px + env(safe-area-inset-bottom)); }
  .portal-provider .portal-hero { min-height:0; margin-bottom:18px; padding:0; }
  .portal-provider .portal-home-heading h1 { font-size:28px; line-height:1.35; letter-spacing:-.5px; margin:6px 0; }
  .portal-provider .portal-home-heading h1 span { display:inline; margin-right:8px; }
  .portal-provider .portal-home-heading p { font-size:12px; line-height:1.7; margin:8px 0 0; }
  .portal-provider .portal-status-strip { grid-template-columns:repeat(2,minmax(0,1fr)); gap:0; padding:6px; margin-bottom:16px; }
  .portal-provider .portal-status-item { min-width:0; padding:9px 6px; gap:7px; border:0; }
  .portal-provider .portal-status-item strong { font-size:12px; overflow-wrap:anywhere; white-space:normal; }
  .portal-provider .portal-status-icon { width:28px; height:28px; flex:0 0 28px; }
  .portal-provider .portal-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .portal-provider .portal-card { min-height:142px; padding:15px 12px; display:flex; flex-direction:column; align-items:flex-start; gap:10px; }
  .portal-provider .portal-card-icon { width:34px; height:34px; }
  .portal-provider .portal-card-copy { min-width:0; }
  .portal-provider .portal-card-copy strong { font-size:15px; line-height:1.4; }
  .portal-provider .portal-card-copy small { font-size:12px; line-height:1.6; margin-top:5px; }
  .portal-provider .portal-card-arrow { position:absolute; top:18px; right:12px; }
  .portal-provider .portal-overview { padding:16px 12px; margin-top:18px; }
  .portal-provider .portal-overview-heading { flex-wrap:wrap; align-items:flex-start; gap:12px; }
  .portal-provider .portal-overview-title-group > small { line-height:1.7; }
  .portal-provider .portal-overview-period button { min-width:56px; min-height:44px; }
  .portal-provider .portal-overview-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .portal-provider .portal-overview-metric { padding:10px 0; min-width:0; }
  .portal-provider .portal-overview-metric strong { font-size:clamp(17px,4.5vw,22px); white-space:normal; overflow-wrap:anywhere; }
}
