/* 锐意进销存 自定义样式 */
:root { --brand: #2563eb; }
body { font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif; }

/* 进货入库：行悬停显示采购订单详情浮层 */
#po-tooltip{
  position: fixed;
  z-index: 9999;
  max-width: 440px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,.20);
  padding: 12px 14px;
  font-size: 13px;
  color: #334155;
  pointer-events: none;
  line-height: 1.5;
}
.po-pop-head{ font-size: 14px; margin-bottom: 8px; }
.po-pop-meta{ display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; margin-bottom: 10px; }
.po-pop-meta > div{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.po-k{ display: inline-block; min-width: 60px; color: #94a3b8; margin-right: 6px; }
.po-pop-table{ width: 100%; border-collapse: collapse; font-size: 12px; }
.po-pop-table th, .po-pop-table td{ padding: 4px 8px; border-bottom: 1px solid #f1f5f9; text-align: left; }
.po-pop-table th{ color: #94a3b8; font-weight: 500; }
.po-pop-table .num{ text-align: right; }

/* 侧边栏激活态 */
.nav-link.active { background: rgba(255,255,255,0.12); color: #fff; }
.nav-link.active i { color: #38bdf8; }

/* 卡片 */
.card {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
  border: 1px solid #f1f5f9;
}

/* 仪表盘 KPI 卡片：自带深色渐变背景与白字。
   注意：不要用 .card + Tailwind bg-gradient/text-white 组合——.card 的 #fff
   与 bg-gradient 同特异性且后加载会覆盖背景，导致白字落在白底上看不见。
   这里用独立类彻底规避该冲突。 */
.kpi {
  color: #fff;
  padding: 1rem;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}
.kpi .kpi-label { opacity: 0.85; font-size: 0.75rem; }
.kpi .kpi-value { font-size: 1.5rem; font-weight: 600; line-height: 2rem; margin-top: 0.5rem; }
.kpi-blue    { background: linear-gradient(to bottom right, #2563eb, #60a5fa); }
.kpi-emerald { background: linear-gradient(to bottom right, #059669, #34d399); }
.kpi-amber   { background: linear-gradient(to bottom right, #d97706, #fbbf24); }
.kpi-red     { background: linear-gradient(to bottom right, #dc2626, #f87171); }
.kpi-sky     { background: linear-gradient(to bottom right, #0284c7, #38bdf8); }
.kpi-indigo  { background: linear-gradient(to bottom right, #4f46e5, #818cf8); }
.kpi-cyan    { background: linear-gradient(to bottom right, #0891b2, #22d3ee); }
.kpi-purple  { background: linear-gradient(to bottom right, #7c3aed, #a78bfa); }

/* 表格卡片化：手机端转为卡片列表，避免横向滚动 */
@media (max-width: 767px) {
  .table-card thead { display: none; }
  .table-card tbody tr {
    display: block; margin-bottom: 1rem;
    border: 1px solid #e2e8f0; border-radius: 0.75rem;
    padding: 0.5rem 0.75rem; background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  }
  .table-card tbody td {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: 0.4rem 0; border: none; text-align: right;
  }
  .table-card tbody td::before {
    content: attr(data-label); font-weight: 500; color: #64748b; text-align: left;
  }

  /* 列表页筛选栏：手机端输入控件全宽堆叠，避免挤压换行 */
  .card form[method=get] {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.75rem;
    align-items: end;
  }
  .card form[method=get] > div,
  .card form[method=get] > input,
  .card form[method=get] > select,
  .card form[method=get] > button,
  .card form[method=get] > a {
    width: 100%;
    flex: 1 1 100%;
  }
  .card form[method=get] > div > select,
  .card form[method=get] > div > input {
    width: 100%;
  }
  /* 单列布局的搜索框占满整行，范围输入可并排 */
  .card form[method=get] > input[name=q],
  .card form[method=get] > input[placeholder*="单号"] {
    grid-column: 1 / -1;
  }
  .card form[method=get] > input[name=cost_min],
  .card form[method=get] > input[name=cost_max] {
    grid-column: span 1;
  }

  /* 底部 Tab 栏 */
  .bottom-tab { color: #64748b; transition: color .15s; }
  .bottom-tab.active { color: #102a4c; }
  .bottom-tab.active i { color: #38bdf8; }

  /* 列表操作列：手机端卡片视图下，操作链接横向排列为紧凑图标按钮 */
  .table-card tbody td[data-label="操作"] {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
  }
  .table-card tbody td[data-label="操作"] a,
  .table-card tbody td[data-label="操作"] button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border-radius: 0.6rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    text-decoration: none;
    font-size: 0;            /* 隐藏文字，只留图标 */
    overflow: hidden;
  }
  .table-card tbody td[data-label="操作"] a i,
  .table-card tbody td[data-label="操作"] button i {
    font-size: 1.15rem;     /* 图标恢复大小 */
    line-height: 1;
  }
  .table-card tbody td[data-label="操作"] a:hover,
  .table-card tbody td[data-label="操作"] button:hover {
    background: #eef2f7;
  }
  /* 危险类操作（删除）保持红色 */
  .table-card tbody td[data-label="操作"] a.text-red-500,
  .table-card tbody td[data-label="操作"] a[onclick*="confirmDelete"] {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
  }
}

/* 触控目标≥44px */
button, a.btn, .nav-link, input[type=submit] { min-height: 44px; }

/* 入场动画 */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.flash-msg, .card { animation: fadeIn .25s ease; }

/* 表格 hover */
.table-row-hover tbody tr:hover { background: #f8fafc; }

/* 状态标签 */
.tag { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 9999px; font-size: 12px; font-weight: 500; }
