/* ============================================
   精简版 SCM · 全局样式
   风格：极简白底 + 深色文字 + 微妙灰边 + 蓝/绿/橙点睛
   ============================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-soft: #f0f2f5;
  --text: #1f2937;
  --text-soft: #6b7280;
  --text-muted: #9ca3af;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  background: #f3f4f6;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  color: #374151;
}

/* ---------- Top Bar ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }

.brand {
  display: flex; align-items: center; gap: 0.5rem;
  text-decoration: none; color: var(--text);
  font-weight: 600;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  border-radius: 8px;
  font-size: 16px;
}
.brand-name { font-size: 0.95rem; letter-spacing: 0.01em; }

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.role-badge.role-ops       { background: #eff6ff; color: var(--primary); }
.role-badge.role-warehouse { background: #f0fdf4; color: var(--success); }
.role-badge.role-customer  { background: #fff7ed; color: var(--warn); }

.role-meta { color: var(--text-soft); font-size: 13px; }

.user-name { color: var(--text-soft); font-size: 13px; }

.btn-ghost {
  color: var(--text-soft);
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}
.btn-ghost:hover { background: #f3f4f6; text-decoration: none; }

/* ---------- Container ---------- */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}

/* ---------- Page Header ---------- */

.page-header { margin-bottom: 1.5rem; }
.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.25rem;
}
.page-subtitle {
  color: var(--text-soft);
  font-size: 0.875rem;
}

/* ---------- KPI Row ---------- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.kpi-num {
  font-size: 1.625rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.1;
  margin-bottom: 0.25rem;
  font-feature-settings: "tnum";
}
.kpi-label {
  color: var(--text-soft);
  font-size: 0.8rem;
}
.kpi-card.kpi-accent { border-color: var(--primary); }
.kpi-card.kpi-accent .kpi-num { color: var(--primary); }
.kpi-card.kpi-warn .kpi-num { color: var(--warn); font-size: 1.25rem; }

/* ---------- Menu Grid ---------- */

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.75rem;
}
.menu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text);
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.menu-card:hover {
  border-color: var(--primary);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.menu-icon {
  font-size: 1.5rem;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--border-soft);
  border-radius: 10px;
  flex-shrink: 0;
}
.menu-body { flex: 1; min-width: 0; }
.menu-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
  color: #111827;
}
.menu-desc {
  color: var(--text-soft);
  font-size: 0.8rem;
}
.menu-arrow {
  color: var(--text-muted);
  font-size: 1.25rem;
  font-weight: 300;
}

/* 未开发模块卡片（灰化、不可点） */
.menu-card-off {
  opacity: 0.55;
  background: #fafbfc;
  cursor: default;
}
.menu-card-off:hover {
  border-color: var(--border);
  transform: none;
  box-shadow: var(--shadow-sm);
}

/* ---------- Hint Box ---------- */

.hint-box {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-soft);
}
.hint-box strong { color: var(--text); }

/* ---------- Footer ---------- */

.footer {
  margin-top: 3rem;
  padding: 1.25rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   登录页
   ============================================================ */

.login-card {
  max-width: 420px;
  margin: 5vh auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
  overflow: hidden;
}
.login-card-inner { padding: 2.5rem 2rem 1.75rem; }

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-mark {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  border-radius: 14px;
  font-size: 28px;
  margin-bottom: 0.875rem;
  box-shadow: 0 8px 24px rgba(37,99,235,0.25);
}
.login-title {
  font-size: 1.375rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.25rem;
}
.login-subtitle {
  color: var(--text-soft);
  font-size: 0.875rem;
}

.alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fee2e2;
}
.alert-icon { font-size: 1rem; }

.login-form { margin-bottom: 1.5rem; }
.field { margin-bottom: 1rem; }
.field-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 0.375rem;
  font-weight: 500;
}
.field-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
  text-decoration: none;
}
.btn-block { width: 100%; }

