@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

/* ================= 主题变量 ================= */
:root {
  --bg: #0c0e12;
  --surface: #14171e;
  --surface2: #1a1e28;
  --border: #252a35;
  --border-light: #333a48;
  --text: #d4d8e0;
  --dim: #6b7280;
  --accent: #c9a55a;
  --accent-dim: #9e7c34;
  --btn-primary-text: #14120a;
  --danger: #e05252;
  --radius: 6px;
  --header-bg: rgba(12, 14, 18, .85);
  --shadow: 0 24px 64px rgba(0, 0, 0, .6);
  --c-wait: #5b8dd6;
  --c-ship: #4fb0a0;
  --glow-a: rgba(201, 165, 90, .06);
  --glow-b: rgba(100, 120, 180, .05);
  /* 公开页「降温」主题:红(高温)→蓝(低温) */
  --hot: #e0524f;
  --warm: #e08a3c;
  --sky: #55a6d8;
  --cool: #4f7fe0;
  --glow-hot: rgba(224, 82, 79, .07);
  --glow-cool: rgba(79, 127, 224, .07);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f6f3ec;
  --surface: #fdfbf6;
  --surface2: #f0ebde;
  --border: #e2dbc9;
  --border-light: #cbc0a5;
  --text: #2b2721;
  --dim: #8a8172;
  --accent: #9e7c34;
  --accent-dim: #7c5f22;
  --btn-primary-text: #fdfbf6;
  --danger: #c03d3d;
  --header-bg: rgba(246, 243, 236, .85);
  --shadow: 0 24px 64px rgba(70, 55, 20, .18);
  --c-wait: #3e69ae;
  --c-ship: #2f8a7a;
  --glow-a: rgba(158, 124, 52, .08);
  --glow-b: rgba(90, 110, 170, .06);
  --hot: #c03d3c;
  --warm: #b06a1e;
  --sky: #2e7fae;
  --cool: #3560c0;
  --glow-hot: rgba(192, 61, 60, .09);
  --glow-cool: rgba(53, 96, 192, .08);
  color-scheme: light;
}

/* ================= 基础 ================= */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 600px 400px at 20% 30%, var(--glow-a), transparent),
    radial-gradient(ellipse 500px 500px at 80% 70%, var(--glow-b), transparent);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, serif;
  font-size: 15px;
  line-height: 1.75;
  display: flex;
  flex-direction: column;
}

.mono { font-family: "JetBrains Mono", Consolas, monospace; }

a { color: var(--accent); text-decoration: none; }

.container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 24px 64px;
  flex: 1;
}

/* ================= 顶栏 ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  color: var(--dim);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 14px;
  transition: color .15s;
  white-space: nowrap;
}

.nav a:hover { color: var(--accent); }

.theme-toggle {
  width: 32px;
  height: 32px;
  margin-left: 6px;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  background: transparent;
  color: var(--dim);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  transition: color .15s, border-color .15s;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle::after { content: "☀"; }
html[data-theme="light"] .theme-toggle::after { content: "☾"; }

/* ================= 通用组件 ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
  transition: border-color .15s;
}

a.card { display: block; color: var(--text); }
a.card:hover { border-color: var(--border-light); }

.page-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}

.section-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  letter-spacing: 1px;
}

.hint { color: var(--dim); font-size: 13px; margin-top: 8px; }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--dim);
  padding: 48px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.back-link { display: inline-block; color: var(--dim); font-size: 14px; margin-bottom: 16px; transition: color .15s; }
.back-link:hover { color: var(--accent); }

/* 提示条 */
.flash {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}

.flash-error { border-left-color: var(--danger); color: var(--danger); }
.flash-warning { border-left-color: #d1943f; }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
  white-space: nowrap;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--btn-primary-text);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: var(--btn-primary-text);
}

.btn-danger { border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }

.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ================= 表单 ================= */
input[type="text"],
input[type="search"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  transition: border-color .15s;
}

input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

textarea { resize: vertical; line-height: 1.8; }

input[type="file"] { color: var(--dim); font-size: 13.5px; max-width: 100%; }

