/* ============================================================
   BeeQ 库存 · 蓝色科技扁平化设计系统
   ============================================================ */

:root {
  --brand: #2563eb;          /* 科技蓝 */
  --brand-2: #0ea5e9;        /* 青蓝 */
  --bg: #f6f8fb;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #64748b;
  --line: #e2e8f0;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.05);
}

* { -webkit-font-smoothing: antialiased; }
body { font-family: "Inter", -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---- 侧边导航 ---- */
.sidebar {
  background: linear-gradient(180deg, #1e3a8a 0%, #1d4ed8 55%, #2563eb 100%);
  position: relative;
  transition: width .2s ease;
}
.sidebar .logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,.15); backdrop-filter: blur(6px);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px;
  letter-spacing: .5px; border: 1px solid rgba(255,255,255,.25);
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: 10px;
  color: rgba(255,255,255,.72); font-size: 14px;
  transition: all .15s ease; white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-item-active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #7dd3fc; }

/* ---- 顶部栏 ---- */
.topbar { background: rgba(255,255,255,.75); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }

/* ---- 卡片 ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 24px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--ink); }

/* ---- 统计卡 ---- */
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; right: -20px; top: -20px;
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(37,99,235,.08), rgba(14,165,233,.10));
}
.stat-label { font-size: 13px; color: var(--ink-2); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--ink); margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat-value .unit { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-left: 4px; }

/* ---- 表格 ---- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl thead th {
  text-align: left; padding: 16px 18px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); background: #f8fafc; border-bottom: 1px solid var(--line);
  white-space: nowrap; line-height: 1.4;
}
table.tbl thead th.text-right { text-align: right; }
table.tbl tbody td {
  padding: 16px 18px; border-bottom: 1px solid #f1f5f9; vertical-align: middle;
  line-height: 1.5;
}
table.tbl tbody tr:hover { background: #f8fafc; }
table.tbl tbody tr:last-child td { border-bottom: none; }
/* 数字列统一右对齐 + 等宽数字 + 不换行，保证上下对齐 */
table.tbl td.node-cell, table.tbl td.text-right { text-align: right; white-space: nowrap; }
.qty-badge { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; transition: all .15s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.btn-primary:hover { opacity: .92; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.25); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }

/* ---- 表单 ---- */
.field { margin-bottom: 20px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 8px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; background: #fff; color: var(--ink); outline: none; transition: border .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ---- 徽标 ---- */
.tag {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
}
.tag-blue { background: #eff6ff; color: #1d4ed8; }
.tag-green { background: #ecfdf5; color: #059669; }
.tag-amber { background: #fffbeb; color: #d97706; }
.tag-red { background: #fef2f2; color: #dc2626; }
.tag-gray { background: #f1f5f9; color: #475569; }

/* ---- 节点单元格 ---- */
.node-cell { text-align: right; font-variant-numeric: tabular-nums; }
.node-cell.highlight { color: var(--brand); font-weight: 700; }

/* ---- Toast ---- */
.toast {
  padding: 12px 18px; border-radius: 12px; background: #fff; color: var(--ink);
  box-shadow: 0 8px 30px rgba(15,23,42,.12); font-size: 14px;
  display: flex; align-items: center; gap: 10px; border-left: 4px solid var(--brand);
  animation: toast-in .25s ease;
}
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---- 空状态 ---- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty-state .big { font-size: 40px; margin-bottom: 10px; }

/* ---- HTMX 加载态 ---- */
.htmx-request .spinner, .htmx-request.spinner { opacity: .6; pointer-events: none; }