.login-hint {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border);
  font-size: 0.8rem;
  color: var(--text-soft);
}
.login-hint summary {
  cursor: pointer;
  padding: 0.25rem 0;
  font-weight: 500;
  user-select: none;
}
.login-hint summary:hover { color: var(--primary); }
.hint-table {
  width: 100%;
  margin-top: 0.625rem;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.hint-table th, .hint-table td {
  padding: 0.375rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.hint-table th { color: var(--text-soft); font-weight: 500; }
.hint-table td:first-child { font-family: "SF Mono", Menlo, monospace; color: #374151; }

/* ============================================================
   通用业务组件（列表页 / 表单页）
   ============================================================ */

/* ---------- 面包屑 ---------- */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.breadcrumb a { color: var(--text-soft); }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb .sep { color: #d1d5db; }

/* ---------- 带操作区的页头 ---------- */

.page-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

/* ---------- 按钮变体 ---------- */

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  text-decoration: none;
}
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  background: #b91c1c;
  text-decoration: none;
}
.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 5px;
}
.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  padding: 0;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.btn-link-danger { color: var(--danger); }
.btn[disabled], .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- 工具条（搜索 / 筛选） ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.toolbar-input, .toolbar-select {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.toolbar-input:focus, .toolbar-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.toolbar-input { min-width: 200px; }
.toolbar-spacer { flex: 1; }
.toolbar-count {
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* ---------- 数据表格 ---------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-scroll { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table thead th {
  background: #fafbfc;
  color: var(--text-soft);
  font-weight: 500;
  font-size: 0.78rem;
  text-align: left;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 0.7rem 0.875rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table th.num, .data-table td.num { text-align: right; font-feature-settings: "tnum"; }
.data-table th.mid, .data-table td.mid { text-align: center; }
.data-table td.mono {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: #374151;
  white-space: nowrap;   /* 单号 / SKU 编码不折行 */
}
.data-table td.muted { color: var(--text-muted); }
.data-table .row-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  white-space: nowrap;
}

/* ---------- 状态徽章 ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}
.pill-gray   { background: #f3f4f6; color: #4b5563; }
.pill-blue   { background: #eff6ff; color: var(--primary); }
.pill-green  { background: #f0fdf4; color: var(--success); }
.pill-amber  { background: #fffbeb; color: var(--warn); }
.pill-red    { background: #fef2f2; color: var(--danger); }

/* ---------- 空状态 ---------- */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}
.empty-title {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-bottom: 0.375rem;
}
.empty-hint { font-size: 0.8rem; }

/* ---------- 表单 ---------- */

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  max-width: 880px;
}
.form-section {
  font-size: 0.85rem;
  font-weight: 500;
  color: #111827;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-soft);
}
.form-section:not(:first-child) { margin-top: 1.75rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem 1.25rem;
}
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-full { grid-column: 1 / -1; }

.form-field { display: flex; flex-direction: column; }
.form-label {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-weight: 500;
  margin-bottom: 0.375rem;
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}
.form-actions {
  display: flex;
  gap: 0.625rem;
  align-items: center;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-soft);
}

/* ---------- 提示条 ---------- */

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #dcfce7;
}
.alert-warn {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fef3c7;
}
.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #dbeafe;
}

/* ---------- 详情页描述列表 ---------- */

.desc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem 1.5rem;
}
.desc-item { }
.desc-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.desc-value {
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-word;
}
.desc-value.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 0.82rem; }

/* ---------- 明细行编辑表（入库/出库单） ---------- */

.items-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.items-editor table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.items-editor thead th {
  background: #fafbfc;
  color: var(--text-soft);
  font-weight: 500;
  font-size: 0.75rem;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.items-editor tbody td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border-soft);
}
.items-editor tbody tr:last-child td { border-bottom: none; }
.items-editor input, .items-editor select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.82rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.items-editor input:focus, .items-editor select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ---------- 汇总条 ---------- */

.summary-bar {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
  padding: 0.875rem 1rem;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}
.summary-item { display: flex; flex-direction: column; }
.summary-label { font-size: 0.72rem; color: var(--text-muted); }
.summary-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: #111827;
  font-feature-settings: "tnum";
}

/* ---------- 分页 ---------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  font-size: 0.85rem;
}
.pagination a, .pagination span {
  padding: 0.35rem 0.7rem;
  border-radius: 5px;
  color: var(--text-soft);
}
.pagination a:hover { background: #f3f4f6; text-decoration: none; }
.pagination .current { background: var(--primary); color: white; }

/* ---------- 详情描述项跨列 ---------- */

.desc-grid .span-full { grid-column: 1 / -1; }

/* ---------- 文字颜色辅助 ---------- */

.text-danger,
.data-table td.text-danger { color: var(--danger) !important; font-weight: 600; }
.text-success { color: var(--success); }
.text-warn { color: var(--warn); }
.muted { color: var(--text-muted); font-size: 0.85em; }

/* ---------- 视图切换 tab ---------- */

.tab-bar {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.tab-bar .tab {
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-bar .tab:hover { color: var(--text); text-decoration: none; }
.tab-bar .tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

/* 表格内链接形式的单号/编码：不折行（移动端尤其明显） */
.data-table td a.mono { white-space: nowrap; }

/* ---------- 操作卡片网格（预存账户等） ---------- */

.op-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.875rem;
}
.op-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}
.op-card .op-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.op-card .op-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: -0.15rem 0 0.15rem;
  line-height: 1.4;
}
.op-card .span-full { width: 100%; box-sizing: border-box; }
.op-card button { align-self: flex-start; margin-top: 0.15rem; }

/* ---------- 行内表单（表格里的开户/操作） ---------- */

.inline-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}
.inline-form .toolbar-input { min-width: 0; flex: 1; }
.inline-form .toolbar-select { min-width: 76px; }

/* ---------- 下拉筛选框（toolbar 内） ---------- */

.toolbar-select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
}
.toolbar-label { font-size: 0.8rem; color: var(--text-soft); white-space: nowrap; }

/* ---------- 客户门户 ---------- */