input[type="file"]::file-selector-button {
  padding: 7px 14px;
  margin-right: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

input[type="file"]::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.field label {
  display: block;
  color: var(--dim);
  font-size: 13px;
  margin-bottom: 6px;
}

.field-full { grid-column: 1 / -1; }

.form-actions { margin-top: 20px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ================= 搜索与工具栏 ================= */
.searchbar { display: flex; gap: 10px; margin-bottom: 20px; }
.searchbar input { flex: 1; }

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.toolbar form { display: flex; gap: 10px; flex: 1; min-width: 220px; }
.toolbar form input { flex: 1; }

/* ================= 状态徽章 ================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid currentColor;
  border-radius: 20px;
  font-size: 12.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.st-wait { color: var(--c-wait); }
.st-work { color: var(--accent); }
.st-ship { color: var(--c-ship); }
.st-done { color: var(--dim); }

/* ================= 订单卡片 ================= */
.order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.order-card { margin-bottom: 0; }

.order-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nick { font-weight: 600; }

.cpu-model {
  color: var(--accent);
  font-size: 19px;
  font-weight: 600;
  margin: 8px 0 10px;
  letter-spacing: .5px;
}

.order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  color: var(--dim);
  font-size: 13px;
}

.order-tracking { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--dim); font-size: 13px; }
.order-tracking .mono { font-size: 12.5px; }

/* ================= 详情信息 ================= */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 28px;
  margin: 16px 0 0;
}

.info-grid dt { color: var(--dim); font-size: 13px; margin-bottom: 2px; }
.info-grid dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }

.intro-text { white-space: pre-line; margin-top: 4px; }

/* ================= 服务过程时间线 ================= */
.timeline { margin-top: 4px; }

.tl-item {
  position: relative;
  margin: 0 0 0 12px;
  padding: 0 0 30px 30px;
  border-left: 1px solid var(--border);
}

.tl-item:last-child { border-left-color: transparent; padding-bottom: 4px; }

.tl-num {
  position: absolute;
  left: -14px;
  top: 0;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tl-caption {
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 10px;
  padding-top: 2px;
}

.tl-item a { display: block; }

.tl-item img {
  width: 100%;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: zoom-in;
}

/* ================= 公开页:降温主题(红 → 蓝) ================= */
body.public {
  background-image:
    radial-gradient(ellipse 620px 420px at 14% 18%, var(--glow-hot), transparent),
    radial-gradient(ellipse 620px 520px at 86% 82%, var(--glow-cool), transparent);
}

.thermal-title { color: var(--text); }

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .thermal-title {
    background: linear-gradient(92deg, var(--hot) 8%, var(--cool) 92%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}

.public .btn-primary {
  background: linear-gradient(92deg, var(--hot), var(--cool));
  border-color: transparent;
  color: #fff;
}

.public .btn-primary:hover {
  background: linear-gradient(92deg, var(--hot), var(--cool));
  border-color: transparent;
  color: #fff;
  filter: brightness(1.12);
}

/* 状态即温度:待收件最热,越接近完成越冷 */
.public .st-wait { color: var(--hot); }
.public .st-work { color: var(--warm); }
.public .st-ship { color: var(--sky); }
.public .st-done { color: var(--cool); }

/* 降温进度条:整条为红→蓝渐变,右侧未达到的部分被遮罩压暗 */
.cool-bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 14px;
  background: linear-gradient(90deg, var(--hot), var(--warm) 38%, var(--sky) 70%, var(--cool));
}

.cool-mask {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  opacity: .85;
  border-left: 1px solid var(--border);
}

.cool-bar-labels {
  display: flex;
  justify-content: space-between;
  color: var(--dim);
  font-size: 12px;
  margin-top: 6px;
}

/* 服务过程时间线:主线从热到冷,节点颜色随步骤推进降温 */
.public .timeline { position: relative; }

.public .timeline::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 13px;
  bottom: 13px;
  width: 2px;
  background: linear-gradient(180deg, var(--hot), var(--cool));
}

.public .tl-item { border-left-color: transparent; }
.public .tl-num { background: var(--surface); }

