/* 白菜识别计价器 · PHP 批量版 —— 界面样式 */
:root {
  --green: #2e7d52;
  --green-dark: #1f5c3b;
  --green-light: #e8f3ec;
  --green-mid: #43a86c;
  --orange: #e08a34;
  --orange-light: #fdf1e3;
  --red: #c8533f;
  --ink: #22302a;
  --ink-2: #5b6b62;
  --ink-3: #8a9a90;
  --line: #e3ebe5;
  --bg: #f4f7f3;
  --card: #ffffff;
  --shadow: 0 6px 26px rgba(31, 92, 59, .07);
  --shadow-lg: 0 24px 70px rgba(20, 55, 36, .26);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 15% -10%, #e9f4ec 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, #f0f6ee 0%, transparent 55%), var(--bg);
  color: var(--ink); min-height: 100vh; -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 28px; background: rgba(255,255,255,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand .logo {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  background: linear-gradient(145deg, #3fa970, #1f6b43);
  display: grid; place-items: center; box-shadow: 0 4px 12px rgba(46,125,82,.25);
}
.brand h1 { margin: 0; font-size: 18px; letter-spacing: .3px; font-weight: 700; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.tag { display: inline-block; vertical-align: 2px; margin-left: 6px; padding: 2px 7px;
  border-radius: 6px; background: var(--green-light); color: var(--green-dark);
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px; }
.top-meta { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink-2); }
.pill { padding: 5px 11px; border-radius: 20px; background: var(--green-light);
  color: var(--green-dark); font-weight: 600; font-size: 11.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c9d4cc; box-shadow: 0 0 0 3px rgba(201,212,204,.3); }
.dot.ok { background: #3fb56d; box-shadow: 0 0 0 3px rgba(63,181,109,.18); }
.dot.off { background: #e0a13a; box-shadow: 0 0 0 3px rgba(224,161,58,.18); }

/* ---------- 主体 ---------- */
.wrap { max-width: 1420px; margin: 0 auto; padding: 22px 28px 40px; }
.hero {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .8fr); gap: 16px;
  align-items: stretch;
}
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 16px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px;
}
.stat span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.stat strong { font-size: 27px; line-height: 1.15; font-weight: 750; color: var(--green-dark);
  font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.stat em { font-style: normal; font-size: 11.5px; color: var(--ink-3); margin-left: 2px; }
.stat:last-child strong { color: var(--orange); font-size: 24px; }
.hero-side {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 15px 17px; box-shadow: var(--shadow);
}
.convert { font-size: 12.5px; color: var(--ink-2); margin-bottom: 11px; font-weight: 600; }
.formula { font-size: 11.5px; color: var(--ink-3); margin-top: 9px; font-variant-numeric: tabular-nums; }

/* ---------- 留存条 ---------- */
.retention {
  margin-top: 16px; display: flex; align-items: center; gap: 13px;
  padding: 12px 16px; border: 1px solid #d9e9de; border-radius: 12px;
  background: linear-gradient(120deg, #f1f9f3, #eaf5ee);
}
.rt-icon { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: #d9efe1; color: var(--green-dark); font-size: 17px; font-weight: 700; }
.retention div { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.retention strong { font-size: 13px; color: var(--green-dark); }
.retention span { font-size: 11.5px; color: var(--ink-2); }
.rt-right { font-size: 12px; font-weight: 700; color: var(--green-dark); white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.rt-right.warn { color: #a4621c; }

/* ---------- 工具条 ---------- */
.toolbar {
  margin-top: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 13px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 9px; padding: 9px 14px; font-size: 12.5px; font-weight: 600;
  transition: .15s; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover:not(:disabled) { border-color: var(--green-mid); background: #f7fcf8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff;
  box-shadow: 0 3px 10px rgba(46,125,82,.22); }
.btn.primary:hover:not(:disabled) { background: var(--green-dark); border-color: var(--green-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.danger:hover:not(:disabled) { border-color: var(--red); background: #fdf5f3; }
.btn.add { width: 100%; border-style: dashed; color: var(--green-dark); margin-top: 10px; }
.spacer { flex: 1; }
select, input[type=number], input[type=text] {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: #fff; color: var(--ink); font-size: 12.5px; outline: none; min-width: 0;
}
select:focus, input:focus { border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(67,168,108,.12); }

/* ---------- 进度 / 提示 ---------- */
.progress { margin-top: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: 11px; padding: 11px 14px; }
.pg-top { display: flex; justify-content: space-between; font-size: 12.5px;
  color: var(--ink-2); font-weight: 600; margin-bottom: 8px; }
.pg-bar { height: 6px; background: var(--green-light); border-radius: 6px; overflow: hidden; }
.pg-bar i { display: block; height: 100%; width: 0; border-radius: 6px;
  background: linear-gradient(90deg, var(--green-mid), var(--green)); transition: width .3s; }
.notice { margin-top: 12px; border-radius: 10px; padding: 11px 14px; font-size: 12.5px;
  background: var(--green-light); color: var(--green-dark); border: 1px solid #cfe6d7; line-height: 1.6; }
.notice.warn { background: var(--orange-light); color: #95591a; border-color: #f0d8b8; }
.notice.err { background: #fdf0ee; color: #a5432f; border-color: #f2d2cb; }

/* ---------- 照片网格 ---------- */
.gallery-head { margin: 24px 0 12px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.gallery-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.gallery-head .cnt { font-size: 11.5px; color: var(--green-dark); background: var(--green-light);
  border-radius: 12px; padding: 2px 9px; margin-left: 6px; vertical-align: 2px; }
.gallery-head .hint, .hint { font-size: 11.5px; color: var(--ink-3); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 16px; }
.gallery-empty {
  grid-column: 1 / -1; border: 2px dashed #d8e6dc; border-radius: 16px;
  padding: 54px 20px; text-align: center; color: var(--ink-3); background: rgba(255,255,255,.5);
}
.gallery-empty svg { opacity: .75; }
.gallery-empty strong { display: block; margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.gallery-empty p { margin: 5px 0 0; font-size: 12px; }
.photo-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; transition: .18s; position: relative;
}
.photo-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(31,92,59,.14);
  border-color: var(--green-mid); }
.pc-shot { position: relative; aspect-ratio: 4 / 3; background: #eef3ef; overflow: hidden; }
.pc-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-badge { position: absolute; top: 9px; left: 9px; background: rgba(31,92,59,.9); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 7px; letter-spacing: .3px; }
.pc-pending { position: absolute; top: 9px; right: 9px; background: var(--orange); color: #fff;
  font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 7px; }
.pc-body { padding: 11px 12px 12px; }
.pc-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-bottom: 8px; }
.pc-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pc-metrics { font-size: 11.5px; color: var(--ink-2); }
.pc-metrics b { color: var(--green-dark); font-size: 15px; font-variant-numeric: tabular-nums; }
.pc-expire { font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; margin-top: 7px; }
.pc-expire.warn { color: #a4621c; font-weight: 700; }
.drop-hint { text-align: center; font-size: 11.5px; color: var(--ink-3); margin-top: 20px; }
body.dragover .wrap::after {
  content: '松开即可批量上传照片'; position: fixed; inset: 12px; z-index: 60;
  border: 3px dashed var(--green-mid); border-radius: 18px; background: rgba(232,243,236,.9);
  display: grid; place-items: center; font-size: 20px; font-weight: 700; color: var(--green-dark);
  pointer-events: none;
}

/* ---------- 通用小组件 ---------- */
.section-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.section-title h3 { margin: 0; font-size: 14px; font-weight: 700; }
.section-title span { font-size: 11.5px; color: var(--orange); font-weight: 600; }
.pricing-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 11px; color: var(--ink-2); font-weight: 600; }
.field select, .field input { width: 100%; }
.legend { display: flex; gap: 15px; flex-wrap: wrap; font-size: 11px; color: var(--ink-2); margin-top: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.cabbage { border: 2px solid var(--green-mid); background: rgba(67,168,108,.15); }
.sw.label { border: 2px dashed var(--orange); }
.sw.pending { border: 2px solid var(--orange); background: var(--orange-light); }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(18, 38, 27, .55); backdrop-filter: blur(3px); }
.modal-box { position: relative; width: min(1240px, 100%); max-height: 94vh; background: #fff;
  border-radius: 18px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 16px 20px; border-bottom: 1px solid var(--line); flex: none; }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-head p { margin: 4px 0 0; font-size: 11.5px; color: var(--ink-3); }
.close { border: none; background: #f2f6f3; color: var(--ink-2); width: 32px; height: 32px;
  border-radius: 9px; font-size: 21px; line-height: 1; flex: none; }
.close:hover { background: #e5ede7; color: var(--ink); }
.modal-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .92fr);
  gap: 20px; padding: 18px 20px; overflow: auto; flex: 1; min-height: 0; }
.modal-left { min-width: 0; }
.stage-img { position: relative; border-radius: 12px; overflow: hidden; background: #eef3ef;
  border: 1px solid var(--line); line-height: 0; }
.stage-img img { width: 100%; height: auto; display: block; }
.stage-img canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.modal-right { min-width: 0; display: flex; flex-direction: column; }
.labels-tip { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; margin: 0 0 12px; }
.labels { display: flex; flex-direction: column; gap: 10px; }
.label-card { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 12px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fbfdfb; }
.label-card.pending { border-color: #f0d8b8; background: #fffbf6; }
.label-card.active { border-color: var(--green); box-shadow: 0 0 0 2px rgba(46,125,82,.12); }
.lc-shot { position: relative; width: 148px; height: 148px; border-radius: 9px; overflow: hidden;
  background: #eef3ef; border: 1px solid var(--line); cursor: zoom-in; }
.lc-shot img { width: 100%; height: 100%; object-fit: contain; display: block;
  transition: transform .2s; transform-origin: center; }
.lc-shot:hover img { opacity: .88; }
.lc-zoom { position: absolute; left: 5px; bottom: 5px; background: rgba(31,92,59,.82); color: #fff;
  font-size: 10px; padding: 2px 7px; border-radius: 6px; pointer-events: none; }
.lc-shot .no-image { display: grid; place-items: center; height: 100%; font-size: 11px; color: var(--ink-3); text-align: center; padding: 6px; }
.lc-rotate { position: absolute; right: 5px; bottom: 5px; width: 25px; height: 25px; border-radius: 7px;
  border: 1px solid rgba(255,255,255,.7); background: rgba(31,92,59,.85); color: #fff;
  font-size: 14px; line-height: 1; display: grid; place-items: center; }
.lc-rotate:hover { background: var(--green-dark); }
.lc-main { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.lc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lc-id { font-size: 11.5px; font-weight: 700; color: var(--green-dark); background: var(--green-light);
  border-radius: 6px; padding: 2px 8px; }
.badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.badge.auto { background: #e6f2e9; color: var(--green-dark); }
.badge.manual { background: var(--orange-light); color: #95591a; }
.lc-input { display: flex; align-items: center; gap: 6px; }
.lc-input input { width: 108px; font-size: 15px; font-weight: 700; color: var(--green-dark);
  font-variant-numeric: tabular-nums; padding: 7px 9px; }
.lc-input .unit { font-size: 12px; color: var(--ink-2); }
.lc-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid #d9e6dd; background: #fff; color: var(--ink-2); border-radius: 14px;
  padding: 3px 9px; font-size: 10.5px; font-weight: 600; }
.chip:hover { border-color: var(--green-mid); color: var(--green-dark); background: #f6fbf7; }
.lc-meta { font-size: 10.5px; color: var(--ink-3); line-height: 1.5; }
.lc-del { border: none; background: transparent; color: var(--ink-3); font-size: 16px;
  margin-left: auto; line-height: 1; padding: 2px 4px; }
.lc-del:hover { color: var(--red); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 20px; border-top: 1px solid var(--line); background: #fafcf9; flex: none; flex-wrap: wrap; }
.m-subtotal { font-size: 12.5px; color: var(--ink-2); }
.m-subtotal b { color: var(--green-dark); font-size: 16px; font-variant-numeric: tabular-nums; }
.m-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.m-dirty { color: var(--orange); font-weight: 700; font-size: 11.5px; margin-left: 8px; }

/* ---------- 标签截图放大 ---------- */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(12, 28, 19, .88);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: min(86vw, 720px); max-height: 82vh; object-fit: contain;
  border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #fff; }
.lb-tip { color: #cfe3d5; font-size: 12px; }

/* ---------- 页脚 ---------- */
footer { text-align: center; padding: 18px 20px 26px; font-size: 11.5px; color: var(--ink-3); }
footer code { background: #eaf1ec; padding: 2px 6px; border-radius: 5px; color: var(--ink-2); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; }
  .modal-body { grid-template-columns: 1fr; }
  .modal-box { max-height: 96vh; }
}
@media (max-width: 720px) {
  .topbar, .wrap { padding-left: 14px; padding-right: 14px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .stat strong { font-size: 22px; }
  .toolbar { gap: 8px; }
  .spacer { display: none; }
  .label-card { grid-template-columns: 104px minmax(0, 1fr); }
  .lc-shot { width: 104px; height: 104px; }
  .modal { padding: 8px; }
  .modal-foot { flex-direction: column; align-items: stretch; }
  .m-actions .btn { flex: 1; }
}
