#mobile-screen {display:none}
@media (max-width:900px) {
  :root {background:#f1f5f7;color:#172e3e}
  body {margin:0}
  .toolbar {position:relative;height:auto;min-height:60px;background:#172e3e;color:white;flex-wrap:nowrap;gap:6px;padding:8px max(12px,calc((100vw - 720px)/2));border:0}
  .toolbar nav {gap:6px;min-width:0;flex:1}
  .toolbar .tools {width:auto;flex:none}
  .toolbar button {min-height:44px;font-size:.875rem;padding:7px 8px;white-space:normal;text-align:left}
  .toolbar .brand {padding-left:0;font-size:1rem}
  .toolbar #back,.toolbar #help {background:transparent;color:#eef4f9;border-color:#4b6271}
  #hint,#zoom,#viewport,#screen-label,#saved-state {display:none}
  #mobile-screen {display:grid;grid-template-columns:minmax(0,1fr);gap:14px;max-width:736px;margin:0 auto;padding:22px 14px 24px;line-height:1.45;overflow-wrap:anywhere}
  #mobile-screen .m-title {font-size:clamp(1.7rem,5.8vw,2.3rem);line-height:1.12;letter-spacing:-.03em;margin:0}
  #mobile-screen .m-context,.m-subtitle,.m-panel p,.m-chart figcaption {color:#4f6574}
  #mobile-screen .m-context {font-size:.875rem;font-weight:600;margin-bottom:-7px}
  .m-subtitle,.m-summary,.m-panel p {margin:0}
  .m-subtitle {margin-top:-5px}
  .m-summary {border-left:4px solid #366fe2;border-radius:0 9px 9px 0;background:#e5edf9;padding:12px 14px}
  .m-filters,.m-stages,.m-end-actions {display:flex;flex-wrap:wrap;gap:8px}
  .m-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .m-stat,.m-panel {border:1px solid #d9e3e9;background:white;border-radius:12px}
  .m-stat {display:flex;align-items:flex-start;flex-direction:column;gap:5px;padding:14px 12px;text-align:left;text-decoration:none;font:inherit}
  .m-stat strong,.m-result strong {font-size:2rem;line-height:1.1;letter-spacing:-.04em}
  .m-stat b {line-height:1.22;font-size:1rem;color:#172e3e}
  .m-stat small,.m-rowlink small,.m-target small,.m-chart figcaption {font-size:.84rem;line-height:1.35;color:#506676}
  .m-stat small {margin-top:auto;padding-top:6px}
  .red {color:#bf4738}.amber {color:#996109}.green {color:#087558}.blue,.m-result strong {color:#275cc5}
  .m-panel {padding:16px;display:grid;grid-template-columns:minmax(0,1fr);gap:12px}
  .m-panel h2,.m-panel h3 {margin:0;line-height:1.25}
  .m-panel h2 {font-size:1.2rem}.m-panel h3 {font-size:1.04rem}
  .m-rowlink {display:grid;gap:2px;min-height:44px;position:relative;padding:9px 22px 9px 0;text-decoration:none;color:#2156ba;font-weight:600;border-bottom:1px solid #e4ebef}
  .m-rowlink:last-child {border-bottom:0}
  .m-rowlink::after {content:'';position:absolute;right:4px;top:calc(50% - 4px);width:7px;height:7px;border:solid #536e85;border-width:2px 2px 0 0;transform:rotate(45deg)}
  .m-rowlink b {color:#172e3e}.m-rowlink span {font-weight:400;color:#4f6574}
  .m-btn {display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:10px 13px;font:inherit;font-size:.9375rem;font-weight:600;text-align:center;line-height:1.3;background:#f4f7fb;border:1px solid #c9d8e6;border-radius:8px;color:#295779;text-decoration:none}
  .m-primary,.m-btn.m-primary:hover {background:#295fc6;border-color:#295fc6;color:white}
  .m-active {background:#e6eeff;color:#1f50b4;border-color:#85a6e8}
  .m-end-actions {display:grid}.m-checks {display:grid;gap:8px}.m-checks .m-btn {justify-content:flex-start;text-align:left}
  .m-rows {display:grid;gap:0;margin:0}.m-rows div,.m-target {padding:10px 0;border-bottom:1px solid #e2e9ee}
  .m-rows div:first-child,.m-target:first-child {padding-top:0}
  .m-rows div:last-child {border-bottom:0;padding-bottom:0}
  .m-rows dt,.m-target b {font-weight:600}.m-rows dd {margin:3px 0 0;color:#4f6574}
  .m-target {display:grid;gap:4px}.m-target span {font-size:.94rem}
  .m-profile-stats {display:grid;gap:3px}.m-profile-stats div {display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid #e2e9ee;padding:7px 0}
  .m-profile-stats strong {font-size:1.6rem;font-variant-numeric:tabular-nums}
  .m-chart {margin:0}.m-chart img {display:block;width:100%;height:auto}.m-chart figcaption {margin-top:6px}
  .viewer-footer {height:auto;padding:6px 14px 18px;max-width:736px;margin:auto;justify-content:space-between;gap:10px}
  .viewer-footer span {font-size:.78rem;max-width:70%}.viewer-footer button {min-height:44px;font-size:.84rem}
  dialog {width:min(94vw,600px);max-width:94vw;max-height:90dvh;padding:16px;overflow-wrap:anywhere}
  dialog h2 {font-size:1.35rem}dialog button,dialog select,dialog input {min-height:44px}
  .dialog-head button {width:44px;height:44px}.form-actions {flex-wrap:wrap}.form-actions button {flex:1 1 140px}
  dialog td,dialog th {padding:9px 4px;vertical-align:top}
  dialog input,dialog select,dialog textarea {min-width:0;max-width:100%;font-size:16px}
  #toast {width:max-content;max-width:calc(100vw - 24px);bottom:max(14px,env(safe-area-inset-bottom));pointer-events:none}
}
