:root {
  --bg: #f5f6f1;
  --panel: #fff;
  --ink: #172218;
  --muted: #68746b;
  --line: #dde3d8;
  --primary: #20734a;
  --primary-dark: #175b3a;
  --deep: #173c2a;
  --mint: #e2e7df;
  --amber: #a45b18;
  --amber-bg: #fbf1e5;
  --red: #a73b30;
  --red-bg: #f4dedb;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; }
a { color: var(--primary); text-decoration: none; }

/* 登录 */
.login-screen {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px 18px;
  background: radial-gradient(120% 80% at 80% 0%, #38725a 0%, transparent 55%),
              linear-gradient(165deg, #123528 0%, #1e4d3a 48%, #173f2f 100%);
}
.login-card {
  width: 100%; max-width: 420px; padding: 26px 20px 22px;
  border-radius: 26px; background: rgba(255,255,255,.97);
  box-shadow: 0 30px 80px rgba(0,20,12,.35);
}
.login-brand { display: flex; align-items: center; gap: 13px; }
.login-logo {
  width: 52px; height: 52px; border-radius: 15px; background: var(--primary);
  color: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 700;
}
.login-brand h1 { margin: 0; font-size: 22px; }
.login-brand p { margin: 1px 0 0; color: var(--primary); font-size: 12px; font-weight: 600; letter-spacing: 2px; }
.login-desc { margin: 16px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { color: #496055; font-size: 12.5px; font-weight: 600; }
.field input {
  width: 100%; height: 50px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 13px; background: #f8faf8; outline: none;
}
.field input:focus { border-color: var(--primary); background: #fff; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 18px; border-radius: var(--radius); font-weight: 700;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(32,115,74,.22); }
.btn-primary:active { background: var(--primary-dark); }
.btn-secondary { background: var(--mint); color: var(--primary-dark); }
.btn-lg { width: 100%; min-height: 54px; font-size: 17px; }
.login-error { margin: 10px 0 0; padding: 9px 11px; border-radius: 10px; background: #fff0ed; color: var(--red); font-size: 13px; font-weight: 700; text-align: center; }

/* 顶栏 */
.app { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 84px; }
.topbar {
  background: var(--deep); color: #fff; padding: 18px 18px 26px;
  border-radius: 0 0 22px 22px;
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; }
.topbar h1 { margin: 0; font-size: 21px; }
.topbar p { margin: 4px 0 0; color: #b7c9b9; font-size: 12.5px; }
.topbar .back { background: rgba(255,255,255,.14); color: #fff; width: 36px; height: 36px; border-radius: 50%; font-size: 18px; }
.topbar .t-btn { background: rgba(255,255,255,.14); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; }

.wrap { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--panel); border-radius: 18px; padding: 18px; box-shadow: 0 6px 20px rgba(23,60,42,.06); }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* 订单卡 */
.order-card { display: flex; flex-direction: column; gap: 10px; }
.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.order-head b { font-size: 16px; }
.order-meta { color: var(--muted); font-size: 12.5px; }
.ring-row { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 76px; height: 76px; flex: 0 0 auto; }
.ring svg { transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 17px; }
.seg { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: #eef1ea; }
.seg i { display: block; height: 100%; }
.seg .ok { background: var(--primary); }
.seg .wait { background: #d9a441; }
.seg .bad { background: #c0564a; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.legend .l-ok::before { background: var(--primary); }
.legend .l-wait::before { background: #d9a441; }
.legend .l-bad::before { background: #c0564a; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.ok { background: #dbefd8; color: #177243; }
.badge.partial { background: #fff3d6; color: #9a6812; }
.badge.short { background: var(--red-bg); color: var(--red); }
.badge.waiting { background: var(--amber-bg); color: var(--amber); }

/* 板件行 */
.part-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.part-row:last-child { border-bottom: 0; }
.check {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: 8px;
  border: 2px solid #c9d5c9; background: #fff; display: grid; place-items: center;
  font-size: 15px; color: transparent;
}
.check.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.part-main { flex: 1; min-width: 0; }
.part-main b { display: block; font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-main small { color: var(--muted); font-size: 12px; }

/* 上传 */
.drop {
  border: 2px dashed #b7cbbb; border-radius: 16px; padding: 26px 18px;
  text-align: center; color: var(--primary); background: #fbfcf9;
}
.drop input { display: none; }
.drop b { display: block; font-size: 15px; margin-bottom: 4px; }
.drop span { color: var(--muted); font-size: 12.5px; }

/* 底栏 */
.footer-bar {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, #f5f6f1 65%, rgba(245,246,241,0));
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex;
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; background: none; color: var(--muted); padding: 10px 4px 8px;
  font-size: 12px; display: grid; gap: 3px; place-items: center;
}
.tabbar button i { font-size: 19px; font-style: normal; }
.tabbar button.active { color: var(--primary); font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: #173c2a; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; transition: opacity .2s ease; z-index: 60; pointer-events: none;
}
.toast.show { opacity: 1; }
