/* 双喜报税 · 移动端适配（仅窄屏生效，桌面端不受影响） */
@media (max-width: 820px) {
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 15px; line-height: 1.6; }

  /* 容器：手机全宽，收紧留白 */
  .wrap, .container, .main, .content {
    max-width: 100% !important;
    padding: 14px 12px 60px !important;
  }

  h1 { font-size: 20px !important; line-height: 1.35; }
  h2 { font-size: 15.5px !important; }

  /* 顶栏：允许换行，筛选与链接不挤压 */
  .top, .header, .head {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 10px !important;
    display: flex !important;
  }
  .top > div, .header > div { max-width: 100% !important; }
  .controls, .nav, .actions, .nav-links {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100%;
  }
  .controls select, .controls input, .controls .btn { flex: 1 1 44%; min-width: 0; }
  .top a, .header a { display: inline-block; padding: 4px 0; }

  /* KPI 两列，数字不挤 */
  .kpi, .stats, .cards { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .kpi .num, .kpi b { font-size: 20px !important; }
  .kpi > div { padding: 12px 14px !important; }

  .grid, .cols, .two, .row2 { grid-template-columns: 1fr !important; }

  /* 面板与表格 */
  .panel { padding: 14px 12px !important; border-radius: 12px; margin-bottom: 14px; }
  .tw { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -6px; padding: 0 6px; position: relative; }
  .tw::after {
    content: "← 左右滑动查看 →";
    display: block; text-align: right; font-size: 11px; color: #9aa3ad; padding: 6px 2px 0;
  }
  table { min-width: 100%; }
  th, td { padding: 9px 8px !important; font-size: 12.5px !important; white-space: nowrap; }
  th:first-child, td:first-child {
    position: sticky; left: 0; z-index: 2; background: #fff;
  }
  th:first-child { background: #fafbfc; z-index: 3; }
  td .note, td .desc { white-space: normal; }
  .tabs { overflow-x: auto; white-space: nowrap; flex-wrap: nowrap !important; gap: 6px !important; }

  /* 触控尺寸 */
  .btn, button, .tab { padding: 9px 14px !important; font-size: 13.5px !important; min-height: 38px; }
  input, select, textarea { font-size: 15px !important; }

  .foot { font-size: 11.5px; }
  .sub { font-size: 13px; }

  /* 卡片内长数字换行不溢出 */
  .num, td.num { word-break: break-all; }
}

/* 手机端卡片列表（由 app.js 生成，替代宽表） */
@media (max-width: 820px) {
  table.sxc-off { display: none !important; }
  .sxc { margin-top: 4px; }
  .rc { background: #fff; border: 1px solid #eef0f3; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
  .rc .rt { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; font-size: 14.5px; font-weight: 600; line-height: 1.4; }
  .rc .rt > span:first-child { flex: 1; min-width: 0; word-break: break-word; }
  .rc .rst { flex: 0 0 auto; font-size: 12px; font-weight: 500; }
  .rc .kv { display: flex; gap: 10px; margin-top: 6px; font-size: 12.8px; line-height: 1.65; }
  .rc .k { flex: 0 0 76px; color: #8a9099; }
  .rc .v { flex: 1; min-width: 0; word-break: break-word; color: #1f2329; }
  .rc .ops { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
  .rc .ops .btn, .rc .ops button { flex: 1 1 auto; }
  .tw::after { content: none; }
}

@media (max-width: 820px) {
  /* KPI 类容器统一改换行两列（兼容 flex 与 grid 两种实现） */
  .kpi, .stats, .cards, .kv {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    grid-template-columns: none !important;
  }
  .kpi > *, .stats > *, .cards > *, .kv > * {
    flex: 1 1 calc(50% - 5px) !important;
    min-width: 0 !important;
    max-width: calc(50% - 5px) !important;
  }
  .kpi > * { padding: 12px 14px !important; }
  .kpi .num, .kpi b, .kv b { font-size: 20px !important; line-height: 1.3; }
  .kpi small, .kpi .label { font-size: 12px; line-height: 1.5; }

  /* 表单栅格改单列 */
  .form, .form-grid, .fields { grid-template-columns: 1fr !important; }
  .form { padding: 14px !important; }
}

@media (max-width: 820px) {
  .stage, .flows, .steps-bar { display: flex !important; flex-wrap: wrap !important; gap: 8px !important; }
  .stage > div { flex: 1 1 calc(33.33% - 8px) !important; min-width: 0 !important; padding: 10px 12px !important; }
}

@media (max-width: 820px) {
  .form { display: flex !important; flex-direction: column !important; gap: 10px !important; }
  .form > * { width: 100% !important; }
  .form input[type=checkbox], .form input[type=radio] { width: auto !important; align-self: flex-start; }
}

@media (max-width: 820px) {
  input, select, textarea { font-size: 16px; }
  select:not([multiple]) { min-height: 38px; border-radius: 8px; min-width: 96px; }
}
