/* ============================================================
   迈购 MMGOO POD 柔性代销平台 · 共享样式基线 (common.css)
   设计规范：Ant Design Web 标准风 + 迈购品牌资产 (#FB7701)
   纪律要求：严禁 Emoji，统一采用 Lucide SVG 线性图标
   ============================================================ */

:root {
  /* 品牌色系 */
  --primary: #0F172A;
  --primary-hover: #1E293B;
  --accent: #FB7701;
  --accent-hover: #E06700;
  --accent-light: #FFF7ED;
  --accent-border: #FFD8A8;

  /* 状态功能色 */
  --success: #52c41a;
  --success-bg: #f6ffed;
  --success-border: #b7eb8f;
  --warning: #faad14;
  --warning-bg: #fffbe6;
  --warning-border: #ffe58f;
  --error: #ff4d4f;
  --error-bg: #fff1f0;
  --error-border: #ffccc7;
  --info: #1677ff;
  --info-bg: #e6f4ff;
  --info-border: #91caff;

  /* 中性色体系 */
  --text: rgba(0, 0, 0, 0.88);
  --text-secondary: rgba(0, 0, 0, 0.65);
  --text-tertiary: rgba(0, 0, 0, 0.45);
  --text-muted: rgba(0, 0, 0, 0.25);
  --border: #d9d9d9;
  --border-light: #f0f0f0;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;

  /* 尺寸与阴影 */
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-dropdown: 0 6px 16px rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12);
  --shadow-drawer: -6px 0 24px rgba(0, 0, 0, 0.12);
  --sidebar-w: 228px;
  --header-h: 56px;

  /* 间距与字号 (8px 体系) */
  --font-xs: 12px;
  --font-sm: 13px;
  --font-base: 14px;
  --font-lg: 16px;
  --font-xl: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: var(--font-base);
  color: var(--text);
  background: var(--bg-page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; color: var(--primary); }
.mono { font-family: "SF Mono", Menlo, Monaco, Consolas, monospace; }

/* ---------- 常用工具类 ---------- */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.flex-start { display: flex; align-items: flex-start; gap: 8px; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-tertiary); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--error); }
.text-success { color: var(--success); }
.bold { font-weight: 600; }
.nowrap { white-space: nowrap; }

/* ---------- 侧边栏布局 (Sidebar) ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: #001529; color: rgba(255, 255, 255, 0.85);
  display: flex; flex-direction: column; overflow-y: auto; z-index: 100;
  transition: width .2s ease, transform .25s ease;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px; padding: 16px;
  color: #fff; font-weight: 700; font-size: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-logo img { height: 28px; width: auto; object-fit: contain; }
.sidebar-logo .role-badge {
  font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: rgba(251, 119, 1, 0.2); color: #FF9B42; font-weight: 600;
}
.menu { padding: 8px; flex: 1; }
.menu-title {
  padding: 12px 12px 6px; font-size: 11px; letter-spacing: .05em;
  color: rgba(255, 255, 255, 0.45); white-space: nowrap; font-weight: 600;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 2px;
  border-radius: 6px; color: rgba(255, 255, 255, 0.7); font-size: 14px;
  cursor: pointer; text-decoration: none; transition: background .2s, color .2s; white-space: nowrap;
}
.menu-item:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.menu-item.active { color: #fff; background: var(--accent); font-weight: 500; }
.menu-item.disabled { opacity: 0.4; cursor: not-allowed; }
.menu-item i, .menu-item svg { width: 16px; height: 16px; flex: none; stroke-width: 2; }
.menu-badge {
  margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 10px;
  background: var(--error); color: #fff; font-weight: 600;
}

/* 侧边栏折叠 */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .sidebar-logo > span:not(.logo-icon) { display: none; }
.sidebar.collapsed .menu-title { display: none; }
.sidebar.collapsed .menu-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .menu-item > span { display: none; }
.sidebar.collapsed ~ .main { margin-left: 64px; }

/* ---------- 顶栏与主容器 ---------- */
.main {
  margin-left: var(--sidebar-w); min-height: 100vh;
  display: flex; flex-direction: column; transition: margin-left .2s ease;
}
.header {
  height: var(--header-h); background: #fff; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.header-left, .header-right { display: flex; align-items: center; gap: 12px; }
.header-collapse-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border: none; background: none; border-radius: 6px; color: var(--text-secondary); cursor: pointer;
  transition: background .2s, color .2s;
}
.header-collapse-btn:hover { background: var(--bg-page); color: var(--text); }
.header-collapse-btn i, .header-collapse-btn svg { width: 18px; height: 18px; stroke-width: 2; }
.header-collapse-btn .panel-open { display: none; }
.sidebar.collapsed ~ .main .header-collapse-btn .panel-open { display: inline-flex; }
.sidebar.collapsed ~ .main .header-collapse-btn .panel-close { display: none; }

.prototype-tag {
  background: #FFF7ED; color: var(--accent); border: 1px solid #FFD8A8;
  font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 600;
}
.nav-back-link {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-tertiary);
  padding: 4px 8px; border-radius: 4px;
}
.nav-back-link:hover { color: var(--accent); background: var(--bg-page); }

