/* Mobile composition only. Desktop instruments, themes and animation stay intact. */
@media (max-width:899px) {
  .topbar { gap:10px; padding-inline:12px; }
  .topbar .top-left { flex:1; min-width:0; }
  .topbar .top-actions { gap:8px; flex-shrink:0; }
  .topbar .user-chip { display:flex; min-width:0; height:44px; padding:0; gap:0; border:0; background:transparent; }
  .topbar .profile-photo-trigger { width:44px; height:44px; flex:0 0 44px; }
  .topbar .user-meta { display:none; }
  .topbar .page-title { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:17px; }
  .topbar .icon-btn { width:40px; height:40px; min-width:40px; }
  .mobile-nav { min-height:60px; padding-top:4px; padding-bottom:calc(4px + env(safe-area-inset-bottom)); backdrop-filter:none; }
  .mobile-nav button { min-height:52px; }
  .fab { width:44px; height:44px; right:12px; bottom:calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width:760px) {
  html[data-font] { --ui-body:14px; --ui-label:13px; --ui-meta:12px; }
  html[data-font="large"] { --ui-body:16px; --ui-label:15px; --ui-meta:13px; }
  .content { padding:12px 12px calc(104px + env(safe-area-inset-bottom)); }
  .content > * { min-width:0; }
  .page-toolbar { gap:10px; margin-bottom:14px; align-items:stretch; }
  html[data-font] .content :is(.page-intro h2,.settings-category-head h2) { font-size:calc(var(--ui-body) + 5px); }
  html[data-font] :is(.content,.modal) :is(.panel-sub,.page-intro p,.div-sub,.indicator-meta,.pick-card span,.hub-hint,.timeline-text,.settings-row span,.field label,.check-status,.process-owners,.issue-line,.report-card p,.conference-started) { line-height:1.4; }
  .page-intro p { margin-top:5px; }
  html[data-palette] .content :is(.panel-head,.panel-body,.settings-content-head) { padding:14px; }
  .dashboard-grid,.chart-grid,.list-stack,.indicator-grid,.report-grid { gap:12px; }
  .dashboard-grid > .panel,.instrument-zone { min-height:0; }
  html[data-palette] .content :is(.panel,.indicator-card,.div-card,.report-card) { border-radius:16px; }
  html[data-palette] .content :is(.div-card,.indicator-card,.report-card) { padding:16px; gap:12px; }
  .filters-shell { margin-bottom:14px; }
  .filters,.conference-record-filters,.history-filters,.action-filters,.form-grid { gap:10px; margin-bottom:14px; }
  html[data-palette] :is(.content,.modal) .btn { min-height:44px; padding:9px 12px; gap:7px; }
  html[data-palette] :is(.content,.modal) .btn-sm { min-height:44px; padding:8px 10px; }
  /* Keep inputs at 16px to avoid zooming on iOS when editing. */
  html[data-palette] :is(.content,.modal) :is(.input,.select,.textarea,.filter-input,.calendar-trigger) { min-height:44px; padding:9px 10px; }

  /* Three equally sized instruments on one row, with health in the centre. */
  html[data-palette] .tech-instruments { padding:14px 8px 16px; }
  .tech-instruments-head { padding:0 6px; }
  .tech-instruments-head h2 { font-size:18px; }
  .tech-instruments-head p { font-size:12px; line-height:1.4; margin-top:5px; }
  .tech-instruments-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; align-items:start; margin-top:12px; }
  html[data-palette] .tech-gauge { display:grid; grid-template-rows:auto 32px auto auto; align-content:start; justify-items:center; width:100%; max-width:none; min-width:0; }
  html[data-palette] .tech-gauge-main { grid-column:auto; grid-row:auto; max-width:none; }
  html[data-palette] .tech-dial { width:100%; filter:none; }
  html[data-palette] .tech-gauge > :is(svg,h3,p,.badge) { grid-row:auto; }
  html[data-palette] .tech-gauge h3 { margin:6px 0 0; font-size:11px; line-height:1.3; letter-spacing:.025em; align-self:start; }
  html[data-font][data-palette] .instrument-zone .tech-gauge p { margin:3px 0 0; font-size:12px!important; line-height:1.35; min-height:49px; width:100%; overflow-wrap:normal; }
  .tech-gauge .gauge-target-caption { display:none; } /* Target is already in panel heading and SVG. */
  html[data-palette] .tech-gauge .badge { margin-top:7px; max-width:100%; box-sizing:border-box; white-space:normal; padding:4px 5px; font-size:11px; line-height:1.3; }
  .tech-gauge .tech-readout-number { font-size:50px; }
  .tech-gauge .tech-readout-number tspan { font-size:26px; }

  /* Cards grow with their own content rather than the tallest desktop card. */
  .process-grid,.conference-card-grid,.process-picker { grid-template-columns:minmax(0,1fr); grid-auto-rows:auto; align-items:start; gap:12px; }
  html[data-palette] .process-grid .process-card { height:auto; min-height:0; padding:16px; border-radius:16px; }
  html[data-palette] .process-grid .process-card::before { inset:6px; border-radius:12px; }
  html[data-palette] .process-grid .process-card::after { background-size:32px 110px; opacity:.1; }
  .process-grid .process-card-head { min-height:0; gap:8px; margin-bottom:10px; }
  html[data-palette] .process-grid .process-symbol { width:36px; height:36px; flex:0 0 36px; }
  .process-symbol .icon { width:19px; height:19px; }
  .process-score { margin-top:8px; font-size:30px; }
  .process-grid .score-unrated { font-size:20px; line-height:1.4; }
  .process-grid .issue-list { flex:none; min-height:0; margin:10px 0; gap:6px; }
  .process-grid .process-owners { min-height:0; padding-top:10px; margin-top:4px; }
  .process-grid .process-footer { min-height:0; margin-top:8px; flex-direction:row; align-items:center; gap:6px 10px; }
  .process-footer .last-check { flex:1 1 140px; }
  .process-footer .link-btn { min-height:44px; }
  .process-grid .health-bar { margin-block:10px; }
  html[data-palette] .conference-module { height:auto; min-height:0; padding:16px; gap:10px; }
  .conference-module-head { gap:10px; }
  html[data-palette] .conference-metal-icon { width:36px; height:36px; flex:0 0 36px; }
  .conference-metal-icon .icon { width:19px; height:19px; }
  .conference-module-facts { grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:10px; }
  .conference-module-facts dt { margin-bottom:2px; }
  .conference-module-facts dd { font-size:14px; line-height:1.4; }
  .conference-deadline { padding:10px 12px; display:grid; grid-template-columns:auto 1fr; gap:4px 10px; align-items:center; }
  .conference-deadline .conference-fact-label { margin:0; }
  .conference-deadline strong { justify-self:end; }
  .conference-deadline-note { grid-column:1/-1; margin:0; }
  .conference-module-progress { gap:6px; }
  html[data-palette] .conference-module .conference-card-actions { padding-top:10px; margin-top:0; gap:8px; }
  html[data-palette] .conference-module .conference-card-actions .btn { flex:1 1 120px; min-height:44px; }
  .conference-summary { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  html[data-palette] .conference-summary .conference-stat { padding:12px 42px 12px 12px; min-height:82px; gap:4px; }
  html[data-palette] .conference-summary .conference-stat > strong { font-size:25px; }
  html[data-palette] .conference-summary .conference-stat > span { font-size:12px; max-width:none; }
  html[data-palette] .conference-summary .conference-stat-icon { top:12px; right:10px; width:26px; height:26px; }
  .conference-summary .conference-stat-icon svg { width:16px; height:16px; }

  .process-overview-panel .panel-body { gap:10px; }
  .process-overview-summary { gap:10px; padding-bottom:10px; }
  .process-overview-summary strong { font-size:25px; }
  .process-overview-summary > div + div { padding-left:10px; }
  .process-overview-list { gap:10px; }
  .process-overview-row { gap:5px; padding-bottom:10px; }
  .process-overview-flags { gap:4px; }
  .process-overview-alert { padding:9px 10px; gap:6px; }
  html[data-palette] .content .div-card { align-items:stretch; }
  .div-meta { margin-top:8px; gap:6px; }
  .div-actions { display:flex; flex-wrap:wrap; gap:8px; }
  .div-actions .btn { flex:1 1 auto; justify-content:center; }
  .btn[data-wa] > svg.icon { width:20px; height:20px; min-width:20px; flex:0 0 20px; }
  .indicator-facts { gap:10px; margin:12px 0; }
  .kpi-strip,.hub-summary,.problem-summary { gap:10px; }
  .kpi-card,.hub-stat,.summary-card { min-height:0; padding:12px; }
  .attention-grid { gap:10px; }
  .settings-menu { margin-bottom:14px; padding-bottom:10px; gap:6px; }
  .settings-menu-item { min-height:44px; padding:8px 10px; }
  html[data-palette] .settings-user-row,html[data-palette] .settings-contact-row,.settings-option-row,.settings-overview { padding:14px; gap:10px; }
  .settings-overview { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .settings-overview strong { font-size:20px; }
  .check-item { padding:14px; }
  .check-actions { flex-direction:row; flex-wrap:wrap; gap:8px; }
  .check-actions .btn { flex:1 1 120px; }
  html[data-palette] :is(.modal-head,.modal-body),html[data-palette] .settings-user-modal :is(.modal-head,.modal-body) { padding:16px; }
  html[data-palette] .modal-footer,html[data-palette] .settings-user-modal .modal-footer { padding:12px 16px; gap:8px; }
  .modal-footer { display:flex; flex-wrap:wrap; }
  .modal-footer .btn { width:auto; flex:1 1 120px; }
  .empty-state { padding:24px 16px; }
}
@media (max-width:360px) {
  .content { padding-inline:10px; }
  html[data-palette] .tech-instruments { padding-inline:6px; }
  .tech-instruments-grid { gap:2px; }
  html[data-palette] .tech-gauge h3 { font-size:10px; }
  html[data-font][data-palette] .instrument-zone .tech-gauge p { font-size:11px!important; min-height:45px; }
  html[data-palette] .tech-gauge .badge { font-size:10px; }
  .div-actions { gap:6px; }
}

/* Keep scrolling form controls below the fixed dialog heading. */
@media (max-width:760px) {
  html[data-palette] .modal { box-sizing:border-box; max-height:90vh; max-height:90dvh; overscroll-behavior:contain; scroll-padding-top:112px; }
  html[data-palette] .modal-head { z-index:10; isolation:isolate; background:var(--surface); backdrop-filter:none; gap:10px; }
  .modal-head > div { flex:1; min-width:0; }
  .modal-head h3 { font-size:18px; }
  .modal-head p { font-size:13px; line-height:1.4; }
  .modal-head .close-btn { width:44px; height:44px; flex:0 0 44px; }
  .modal > form { position:relative; z-index:0; isolation:isolate; }
  .modal .modal-body { position:relative; z-index:0; isolation:isolate; }
  .modal .evidence-input { isolation:isolate; padding:12px; }
  .modal .evidence-actions { gap:8px; }
  .modal .evidence-actions .btn { flex:1 1 120px; min-width:0; justify-content:center; }
  .modal .severity-segments { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .modal .severity-segments button { min-height:44px; padding:8px; }
  .modal .form-section { padding-top:12px; }
  .modal .dynamic-fields { padding:12px; }

  .settings-category-head { margin-bottom:12px; }
  .settings-workspace > .page-toolbar .page-intro h2 { display:none; }
  .settings-workspace > .page-toolbar .page-intro p { margin:0; }
}
@media (max-width:360px) {
  html[data-palette] .content .settings-menu-item { flex-direction:column; gap:3px; }
}

/* Recovery notice stays outside scrolling dialogs and never obscures controls. */
body.dialog-open { overflow:hidden; }
.storage-warning { position:relative; z-index:101; display:flex; flex-wrap:wrap; gap:10px; align-items:center; padding:12px 16px; background:#632820; color:#fff; font:14px/1.5 sans-serif; }
.storage-warning span { flex:1 1 240px; }
.storage-warning .btn { color:#fff; border:1px solid #fff; min-height:44px; }
@media(max-width:760px) {
  .modal-backdrop { padding-top:env(safe-area-inset-top); padding-bottom:env(safe-area-inset-bottom); }
  .modal { width:100%; max-width:100%; }
  .modal :is(.field,.form-grid,.detail-data-row,.settings-person) { min-width:0; }
  .modal :is(.input,.select,.textarea) { width:100%; max-width:100%; box-sizing:border-box; font-size:16px; }
  .modal :is(strong,p,label,.detail-data-row span) { overflow-wrap:anywhere; }
  .settings-option-row { flex-wrap:wrap; }
  .settings-option-row > div { min-width:0; flex:1 1 200px; }
  .settings-option-row > .btn { max-width:100%; }
}

.expected-step-text { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.5; padding:10px 12px; border:1px solid var(--border); border-radius:10px; background:var(--surface-soft); }
.expected-step > small { display:block; margin-bottom:6px; }
.expected-step details { margin-top:8px; }