@supports (color: color-mix(in srgb, red 50%, blue)) {
  .public .tl-num {
    border-color: color-mix(in srgb, var(--cool) calc(var(--tp, 1) * 100%), var(--hot));
    color: color-mix(in srgb, var(--cool) calc(var(--tp, 1) * 100%), var(--hot));
  }
  .public .tl-caption {
    color: color-mix(in srgb, var(--cool) calc(var(--tp, 1) * 100%), var(--hot));
  }
}

/* ================= 后台照片管理 ================= */
.upload-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.upload-form input[type="file"] { flex: 1 1 240px; }
.upload-form select { width: auto; min-width: 170px; }

.sort-status { color: var(--accent); font-size: 13px; min-height: 20px; margin-top: 10px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 6px;
}

.photo-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s, opacity .15s;
}

.photo-card.dragging { opacity: .5; border-color: var(--accent); }

.photo-card > img { width: 100%; height: 150px; object-fit: cover; display: block; }

.photo-body { padding: 12px; }

.photo-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.photo-index {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.photo-head .spacer { flex: 1; }

.drag-hint { color: var(--dim); font-size: 12px; cursor: grab; user-select: none; }

.caption-form select { margin-bottom: 8px; }
.caption-form .caption-row { display: flex; gap: 8px; }
.caption-form .caption-row input { flex: 1; }

.photo-foot {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.photo-foot .spacer { flex: 1; }
.photo-foot form { display: inline; }

/* ================= 设置页 chips ================= */
.chip-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 16px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 6px 5px 14px;
  font-size: 14px;
}

.chip form { display: inline-flex; }

.chip button {
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 50%;
  transition: color .15s;
}

.chip button:hover { color: var(--danger); }

.chip-add { display: flex; gap: 10px; max-width: 440px; }
.chip-add input { flex: 1; }

/* ================= 登录页 ================= */
.login-wrap { max-width: 380px; margin: 48px auto 0; }
.login-wrap .card { padding: 32px; }
.login-wrap .page-title { text-align: center; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--dim); font-size: 13px; margin: 0 0 22px; }

/* ================= 弹窗 ================= */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  padding: 20px;
}

.modal.active { display: flex; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
}

.modal-title { margin: 0 0 10px; color: var(--accent); font-size: 18px; }
.modal-text { margin: 0 0 24px; line-height: 1.8; overflow-wrap: anywhere; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; }

/* ================= 页脚 ================= */
.footer {
  text-align: center;
  color: var(--dim);
  font-size: 13px;
  padding: 28px 24px;
  border-top: 1px solid var(--border);
  letter-spacing: 1px;
}

/* ================= 响应式 ================= */
@media (max-width: 640px) {
  .container { padding: 20px 16px 48px; }
  .topbar-inner { padding: 0 16px; }
  .brand { font-size: 15px; letter-spacing: 1px; }
  .nav a { padding: 6px 7px; font-size: 13.5px; }
  .form-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .order-grid { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; }
  .modal-box { padding: 24px 20px; }
  .searchbar { flex-wrap: wrap; }
  .searchbar input { min-width: 100%; }

  /* 手机输入框保持 16px,避免 iOS 聚焦时自动放大页面 */
  input[type="text"], input[type="search"], input[type="date"],
  input[type="password"], select, textarea { font-size: 16px; }

  /* 后台工具栏与表单按钮全宽,方便拇指操作 */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar > .btn { width: 100%; }
  .form-actions .btn { flex: 1; min-height: 44px; }

  /* 照片上传:控件竖排全宽 */
  .upload-form { flex-direction: column; align-items: stretch; }
  .upload-form select { min-width: 0; width: 100%; }
  .upload-form .btn { width: 100%; min-height: 44px; }

  /* 照片卡片单列,排序按钮加大;触屏隐藏拖拽提示 */
  .photo-grid { grid-template-columns: 1fr; }
  .photo-card > img { height: 190px; }
  .drag-hint { display: none; }
  .photo-foot { gap: 10px; }
  .photo-foot .move-up, .photo-foot .move-down { flex: 1; padding: 10px 0; font-size: 16px; }
  .caption-form .caption-row .btn { padding: 10px 16px; }
  .chip button { padding: 6px 10px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
