/* 营销物资管理工具 - 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f2f5f9;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #24303e;
  --muted: #6b7a8c;
  --primary: #1f7a5c;
  --primary-weak: #e6f4ee;
  --danger: #c2413c;
  --danger-weak: #fdecea;
  --warn: #b7791f;
  --warn-weak: #fdf3e0;
  --radius: 12px;
}
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; display: flex; flex-direction: column;
}
.hidden { display: none !important; }

/* 头部 */
.app-header { background: #143a2e; color: #fff; padding: 18px 24px; }
.header-inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { font-size: 30px; }
.brand h1 { font-size: 20px; font-weight: 600; }
.brand-sub { font-size: 12px; opacity: .75; margin-top: 2px; }

/* 按钮 */
.btn-primary, .btn-ghost, .btn-danger {
  border: none; border-radius: 8px; padding: 8px 14px; font-size: 13px;
  cursor: pointer; transition: filter .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f6f8fa; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* 统计卡片 */
.stats-row {
  max-width: 1080px; margin: 20px auto 0; padding: 0 24px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; text-align: center;
}
.stat-num { display: block; font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-card.warn .stat-num { color: var(--warn); }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; display: block; }

/* Tab */
.tabs {
  max-width: 1080px; margin: 16px auto 0; padding: 0 24px;
  display: flex; gap: 8px;
}
.tab {
  border: none; background: transparent; color: var(--muted);
  font-size: 14px; padding: 8px 16px; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* 主区域 */
.main { max-width: 1080px; width: 100%; margin: 0 auto; padding: 16px 24px 32px; flex: 1; }
.view { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 8px; }

/* 输入 */
.input {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  font-size: 13px; color: var(--text); background: #fff; outline: none;
  width: 100%;
}
.input:focus { border-color: var(--primary); }
.search-input { max-width: 320px; }
.input-sm { width: auto; padding: 7px 10px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
.grid-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid-table th {
  text-align: left; padding: 10px 12px; color: var(--muted);
  font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.grid-table td { padding: 10px 12px; border-bottom: 1px solid #eef2f6; }
.grid-table tr:hover td { background: #f8fafc; }
.col-actions { text-align: right; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.stock-low { color: var(--danger); font-weight: 600; }
.stock-ok { color: var(--primary); font-weight: 600; }
.type-badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
}
.type-in { background: var(--primary-weak); color: var(--primary); }
.type-out { background: #e8f1fb; color: #1a5fa8; }
.type-apply { background: var(--warn-weak); color: var(--warn); }
.empty-row td { text-align: center; color: var(--muted); padding: 40px 0; }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 25, 35, .45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: #fff; border-radius: 14px; width: 440px; max-width: calc(100vw - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; }
.modal-close {
  border: none; background: none; font-size: 20px; color: var(--muted); cursor: pointer;
}
.modal-body { padding: 16px 20px; }
.modal-body label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.modal-body .input { margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--line);
}
.mov-item-info { font-size: 13px; color: var(--text); background: var(--primary-weak); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }

/* toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #24303e; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 13px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.app-footer {
  text-align: center; color: var(--muted); font-size: 12px; padding: 16px;
}

@media (max-width: 720px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .search-input { max-width: 100%; }
}
