:root {
  --ink: #17332d;
  --muted: #6a7e78;
  --line: #dce7e3;
  --paper: #fffefa;
  --canvas: #f3f6f2;
  --green: #176b58;
  --green-dark: #0f5143;
  --mint: #dff3ea;
  --amber: #b66d16;
  --red: #b83b3b;
  --shadow: 0 12px 34px rgba(28, 61, 53, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(920px, 100%); margin: 0 auto; padding: 0 16px 40px; }
.topbar { position: sticky; top: 0; z-index: 10; margin: 0 -16px 20px; padding: max(12px, env(safe-area-inset-top)) 16px 12px; background: rgba(243,246,242,.93); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(23,107,88,.12); display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 800; letter-spacing: .04em; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: white; background: var(--green); box-shadow: 0 6px 16px rgba(23,107,88,.25); }
.subtle { color: var(--muted); font-size: 13px; }
.hero { padding: 18px 2px 22px; }
.hero h1 { font-size: clamp(27px, 7vw, 42px); line-height: 1.13; margin: 0 0 8px; letter-spacing: -.035em; }
.hero p { margin: 0; color: var(--muted); line-height: 1.7; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 80% 15%, #d4eee3, transparent 35%), var(--canvas); }
.login-card { width: min(420px, 100%); }
.login-card h1 { margin: 18px 0 6px; font-size: 30px; }
.field { display: grid; gap: 7px; margin: 16px 0; }
.field label { font-size: 14px; font-weight: 650; }
.field input { width: 100%; border: 1px solid #cbd9d4; background: #fff; border-radius: 13px; padding: 13px 14px; outline: none; }
.field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,88,.12); }
.btn { border: 0; border-radius: 13px; padding: 12px 16px; font-weight: 720; color: var(--ink); background: #e8efec; min-height: 44px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { color: white; background: var(--green); }
.btn-primary:hover { background: var(--green-dark); }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-danger { color: var(--red); background: #fdebea; }
.btn-wide { width: 100%; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2, .section-head h3 { margin: 0; }
.task-list { display: grid; gap: 12px; }
.task-row { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 16px; border-radius: 17px; background: var(--paper); border: 1px solid var(--line); color: inherit; box-shadow: 0 5px 18px rgba(28,61,53,.06); }
.task-row strong { font-size: 17px; }
.task-meta { margin-top: 7px; display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 750; background: #e8efec; white-space: nowrap; }
.badge-completed { color: var(--green-dark); background: var(--mint); }
.badge-processing, .badge-queued { color: #87510e; background: #fff0d8; }
.badge-failed { color: var(--red); background: #fdebea; }
.empty { text-align: center; color: var(--muted); padding: 38px 15px; }
.back { color: var(--green); background: none; border: 0; padding: 6px 0; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.stat b { display: block; font-size: 25px; margin-bottom: 3px; }
.progress { height: 9px; background: #dfe8e4; border-radius: 999px; overflow: hidden; margin: 13px 0 5px; }
.progress span { display: block; height: 100%; background: var(--green); transition: width .4s ease; }
.upload-zone { border: 1.5px dashed #91b4aa; border-radius: 16px; padding: 18px; background: #f8fbf9; text-align: center; }
.upload-zone input { display: none; }
.file-count { color: var(--muted); margin: 10px 0 0; font-size: 13px; }
.summary-table { width: 100%; border-collapse: collapse; }
.summary-table th, .summary-table td { padding: 11px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.summary-table th:last-child, .summary-table td:last-child { text-align: right; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; }
.photo-card { position: relative; overflow: hidden; border-radius: 14px; border: 1px solid var(--line); background: #edf2ef; padding: 0; text-align: left; color: inherit; }
.photo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photo-info { padding: 9px; }
.photo-info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.photo-info span { color: var(--muted); font-size: 12px; }
.photo-flag { position: absolute; left: 7px; top: 7px; background: rgba(17,45,38,.82); color: white; padding: 4px 7px; border-radius: 8px; font-size: 11px; }
.photo-confirmed { position: absolute; right: 7px; top: 7px; background: #0f8a68; color: white; padding: 4px 7px; border-radius: 8px; font-size: 11px; }
.photo-warning { background: #dc7a12; }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(8,24,20,.85); display: grid; grid-template-rows: auto 1fr auto; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); color: white; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 10px; }
.modal-head strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer { min-height: 0; overflow: auto; display: grid; place-items: center; }
.canvas-wrap { position: relative; width: 100%; }
.canvas-wrap img { width: 100%; display: block; }
.canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.modal-results { max-height: 28vh; overflow: auto; background: white; color: var(--ink); border-radius: 14px; margin-top: 10px; padding: 10px; }
.result-line { padding: 9px; border-left: 6px solid #14a77b; border-bottom: 1px solid var(--line); font-size: 12px; word-break: break-all; margin-bottom: 4px; background: #f4fbf8; }
.result-line.unread { border-left-color: #f08a16; background: #fff7e9; }
.result-line.conflict { border-left-color: #e13d3d; background: #fff0ef; }
.result-line.duplicate { border-left-color: #71807b; background: #f1f3f2; }
.result-line:last-child { border: 0; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #153d33; color: white; border-radius: 12px; padding: 11px 15px; z-index: 50; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.error-text { color: var(--red); font-size: 13px; }
@media (max-width: 560px) {
  .card { border-radius: 17px; padding: 15px; }
  .topbar { margin-bottom: 10px; }
  .hero { padding-top: 12px; }
  .stats { gap: 7px; }
  .stat { padding: 12px 9px; }
  .stat b { font-size: 22px; }
  .stat span { font-size: 11px; }
}
