/* FE-17：手机触控、安全区、紧凑登录和业务列表；在品牌样式之后加载。 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.sidebar { overflow-y: auto; }
@media (max-width: 768px), (max-width: 1050px) and (max-height: 500px) {
  body .workspace { display: block; }
  body .sidebar { position: static; width: 100%; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
  body .sidebar .brand { flex-direction: row; align-items: center; gap: 18px; }
  body .sidebar .brand img { width: 96px; padding: 8px; }
  body .sidebar .brand span { font-size: 12px; }
  body .workspace-label, body .sidebar-bottom { display: none; }
  body nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 12px; overflow: visible; }
  body nav a { min-height: 44px; justify-content: center; padding: 8px 2px; font-size: 12px; white-space: normal; text-align: center; }
  body nav .nav-icon { display: none; }
  body .main { margin-left: 0; }
  body .topbar { height: auto; min-height: 64px; padding: 8px 16px; }
  body .topbar > span { display: none; }
  body .user-menu { width: 100%; justify-content: flex-end; gap: 8px; }
  body .user-menu > span:nth-child(2) { margin-right: auto; }
  body .content { padding: 24px 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  body .today { display: none; }
  body .page-heading h1 { font-size: 25px; }
  body .page-heading p { font-size: 13px; }
  body .two-col, body .form-grid { grid-template-columns: minmax(0, 1fr); }
  body .panel { padding: 18px; }
  body .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  body .metrics article { padding: 16px; }
  body .welcome-card { padding: 22px; }
  body .welcome-card h2 { font-size: 21px; }
  body .target-art { display: none; }
  body .toolbar, body .form-footer { flex-direction: column; align-items: stretch; }
  body .toolbar > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
  body .section-head { flex-wrap: wrap; }
  body button, body .button, body summary { min-height: 44px; }
  body button, body .button { touch-action: manipulation; }
  body input, body textarea, body select { font-size: 16px; min-height: 44px; max-width: 100%; }
  body textarea { line-height: 1.7; }
  body label { font-size: 13px; }
  body summary { display: flex; align-items: center; padding: 8px 0; }
  body summary::before { content: '›'; margin-right: 8px; }
  body details[open] > summary::before { content: '⌄'; }
  body .form-footer .primary { width: 100%; }
  body .binding-row { flex-wrap: wrap; gap: 12px; }
  body .binding-row > div { min-width: 0; width: 100%; }
  body .binding-row input { flex-basis: 100%; }
  body .kr-row { flex-wrap: wrap; gap: 12px; }
  body .kr-main { min-width: 0; }
  body .kr-value { width: 100%; flex-direction: row; justify-content: flex-end; align-items: center; }
  body .panel, body .record, body .notice, body .kr-main { overflow-wrap: anywhere; }
  body .login { display: block; min-height: 100vh; min-height: 100dvh; }
  body .login-story { padding: 18px 24px; padding-top: max(18px, env(safe-area-inset-top)); }
  body .login-story .brand { flex-direction: row; align-items: center; gap: 16px; margin-bottom: 18px; }
  body .login-story .brand img { width: 116px; padding: 10px; }
  body .login-story .brand span { font-size: 9px; max-width: 120px; letter-spacing: 1.4px; }
  body .login-story h1 { font-size: 22px; line-height: 1.5; margin: 0; }
  body .login-story h1 br { display: none; }
  body .login-story h1::before, body .login-story > p, body .login-bottom { display: none; }
  body .login-form { margin: auto; padding: 26px 24px; padding-bottom: max(26px, env(safe-area-inset-bottom)); }
  body .login-form h2 { font-size: 24px; }
  body .login-form form { margin-top: 24px; }
  body dialog { width: calc(100% - 20px); max-width: 620px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); margin: auto; }
  body .modal-head { padding: 12px 16px; gap: 8px; }
  body .modal-head h2 { font-size: 17px; overflow-wrap: anywhere; }
  body .modal-head .close { flex-shrink: 0; min-width: 44px; }
  body .modal-body { padding: 18px; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  body #toast { bottom: max(16px, env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 32px); }
  body footer { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  body .setup-steps { grid-template-columns: 1fr; }
  body .setup-steps article { border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
  body .key-input-row { flex-direction: column; }

  /* 周报与任务主列表变为卡片；Excel预览表仍独立横向滚动。 */
  body .mobile-records { padding: 0; border: 0; background: transparent; overflow: visible; }
  .mobile-records table, .mobile-records tbody { display: block; width: 100%; }
  .mobile-records thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .mobile-records tr { display: block; border: 1px solid var(--line); border-radius: 10px; background: white; padding: 12px 16px; margin-bottom: 12px; }
  .mobile-records td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; padding: 10px 0; border: 0; max-width: none; overflow-wrap: anywhere; }
  .mobile-records td::before { content: attr(data-label); font-size: 12px; color: var(--muted); }
  .mobile-records td > small { grid-column: 2; }
  .mobile-records td .badge { justify-self: start; }
  .mobile-records td .badge + .badge { grid-column: 2; }
  .mobile-records td:last-child { display: block; border-top: 1px solid var(--line); }
  .mobile-records td:last-child::before { display: none; }
  .mobile-records td:last-child button { width: 100%; background: #eef1f7; color: var(--brand-blue-2); }
  body .table-scroll { max-width: 100%; overscroll-behavior-x: contain; }
  body .table-scroll th, body .table-scroll td { padding: 12px; }
}