.portal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.portal-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.82rem;
  white-space: nowrap;
  text-decoration: none;
}
.portal-nav-item:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}
.portal-nav-item.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
}
.pn-icon { font-size: 0.95rem; line-height: 1; }

/* ---------- 内容卡片（门户 / 票据 / 明细区块） ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
  overflow: hidden;
}
.card .section-title {
  margin: 0;
  padding: 0.8rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
}
.card > .table-wrap {
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow-x: auto;
}
.card > .table-hint {
  margin: 0;
  padding: 0.7rem 1.1rem 0.9rem;
}
.card > .empty-state { padding: 2.5rem 1.5rem; }

/* ---------- 表格补充 ---------- */

.table-hint { font-size: 0.78rem; color: var(--text-muted); line-height: 1.6; margin: 0.5rem 0 0; }
.data-table tfoot td { background: #fafbfc; }
.row-total td { background: #fafbfc; }
.row-urgent td { background: #fffdf6; }
.text-strong { font-weight: 600; color: var(--text); }
.notes-block {
  margin: 0;
  padding: 0.85rem 1.1rem;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-soft);
  white-space: pre-wrap;
  line-height: 1.6;
}

/* ---------- 提示条（警示变体） ---------- */

.hint-box.hint-warn {
  background: #fffbeb;
  border-left-color: var(--warn);
}
.hint-box.hint-warn strong { color: #92400e; }

/* ---------- 全局等宽（不限表格单元格） ---------- */

.mono {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

/* ============================================================
   移动端适配（≤ 640px）
   ============================================================ */

@media (max-width: 640px) {
  /* --- 顶栏：不折行，超长用户名省略 --- */
  .topbar-inner {
    height: auto;
    min-height: 52px;
    padding: 0.5rem 0.875rem;
    gap: 0.5rem;
    flex-wrap: nowrap;
  }
  .topbar-left { gap: 0.4rem; min-width: 0; }
  .topbar-right { gap: 0.5rem; flex-shrink: 0; }
  .brand-name { display: none; }          /* 窄屏只留图标 */
  .brand { flex-shrink: 0; }
  .role-badge { white-space: nowrap; flex-shrink: 0; }
  .role-meta { display: none; }           /* 客户名已在页面标题里 */
  .user-name {
    max-width: 78px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .btn-ghost { white-space: nowrap; flex-shrink: 0; }

  /* --- 容器与标题 --- */
  .container { padding: 1.25rem 0.875rem 2.5rem; }
  .page-header { margin-bottom: 1.1rem; }
  .page-title { font-size: 1.15rem; }
  .page-subtitle { font-size: 0.8rem; line-height: 1.5; }
  .page-header-row { flex-direction: column; align-items: stretch; gap: 0.75rem; }

  /* --- KPI 卡：固定两列 --- */
  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.625rem;
    margin-bottom: 1.25rem;
  }
  .kpi-card { padding: 0.75rem 0.875rem; }
  .kpi-num { font-size: 1.2rem; }
  .kpi-label { font-size: 0.7rem; }

  /* --- 菜单卡片：单列 --- */
  .menu-grid { grid-template-columns: 1fr; gap: 0.625rem; }

  /* --- 门户导航：横滑不换行 --- */
  .portal-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.6rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .portal-nav::-webkit-scrollbar { display: none; }
  .portal-nav-item { flex-shrink: 0; }

  /* --- 卡片与表格 --- */
  .card .section-title { padding: 0.7rem 0.875rem; font-size: 0.84rem; }
  .card > .table-hint { padding: 0.6rem 0.875rem 0.75rem; }
  .table-hint { font-size: 0.74rem; }
  .data-table { font-size: 0.8rem; }
  .data-table thead th { padding: 0.5rem 0.6rem; }
  .data-table td { padding: 0.5rem 0.6rem; }
  .card > .empty-state { padding: 1.75rem 1rem; }

  /* 表格：窄屏保持最小可读宽度，改由容器横向滑动，
     避免把「规格 / 时间」这类短列压成竖排单字 */
  .card > .table-wrap,
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .card > .table-wrap::-webkit-scrollbar,
  .table-scroll::-webkit-scrollbar { height: 6px; }
  /* 单元格不折行：表格宽度由内容决定，列多则整体横滑 */
  .data-table th,
  .data-table td { white-space: nowrap; }

  /* --- 工具条 --- */
  .toolbar { gap: 0.5rem; }
  .toolbar-input, .toolbar-select { flex: 1 1 auto; min-width: 0; }

  /* --- 表单网格：单列（含 span-2 / span-full 重置） --- */
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2,
  .form-grid .span-full { grid-column: 1 / -1; }
  .desc-grid, .op-grid { grid-template-columns: 1fr; }
  .summary-bar { gap: 1.25rem; }

  /* --- 表单按钮组 --- */
  .form-actions { flex-wrap: wrap; }

  /* --- 登录卡 --- */
  .login-card { margin: 1.5rem auto; }
}