/* 下单退货平台 · 移动端优先样式表
   纯手写 CSS，无外部依赖，无构建工具。 */

:root {
  --bg: #f2f4f7;
  --bg-card: #ffffff;
  --text: #1a1d29;
  --text-muted: #6b7280;
  --border: #e3e6ea;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 20, 43, 0.06), 0 1px 2px rgba(20, 20, 43, 0.04);

  --info: #2563eb;
  --info-bg: #e8edfd;
  --warn: #b45309;
  --warn-bg: #fef3e0;
  --success: #15803d;
  --success-bg: #e3f6e9;
  --danger: #b91c1c;
  --danger-bg: #fde8e8;
  --neutral: #4b5563;
  --neutral-bg: #eceff2;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161f;
    --bg-card: #1e2130;
    --text: #eceef2;
    --text-muted: #98a0b3;
    --border: #2d3142;
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);

    --info: #93c5fd;
    --info-bg: #1e2b4d;
    --warn: #fbbf24;
    --warn-bg: #3f2f0d;
    --success: #86efac;
    --success-bg: #133821;
    --danger: #fca5a5;
    --danger-bg: #3f1414;
    --neutral: #b3b9c6;
    --neutral-bg: #262a38;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

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

h1 { font-size: 20px; margin: 4px 0 14px; }
h2 { font-size: 16px; margin: 22px 0 10px; color: var(--text-muted); }

.container { max-width: 720px; margin: 0 auto; padding: 12px 14px 32px; }
.container.wide { max-width: 1100px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px;
  padding-top: 10px; padding-bottom: 10px;
}
.topbar-brand { font-weight: 700; font-size: 15px; margin-right: auto; }
.topbar-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; order: 3; flex-basis: 100%; }
.topbar-nav a { font-size: 14px; color: var(--text); padding: 6px 2px; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px;
  border-radius: 10px; border: 1px solid transparent;
  background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; min-height: 36px; padding: 0 8px; font-weight: 500; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }

/* ---------- 表单 ---------- */
form .field { margin-bottom: 14px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text);
  font-size: 16px; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
form.inline { display: inline-block; }
.card-form { padding-top: 4px; }

details.upload-fallback { margin-top: 6px; }
details.upload-fallback summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
details.upload-fallback input { margin-top: 8px; }

.file-btn-wrap { position: relative; }
.file-btn-label {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; border-radius: 10px; border: 1px dashed var(--primary);
  color: var(--primary); font-weight: 600; font-size: 15px; cursor: pointer;
  background: var(--info-bg);
}
.file-btn-wrap input[type="file"] {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer;
}
.upload-status { font-size: 13px; color: var(--text-muted); margin-top: 6px; min-height: 18px; }

/* ---------- 卡片 / 订单卡片 ---------- */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px;
}
.order-card-list { display: flex; flex-direction: column; gap: 12px; }
.order-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.order-card-title { font-weight: 700; font-size: 15px; }
.order-card-meta { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.order-card-hint { font-size: 13px; margin-top: 10px; color: var(--primary); }
.order-card-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.order-card-actions form { width: 100%; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); }

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center; padding: 48px 16px; color: var(--text-muted);
  background: var(--bg-card); border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty-state .emoji { font-size: 32px; display: block; margin-bottom: 8px; }

/* ---------- 提示 / flash ---------- */
.flash {
  list-style: none; margin: 0 0 16px; padding: 12px 14px;
  border-radius: 10px; background: var(--warn-bg); color: var(--warn);
  border: 1px solid var(--warn); font-size: 14px;
}
.flash li + li { margin-top: 6px; }
.error-text { color: var(--danger); font-weight: 600; margin: 10px 0; }

/* ---------- 表格（管理员） ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--bg); font-weight: 700; color: var(--text-muted); }
tr:last-child td { border-bottom: none; }

/* ---------- 指标卡片（管理员看板） ---------- */
.stats-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 20px; }
.stat-card { flex: 1 1 130px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.stat-card .num { font-size: 24px; font-weight: 700; }
.stat-card .label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.section-danger h2 { color: var(--danger); }
.section-danger .table-wrap { border-color: var(--danger); }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 360px; background: var(--bg-card);
  border-radius: 16px; box-shadow: var(--shadow); padding: 28px 24px;
  border: 1px solid var(--border);
}
.login-card h1 { text-align: center; margin-bottom: 20px; }

/* ---------- 工具类 ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar select, .toolbar input { width: auto; min-width: 140px; }
.filter-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filter-form .field { margin-bottom: 0; }
.back-link { display: inline-block; margin: 14px 0; }
.muted { color: var(--text-muted); font-size: 13px; }

@media (max-width: 480px) {
  .toolbar select, .toolbar input { width: 100%; }
}
