/* R6.11.45 — 移动端 / 微信 WebView / 安全区与高频宽表收口 */
:root{
  --cy-safe-top: env(safe-area-inset-top, 0px);
  --cy-safe-right: env(safe-area-inset-right, 0px);
  --cy-safe-bottom: env(safe-area-inset-bottom, 0px);
  --cy-safe-left: env(safe-area-inset-left, 0px);
  --cy-viewport-height: 100dvh;
  --cy-keyboard-offset: 0px;
}
html{min-height:100%;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{min-height:var(--cy-viewport-height,100dvh)}
main{min-width:0;padding-bottom:calc(24px + var(--cy-safe-bottom))}
.site-sidebar{padding-left:var(--cy-safe-left)}
.back-to-top{bottom:calc(18px + var(--cy-safe-bottom))}
.table-wrap,.salary-sheet-wrap{
  min-width:0;
  max-width:100%;
  overflow-x:auto;
  overflow-y:visible;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-x:contain;
  scrollbar-gutter:stable;
}
.cy-select-modal{
  max-height:min(82dvh,calc(var(--cy-viewport-height,100dvh) - var(--cy-safe-top) - var(--cy-safe-bottom) - 32px));
  margin-top:var(--cy-safe-top);
  margin-bottom:calc(var(--cy-safe-bottom) + var(--cy-keyboard-offset));
  overscroll-behavior:contain;
}
.cy-select-options{overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.employee-mobile-nav{padding-bottom:var(--cy-safe-bottom)}
.table-x-scroll-dock{bottom:var(--cy-safe-bottom)}
.invoice-camera-label{display:none}

@media (pointer:coarse),(max-width:1024px){
  .invoice-camera-label{display:flex}
}

@media (max-width:720px){
  body{overflow-x:hidden}
  main{padding-left:max(12px,var(--cy-safe-left));padding-right:max(12px,var(--cy-safe-right))}
  .mobile-menu-panel{padding-bottom:calc(16px + var(--cy-safe-bottom))}

  button,.btn,input:not([type="checkbox"]):not([type="radio"]),select,textarea,.cy-select-button,.file-chip,summary{
    min-height:44px;
  }
  input[type="checkbox"],input[type="radio"]{min-width:20px;min-height:20px}
  .btn.small{min-height:40px;padding-top:8px;padding-bottom:8px}
  .table-row-actions,.actions,.inline-form{gap:8px}

  /* 高频数据表在窄屏转为卡片；未标记的专业宽表仍保持横向滚动。 */
  .mobile-card-table{overflow:visible;border:0;background:transparent;box-shadow:none}
  .mobile-card-table table,.mobile-card-table tbody,.mobile-card-table tr,.mobile-card-table td{display:block;width:100%}
  .mobile-card-table thead{
    position:absolute!important;
    width:1px!important;height:1px!important;
    padding:0!important;margin:-1px!important;
    overflow:hidden!important;clip:rect(0,0,0,0)!important;
    white-space:nowrap!important;border:0!important;
  }
  .mobile-card-table tbody{display:grid;gap:12px}
  .mobile-card-table tbody tr{
    border:1px solid var(--border,#dfe7e2);
    border-radius:14px;
    background:var(--card,#fff);
    padding:8px 12px;
    box-shadow:0 4px 14px rgba(20,52,42,.04);
  }
  .mobile-card-table tbody td{
    display:grid;
    grid-template-columns:minmax(82px,30%) minmax(0,1fr);
    gap:10px;
    align-items:start;
    padding:9px 0!important;
    border:0!important;
    border-bottom:1px solid rgba(28,79,62,.08)!important;
    white-space:normal!important;
    overflow-wrap:anywhere;
  }
  .mobile-card-table tbody td:last-child{border-bottom:0!important}
  .mobile-card-table tbody td::before{
    content:attr(data-label);
    color:var(--muted,#667a72);
    font-size:12px;
    font-weight:600;
    line-height:1.5;
  }
  .mobile-card-table .table-cell-actions .table-row-actions{display:flex;flex-wrap:wrap;justify-content:flex-start}
  .mobile-card-table .table-empty-row{padding:14px}
  .mobile-card-table .table-empty-row td{display:block;text-align:center;border:0!important}
  .mobile-card-table .table-empty-row td::before{display:none}

  .invoice-file-row{align-items:stretch}
  .invoice-camera-label,.invoice-upload-label{width:100%}
  .reimbursement-hard-delete form{min-width:0}
}

@media (orientation:landscape) and (max-height:500px){
  .cy-select-modal{max-height:calc(var(--cy-viewport-height,100dvh) - 12px - var(--cy-safe-top) - var(--cy-safe-bottom));margin-top:6px;margin-bottom:6px}
}
