/* ─── 共享基础样式 ─────────────────────────────────────────────────────────
   供 admin.html / wholesale/index.html / orders/index.html 引用
   各页面样式表只需补充页面特有的样式 */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-hover: #f9fafb;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --line-light: #eef2f7;
  --pill-bg: #f3f4f6;
  --focus-ring: #9ca3af;
  --text: #111827;
  --muted: #6b7280;
  --primary: #111827;
  --success: #15803d;
  --warn: #b45309;
  --danger: #dc2626;
  --shadow: 0 18px 40px rgba(17, 24, 39, 0.06);
  --radius: 22px;
  --radius-sm: 14px;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

h1, h2, h3, p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

/* 屏幕阅读器专用：视觉隐藏但保持可交互 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

input,
textarea,
select,
button {
  font: inherit;
  max-width: 100%;
}

/* ─── 公共组件 ──────────────────────────────────────────────────────────── */

/* 卡片 / 面板基础样式 */
.topbar,
.panel,
.panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* 常用布局 */
.shell,
.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 20px auto 36px;
}

/* 表格公共 */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--line-light);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

/* 标签 */
.pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--pill-bg);
  font-weight: 700;
}

/* 按钮基础 */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  min-height: 40px;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

button:hover:not(:disabled),
.btn:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-1px);
}

button:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 主按钮 */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* 危险按钮 */
.btn-danger {
  color: var(--danger);
}

/* 表单输入 */
input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 4px rgba(156, 163, 175, 0.15);
}

/* 状态文字 */
.status {
  min-height: 22px;
  margin-top: 8px;
  color: var(--muted);
}

.status.success {
  color: var(--success);
}

.status.warn {
  color: var(--warn);
}

/* 消息 */
.message {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--success);
}

/* 未匹配面板 */
.unmatched-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  overflow: hidden;
}

.unmatched-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.unmatched-badge {
  font-size: 12px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--line);
  color: var(--text);
}

.unmatched-table-wrap {
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
}

.unmatched-table {
  width: 100%;
  table-layout: fixed;
}

.unmatched-table th,
.unmatched-table td {
  padding: 8px 6px;
  font-size: 12px;
  white-space: normal;
  word-break: break-word;
}