.content { padding: 24px; flex: 1; max-width: 1440px; margin: 0 auto; width: 100%; }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.breadcrumb { font-size: 13px; color: var(--text-tertiary); margin-bottom: 4px; }
.page-header h2 { font-size: 20px; font-weight: 600; color: var(--primary); }
.page-header p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* 用户下拉 */
.user-menu { position: relative; }
.user-menu-trigger {
  display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 10px;
  border-radius: 6px; color: var(--text); border: 1px solid transparent; font-size: 13px;
}
.user-menu-trigger:hover { background: var(--bg-page); border-color: var(--border-light); }
.avatar-circle {
  width: 28px; height: 28px; border-radius: 50%; background: #FFF4EB; color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.user-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px;
  background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius);
  box-shadow: var(--shadow-dropdown); padding: 6px; z-index: 300;
}
.user-menu.open .user-dropdown { display: block; }
.user-dropdown .dropdown-header { padding: 8px 10px; border-bottom: 1px solid var(--border-light); margin-bottom: 4px; }
.user-dropdown .u-name { font-weight: 600; font-size: 13px; }
.user-dropdown .u-role { font-size: 11px; color: var(--text-tertiary); }
.user-dropdown .dropdown-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px;
  border: none; background: none; border-radius: 4px; font-size: 13px;
  color: var(--text); cursor: pointer; text-align: left;
}
.user-dropdown .dropdown-item:hover { background: var(--bg-page); }
.user-dropdown .dropdown-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

/* ---------- 卡片与指标 ---------- */
.card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 18px 20px;
}
.card + .card { margin-top: 16px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-light);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--primary); display: flex; align-items: center; gap: 8px; }

.metrics-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.metric-card {
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-card); transition: transform .15s, border-color .15s;
}
.metric-card:hover { border-color: var(--accent-border); }
.metric-card .metric-header { display: flex; align-items: center; justify-content: space-between; }
.metric-card .metric-title { color: var(--text-secondary); font-size: 13px; }
.metric-card .metric-icon { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.metric-card .metric-value { font-size: 26px; font-weight: 700; color: var(--primary); margin: 6px 0 2px; }
.metric-card .metric-footer { color: var(--text-tertiary); font-size: 12px; display: flex; align-items: center; gap: 4px; }

/* 状态统计筛选条 (Filter Strip) */
.stat-filter-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-filter-item {
  padding: 5px 14px; border-radius: 16px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 13px; color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: 6px; transition: all .2s;
}
.stat-filter-item:hover { border-color: var(--accent); color: var(--accent); }
.stat-filter-item.active { border-color: var(--accent); color: var(--accent); background: var(--accent-light); font-weight: 600; }
.stat-filter-item .count { font-size: 11px; padding: 0 5px; border-radius: 8px; background: rgba(0,0,0,0.06); }
.stat-filter-item.active .count { background: var(--accent); color: #fff; }

/* ---------- 筛选条 (Filter Bar) ---------- */
.filter-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px;
}

/* ---------- 表单控件 ---------- */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.form-required::after { content: " *"; color: var(--error); }
.form-input, .form-select {
  height: 34px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; background: #fff; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.form-textarea {
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; background: #fff; color: var(--text);
  resize: vertical; min-height: 80px; line-height: 1.5;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(251, 119, 1, 0.15);
}
.form-hint { font-size: 12px; color: var(--text-tertiary); }
.form-error { font-size: 12px; color: var(--error); margin-top: 2px; }

/* ---------- 表格 (Ant Table) ---------- */
.ant-table-wrap { overflow-x: auto; border: 1px solid var(--border-light); border-radius: var(--radius); background: #fff; }
.ant-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ant-table thead th {
  background: #fafafa; font-weight: 600; text-align: left;
  padding: 10px 14px; border-bottom: 1px solid var(--border-light); white-space: nowrap; color: var(--text-secondary);
}
.ant-table tbody td {
  padding: 11px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; color: var(--text);
}
.ant-table tbody tr:last-child td { border-bottom: none; }
.ant-table tbody tr:hover { background: #fafbfc; }

/* ---------- 标签 (Tag) ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 4px; font-size: 12px; line-height: 18px; border: 1px solid transparent; white-space: nowrap;
}
.tag-orange { color: #d46b08; background: #fff7e6; border-color: #ffd591; }
.tag-blue { color: #1677ff; background: #e6f4ff; border-color: #91caff; }
.tag-green { color: #389e0d; background: #f6ffed; border-color: #b7eb8f; }
.tag-red { color: #cf1322; background: #fff1f0; border-color: #ffa39e; }
.tag-gray { color: rgba(0,0,0,0.65); background: #f5f5f5; border-color: #d9d9d9; }
.tag-purple { color: #722ed1; background: #f9f0ff; border-color: #d3adf7; }

/* ---------- 按钮 (Button) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 6px; padding: 6px 14px; font-size: 13px;
  font-weight: 500; cursor: pointer; text-decoration: none; transition: all .2s; white-space: nowrap;
}
.btn i, .btn svg { width: 14px; height: 14px; stroke-width: 2; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { color: var(--accent); border-color: var(--accent); }
.btn-danger { background: #fff; border-color: var(--error); color: var(--error); }
.btn-danger:hover { background: var(--error); color: #fff; }
.btn-link { background: none; border: none; color: var(--accent); padding: 2px 6px; font-size: 13px; }
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-lg { padding: 9px 20px; font-size: 14px; }
.btn.disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ---------- 弹窗 (Modal) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: var(--radius); width: min(560px, 92vw);
  max-height: 85vh; display: flex; flex-direction: column; box-shadow: var(--shadow-dropdown);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-light); font-size: 16px; font-weight: 600;
}
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 10px; background: #fafafa;
  border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius);
}

/* ---------- 抽屉 (Drawer) ---------- */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 1000;
  backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 94vw);
  background: #fff; display: flex; flex-direction: column; box-shadow: var(--shadow-drawer);
  animation: slideInRight .2s ease-out;
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border-light); font-size: 16px; font-weight: 600;
}
.drawer-body { padding: 24px; overflow-y: auto; flex: 1; }
.drawer-footer {
  padding: 14px 24px; border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 10px; background: #fafafa;
}

