/* 采控宝 客户端样式：手机 / 平板 / PC 自适应 */
:root {
  --primary: #0f6cbd;
  --primary-dark: #0b5497;
  --primary-light: #e8f2fc;
  --success: #0a8a52;
  --warning: #e08a1e;
  --danger: #d93a3a;
  --gray: #8a94a6;
  --text: #1d2733;
  --text-2: #5b6675;
  --border: #e4e8ef;
  --bg: #f4f6fa;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 40, 80, .06);
  --tabbar-h: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
.hide { display: none !important; }

/* ---------- 布局 ---------- */
.layout { min-height: 100vh; }
.header {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.header .logo { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.header .sub { font-size: 12px; opacity: .85; }
.header .spacer { flex: 1; }
.header .hi { text-align: right; font-size: 12px; line-height: 1.3; opacity: .95; }
.header .btn-out {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
  color: #fff; padding: 4px 10px; border-radius: 20px; cursor: pointer; font-size: 12px;
}
.content { padding: 12px 12px calc(var(--tabbar-h) + 24px); max-width: 1200px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: var(--tabbar-h); background: #fff; border-top: 1px solid var(--border);
  display: flex; box-shadow: 0 -2px 10px rgba(20,40,80,.05);
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; color: var(--gray); cursor: pointer; position: relative;
}
.tabbar .tab.active { color: var(--primary); font-weight: 600; }
.tabbar .tab .ic { font-size: 20px; line-height: 1; }
.tabbar .badge {
  position: absolute; top: 6px; right: 50%; margin-right: -22px;
  background: var(--danger); color: #fff; font-size: 10px; min-width: 16px; height: 16px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ---------- 卡片 / 组件 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 10px; display: flex; align-items: center; gap: 6px; }
.card-title .more { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--gray); }
.banner {
  background: linear-gradient(135deg, #0f6cbd, #17a2b8); color: #fff;
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.banner h3 { margin: 0 0 6px; font-size: 16px; }
.banner p { margin: 0; font-size: 12px; opacity: .9; }

.grid-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grid-quick .q {
  background: #fff; border-radius: 10px; padding: 12px 4px; text-align: center;
  box-shadow: var(--shadow); cursor: pointer;
}
.grid-quick .q .ic { font-size: 22px; }
.grid-quick .q .t { font-size: 12px; margin-top: 4px; color: var(--text-2); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #fff; border-radius: 10px; padding: 12px; text-align: center; box-shadow: var(--shadow); }
.stat .n { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat .l { font-size: 11px; color: var(--gray); }

/* 商品 */
.prod-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.prod {
  background: #fff; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.prod .img {
  height: 120px; background: #f0f3f7; display: flex; align-items: center; justify-content: center;
  color: #b9c2ce; font-size: 12px; overflow: hidden;
}
.prod .img img { width: 100%; height: 100%; object-fit: cover; }
.prod .bd { padding: 8px 10px; flex: 1; display: flex; flex-direction: column; }
.prod .nm { font-size: 13px; font-weight: 600; line-height: 1.4; height: 36px; overflow: hidden; }
.prod .meta { font-size: 11px; color: var(--gray); margin: 2px 0; }
.prod .price { color: var(--danger); font-weight: 700; font-size: 16px; margin-top: 4px; }
.prod .price small { font-size: 11px; }
.prod .ft { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.btn-add {
  background: var(--primary); color: #fff; border: none; border-radius: 20px;
  padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.stock-tag { font-size: 11px; color: var(--gray); margin-left: auto; }

/* 表单 */
.form-item { margin-bottom: 12px; }
.form-item label { display: block; font-size: 13px; margin-bottom: 5px; color: var(--text-2); }
.form-item label .req { color: var(--danger); }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; outline: none;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 70px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 10px 16px; border-radius: 8px; border: none; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 14px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.gray { background: #eef1f6; color: var(--text-2); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }

/* 列表 */
.list-item {
  background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.list-item .t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.list-item .d { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; }
.tag.blue { background: var(--primary-light); color: var(--primary); }
.tag.green { background: #e6f6ee; color: var(--success); }
.tag.orange { background: #fdf1e0; color: var(--warning); }
.tag.red { background: #fdeaea; color: var(--danger); }
.tag.gray { background: #eef1f6; color: var(--text-2); }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; }
.tabs .t {
  padding: 5px 12px; border-radius: 20px; background: #fff; border: 1px solid var(--border);
  font-size: 12px; white-space: nowrap; cursor: pointer; color: var(--text-2);
}
.tabs .t.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.empty { text-align: center; padding: 40px 20px; color: var(--gray); font-size: 13px; }
.empty .ic { font-size: 40px; display: block; margin-bottom: 8px; opacity: .5; }

/* 弹窗 */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-width: 640px; border-radius: 16px 16px 0 0;
  max-height: 88vh; overflow-y: auto; padding: 16px 16px 24px;
}
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.modal .close { float: right; color: var(--gray); cursor: pointer; font-size: 20px; line-height: 1; }

/* 时间轴 */
.timeline { border-left: 2px solid var(--border); padding-left: 14px; margin-left: 4px; }
.timeline .node { position: relative; padding-bottom: 14px; }
.timeline .node::before {
  content: ''; position: absolute; left: -21px; top: 4px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--primary);
}
.timeline .node .tt { font-size: 13px; font-weight: 600; }
.timeline .node .td { font-size: 11px; color: var(--gray); }

/* 购物车条 */
.cart-bar {
  position: fixed; left: 0; right: 0; bottom: var(--tabbar-h); z-index: 55;
  background: #fff; border-top: 1px solid var(--border); padding: 8px 14px;
  display: flex; align-items: center; gap: 10px;
}
.cart-bar .sum { flex: 1; font-size: 13px; }
.cart-bar .sum b { color: var(--danger); font-size: 17px; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; }
.login-box .brand { text-align: center; margin-bottom: 22px; }
.login-box .brand .n { font-size: 26px; font-weight: 800; color: var(--primary); letter-spacing: 3px; }
.login-box .brand .s { font-size: 12px; color: var(--gray); margin-top: 4px; }

.toast {
  position: fixed; left: 50%; top: 30%; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #fff; padding: 10px 18px; border-radius: 8px;
  z-index: 999; font-size: 13px; max-width: 80%;
}

/* 平板/PC 适配 */
@media (min-width: 768px) {
  .prod-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-quick { grid-template-columns: repeat(6, 1fr); }
  .content { padding: 16px 20px 30px; }
}
@media (min-width: 1024px) {
  .layout { display: flex; }
  .header { display: none; }
  .sidebar {
    width: 210px; flex: 0 0 210px; background: #0b5497; color: #fff;
    min-height: 100vh; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
  }
  .sidebar .logo { font-size: 20px; font-weight: 800; letter-spacing: 2px; padding: 6px 8px 18px; }
  .sidebar .nav-item {
    padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 4px;
    display: flex; align-items: center; gap: 8px; font-size: 14px; opacity: .88;
  }
  .sidebar .nav-item:hover { background: rgba(255,255,255,.12); }
  .sidebar .nav-item.active { background: #fff; color: var(--primary-dark); font-weight: 700; opacity: 1; }
  .sidebar .nav-item .badge { margin-left: auto; background: var(--danger); color: #fff;
    border-radius: 10px; padding: 0 6px; font-size: 11px; }
  .sidebar .me { position: absolute; bottom: 16px; left: 12px; right: 12px; font-size: 12px; opacity: .9; }
  .main { flex: 1; min-width: 0; }
  .tabbar { display: none; }
  .content { padding: 20px 24px 40px; }
  .cart-bar { left: 210px; bottom: 0; }
  .prod-grid { grid-template-columns: repeat(4, 1fr); }
  .modal { border-radius: 12px; max-width: 720px; }
  .mask { align-items: center; }
}
