/* ==========================================================================
   供应商台账 · 响应式与打印
   断点：≥1440 宽屏 / 1280-1439 / 1024-1279 平板横 / 768-1023 平板竖 / <768 手机
   ========================================================================== */

/* ---------- ≤1439：基本信息栅格收敛 ---------- */
@media (max-width: 1439px) {
  .desc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- ≤1279：平板横屏 ---------- */
@media (max-width: 1279px) {
  .container { padding: 0 12px; }
  .drawer { width: 62%; min-width: 360px; }
  .desc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .amt-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- ≤1023：平板竖屏 ---------- */
@media (max-width: 1023px) {
  .head-right .btn-label { display: none; }
  .head-right .btn { padding: 0 8px; }
  .drawer { width: 78%; min-width: 0; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .d-grid, .d-grid.cols-3 { grid-template-columns: 1fr; }
  .search-box { flex: 0 0 200px; }
}

/* ---------- ≤767：手机 ---------- */
@media (max-width: 767px) {
  body { font-size: 12.5px; }

  .container { padding: 0 10px; }

  /* 头部：两行布局，操作区换行 */
  .page-head-inner { flex-direction: column; gap: 8px; padding: 8px 0; }
  .head-left { width: 100%; }
  .head-right {
    width: 100%;
    justify-content: flex-end;
    padding-bottom: 2px;
  }
  .supplier-name { font-size: 15px; }
  .head-meta { gap: 6px; font-size: 11.5px; }

  /* 金额汇总：两列网格 */
  .summary-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: visible;
    padding: 0;
    background: var(--divider);
    border-bottom: 1px solid var(--border);
  }
  .sum-item {
    flex: none;
    min-width: 0;
    padding: 8px 10px;
    border-left: 0;
    border-top: 0;
    background: var(--surface);
  }
  .sum-item:first-child { padding-left: 10px; }
  .sum-item:nth-child(odd) { border-right: 1px solid var(--divider); }
  .sum-item:nth-child(even) { border-right: 0; }
  .sum-value { font-size: 15px; }
  .sum-label { font-size: 11.5px; }

  /* 风险栏纵向紧凑滚动 */
  .risk-bar { padding: 8px 0; }
  .risk-lead { padding-left: 0; }
  .risk-list { gap: 6px; }

  /* 页签：横向滚动 + 隐藏图标 */
  .tab { padding: 9px 11px; font-size: 12.5px; }
  .tab .lucide { display: none; }

  /* 工具栏：纵向排布，控件不挤压 */
  .toolbar { padding: 8px 10px; gap: 7px; }
  .search-box { flex: 1 1 100%; }
  .filter-item { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .filter-item .select, .filter-item .input { width: 100%; min-width: 0; }
  .filter-range { flex: 1; }
  .filter-range .input { width: 100%; }
  .toolbar-right { width: 100%; margin-left: 0; justify-content: flex-end; }

  /* 表格：允许横向滚动，首列不粘 */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.grid { min-width: 720px; }
  .pane table.grid { min-width: 720px; }

  /* 抽屉：全屏 */
  .drawer {
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    animation: drawer-up .2s cubic-bezier(.22, .61, .36, 1);
  }
  @keyframes drawer-up { from { transform: translateY(20px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
  .drawer-head { padding: 8px 10px; }
  .drawer-body { padding: 10px 10px 24px; }
  .drawer-title { font-size: 14px; }
  .drawer-actions .btn-label { display: none; }
  .drawer-actions .btn { padding: 0 7px; }

  .desc-grid { grid-template-columns: 1fr; }
  .desc-cell.is-span2, .desc-cell.is-span4 { grid-column: span 1; }
  .desc-k { flex: 0 0 84px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .amt-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .modal { max-height: 92vh; }
  .field-row { grid-template-columns: 1fr; }

  .tfoot-bar { gap: 6px; }
  .pager { width: 100%; justify-content: flex-end; }
}

/* ---------- ≤420：窄屏手机 ---------- */
@media (max-width: 420px) {
  .summary-bar { grid-template-columns: 1fr; }
  .sum-item:nth-child(odd) { border-right: 0; }
  .stat-grid { grid-template-columns: 1fr; }
  .amt-strip { grid-template-columns: 1fr; }
  .head-meta .meta-sep { display: none; }
}

/* ---------- 打印 ---------- */
@media print {
  :root { --bg: #fff; }
  body { background: #fff; font-size: 11px; }
  .page-head { position: static; box-shadow: none; }
  .head-right, .tabs-wrap, .toolbar-right,
  .pager, .risk-bar, .drawer-mask, .drawer, .toast-root { display: none !important; }
  .tabs { display: none; }
  .pane[hidden] { display: none !important; }
  .summary-bar { overflow: visible; display: flex; flex-wrap: wrap; page-break-inside: avoid; }
  .sum-item { min-width: 120px; border-left: 1px solid #ddd; }
  .table-scroll { overflow: visible; }
  table.grid { min-width: 0; width: 100%; }
  table.grid thead { display: table-header-group; }
  table.grid tr { page-break-inside: avoid; }
  .section { break-inside: avoid; }
  .drawer, .overlay { display: none !important; }
  @page { margin: 12mm 10mm; }
}