/* ---------- 时间线 / 步骤条 ---------- */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--border-light); }
.timeline-item { position: relative; padding-bottom: 16px; font-size: 13px; }
.timeline-item::before {
  content: ""; position: absolute; left: -18px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
}
.timeline-item.done::before { background: var(--success); }
.timeline-item.pending::before { background: var(--border); }
.timeline-title { font-weight: 600; color: var(--text); }
.timeline-time { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.stepper { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; position: relative; }
.stepper::before {
  content: ""; position: absolute; left: 10%; right: 10%; top: 14px; height: 2px;
  background: var(--border-light); z-index: 1;
}
.stepper-step { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.stepper-num {
  width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--text-tertiary);
}
.stepper-step.active .stepper-num { border-color: var(--accent); background: var(--accent); color: #fff; }
.stepper-step.done .stepper-num { border-color: var(--success); background: var(--success); color: #fff; }
.stepper-text { font-size: 12px; color: var(--text-tertiary); font-weight: 500; }
.stepper-step.active .stepper-text { color: var(--accent); font-weight: 600; }
.stepper-step.done .stepper-text { color: var(--text); }

/* ---------- 提示条 (Alert Strip) ---------- */
.alert-strip {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px;
  border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; line-height: 1.5;
}
.alert-strip i, .alert-strip svg { width: 16px; height: 16px; flex: none; margin-top: 2px; stroke-width: 2; }
.alert-info { background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info); }
.alert-warning { background: var(--warning-bg); border: 1px solid var(--warning-border); color: #d46b08; }
.alert-success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.alert-danger { background: var(--error-bg); border: 1px solid var(--error-border); color: var(--error); }

/* ---------- 分页与空态 ---------- */
.pagination { display: flex; gap: 6px; justify-content: flex-end; align-items: center; margin-top: 16px; }
.pagination span, .pagination button {
  min-width: 28px; height: 28px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 4px; font-size: 12px; cursor: pointer; background: #fff; color: var(--text);
}
.pagination span.active { border-color: var(--accent); color: var(--accent); font-weight: 600; background: var(--accent-light); }
.pagination .info { border: none; background: none; color: var(--text-tertiary); cursor: default; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-tertiary); }
.empty-state i, .empty-state svg { width: 44px; height: 44px; color: var(--text-muted); margin-bottom: 10px; stroke-width: 1.5; }
.empty-state h4 { font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 360px; margin: 0 auto 16px; }

/* ---------- 文件上传区 (Uploader) ---------- */
.upload-dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px;
  text-align: center; cursor: pointer; background: #fafafa; transition: border-color .2s, background .2s;
}
.upload-dropzone:hover { border-color: var(--accent); background: var(--accent-light); }
.upload-dropzone i, .upload-dropzone svg { width: 32px; height: 32px; color: var(--accent); margin-bottom: 8px; }
.upload-dropzone .upload-title { font-size: 13px; font-weight: 600; color: var(--primary); }
.upload-dropzone .upload-desc { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* ---------- 通用隐藏 ---------- */
[hidden] { display: none !important; }

/* ---------- 响应式 (适配 H5 移动端) ---------- */
@media (max-width: 768px) {
  .sidebar { width: 220px; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0 !important; }
  .content { padding: 14px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-group { width: 100%; }
  .filter-bar .form-input, .filter-bar .form-select { width: 100% !important; }
  .ant-table-wrap { display: block; overflow-x: auto; }
  .drawer { width: 100vw; }
  .modal { width: 95vw; }
  .page-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-header .flex-center { justify-content: flex-start; }
  .stat-filter-strip { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; }
  .stat-filter-item { flex-shrink: 0; }
}
