/* Lock the background while keeping the dialog's own scroll container available. */
body.ng-modal-open { overflow:hidden; }
/* Layout overrides are mobile-only. Desktop business tables stay unchanged. */
@media (max-width:760px) {
  .shell,.login { min-height:100vh; min-height:100dvh; }
  main {
    padding-left:max(10px,env(safe-area-inset-left));
    padding-right:max(10px,env(safe-area-inset-right));
    /* Leave the final record reachable above the install helper. */
    padding-bottom:calc(90px + env(safe-area-inset-bottom));
  }
  main>header { padding-top:max(12px,env(safe-area-inset-top)); }
  aside#sidebar {
    padding-top:max(18px,env(safe-area-inset-top));
    padding-bottom:max(18px,env(safe-area-inset-bottom));
    padding-left:max(14px,env(safe-area-inset-left));
    max-height:100vh; max-height:100dvh;
  }
  button,.nav,.tab,.check { min-height:44px; }
  .menu-toggle,.nav-close,.dhead>button { min-width:44px; }
  .nav,.tab { display:flex; align-items:center; }
  input:not([type=checkbox]):not([type=radio]),select,textarea {
    min-width:0; max-width:100%; width:100%; min-height:44px; font-size:16px;
  }
  input[type=checkbox],input[type=radio] { flex-shrink:0; }
  label,.formgrid>* { min-width:0; overflow-wrap:anywhere; }
  .formgrid,.formgrid.three,.review-grid { grid-template-columns:minmax(0,1fr); }
  .toolbar { position:static; }
  .toolbar>select { flex:1 1 150px; width:auto; }
  .toolbar>button { max-width:100%; white-space:normal; }
  .toolbar .secondary { margin-left:0; }
  .actions { flex-wrap:wrap; }
  .actions>button { flex:1 1 110px; }
  .inline-actions,.head-actions { min-width:0; }
  .head-actions .chip { max-width:100%; white-space:normal; overflow-wrap:anywhere; }
  .file-actions a,.link[onclick],table.ng-mobile-table a[href] {
    display:inline-flex; align-items:center; min-height:44px; max-width:100%; overflow-wrap:anywhere;
  }
  .file-actions { align-items:stretch; gap:8px; }
  .learning-file-row { display:flex; flex-direction:column; align-items:stretch; gap:8px; min-width:0; }
  .learning-file-row>* { min-width:0; max-width:100%; overflow-wrap:anywhere; }
  .learning-file-row .file-actions { justify-content:flex-start; }
  .kpi strong,.metric b,.policy b { overflow-wrap:anywhere; }
  .status-strip,.status-strip.technical-status { grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); }
  .barrow { grid-template-columns:minmax(60px,.9fr) minmax(40px,1fr) minmax(70px,.8fr); }
  .barrow>* { min-width:0; overflow-wrap:anywhere; }
  .modal {
    top:var(--nova-mobile-visible-top,0px); bottom:auto;
    height:100vh; height:var(--nova-mobile-visible-height,100dvh);
    padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
    overflow-y:auto; overscroll-behavior:contain;
  }
  .dialog,.dialog.large {
    min-width:0; width:100%;
    max-height:calc(100vh - 16px);
    max-height:calc(var(--nova-mobile-visible-height,100dvh) - max(8px,env(safe-area-inset-top)) - max(8px,env(safe-area-inset-bottom)));
    overflow-y:auto; overscroll-behavior:contain; scroll-padding-block:72px 20px;
  }
  .dhead { gap:8px; align-items:flex-start; }
  .dhead h3 { min-width:0; overflow-wrap:anywhere; }
  .dhead>button { flex:0 0 44px; }
  .dialog input,.dialog select,.dialog textarea { scroll-margin-block:72px 20px; }
  .toast { bottom:max(10px,env(safe-area-inset-bottom)); }

  /* Keep original <table>/<th>/<td> nodes, associations and handlers. No field is omitted. */
  table.ng-mobile-table { display:block; width:100%; min-width:0; border-collapse:separate; }
  table.ng-mobile-table>tbody,table.ng-mobile-table>thead { display:block; }
  table.ng-mobile-table .ng-mobile-header {
    position:absolute; width:1px; height:1px; padding:0; margin:-1px;
    overflow:hidden; clip:rect(0,0,0,0); clip-path:inset(50%); white-space:nowrap;
  }
  table.ng-mobile-table .ng-mobile-record {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 12px;
    margin:10px; padding:4px 12px; border:1px solid var(--line); border-radius:10px; background:var(--card);
  }
  table.ng-mobile-table .ng-mobile-record>td {
    display:block; min-width:0; padding:9px 0; border-bottom:1px solid #edf0f3;
    white-space:normal; overflow-wrap:anywhere; text-align:left;
  }
  table.ng-mobile-table .ng-mobile-record>td::before {
    content:attr(data-mobile-label);
    /* An empty speech alternative prevents duplicate labels in supporting accessibility engines. */
    content:attr(data-mobile-label) / "";
    display:block; margin-bottom:3px; color:var(--muted); font-size:12px; font-weight:400;
  }
  table.ng-mobile-table .ng-mobile-record>td:first-child,
  table.ng-mobile-table .ng-mobile-record>td.ng-mobile-actions,
  table.ng-mobile-table .ng-mobile-record>td[data-mobile-label="说明"],
  table.ng-mobile-table .ng-mobile-record>td[data-mobile-label="描述"],
  table.ng-mobile-table .ng-mobile-record>td[data-mobile-label="下一步"] { grid-column:1/-1; }
  table.ng-mobile-table .ng-mobile-record>td:first-child { font-weight:600; }
  table.ng-mobile-table .ng-mobile-record>td:last-child { border-bottom:0; }
  table.ng-mobile-table .ng-mobile-record>td>button { margin:3px 3px 3px 0; max-width:100%; white-space:normal; }
  table.ng-mobile-table .ng-mobile-record>td>small { display:block; }
  table.ng-mobile-table .ng-mobile-empty { display:block; }
  table.ng-mobile-table .ng-mobile-empty>td { display:block; width:100%; white-space:normal; }
  table.ng-mobile-table[hidden],table.ng-mobile-table [hidden] { display:none!important; }
  table.ng-mobile-table .tree-name { max-width:100%; white-space:normal; }
  table.ng-mobile-table .tree-level { flex-shrink:1; max-width:35%; }
}
@media (max-width:359px) {
  table.ng-mobile-table .ng-mobile-record { grid-template-columns:minmax(0,1fr); }
}
