:root {
  color-scheme: light;
  --background: #f5f6f8;
  --surface: #fff;
  --ink: #1f2937;
  --muted: #5b6575;
  --line: #dfe4eb;
  --blue: #066cff;
  --blue-soft: #eaf3ff;
  --green: #15803d;
  --green-soft: #eaf7ed;
  --amber: #a15c00;
  --amber-soft: #fff4db;
  --red: #c92d2d;
  --red-soft: #fff0ee;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--background);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.capture-shell { min-height: 100vh; padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
.site-header { min-height: 62px; padding: 12px max(20px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-size: 20px; font-weight: 800; letter-spacing: -.6px; white-space: nowrap; }
.brand span:last-child { color: #ec8018; }
.header-purpose { padding-left: 12px; border-left: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.text-button { margin-left: auto; color: var(--blue); border: 0; background: none; min-height: 44px; padding: 0 8px; }
main { width: min(100% - 32px, 560px); margin: 0 auto; }
.panel { margin-top: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.checking-panel { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.checking-panel p { margin: 0; }
.loading-line { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--blue); animation: spin .9s linear infinite; }
.eyebrow { color: var(--blue); font-size: 13px; font-weight: 700; letter-spacing: .06em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 8px 0 12px; font-size: clamp(25px, 7vw, 30px); line-height: 1.25; letter-spacing: -.025em; }
h2 { margin: 0; font-size: 18px; line-height: 1.4; }
h3 { margin-bottom: 5px; font-size: 16px; }
.intro, .helper, .page-head p, .section-subtitle { color: var(--muted); }
.intro { margin-bottom: 24px; }
.helper { font-size: 14px; margin: 18px 0 0; }
form { display: grid; gap: 9px; }
form label { font-weight: 600; }
form input { min-width: 0; width: 100%; min-height: 48px; margin-bottom: 8px; padding: 10px 12px; border: 1px solid #b9c3d1; border-radius: 8px; background: #fff; color: var(--ink); }
form input[aria-invalid="true"] { border-color: var(--red); }
.form-error { color: var(--red); background: var(--red-soft); border-radius: 7px; padding: 9px 11px; font-size: 14px; margin: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid transparent; min-height: 44px; padding: 9px 15px; font-weight: 600; text-align: center; transition: background-color .15s, border-color .15s; }
.button-primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.button-primary:not(:disabled):hover { background: #005bdb; }
.button-secondary { color: #075acb; background: #fff; border-color: #b6cef5; }
.button-secondary:not(:disabled):hover { background: var(--blue-soft); }
.button-quiet { color: #334155; background: #fff; border-color: var(--line); }
.button-quiet:not(:disabled):hover { background: #f6f7f9; }
.button-danger { color: var(--red); background: #fff; border-color: #f1b5b5; }

.page-head { padding: 30px 2px 8px; }
.page-head h1:focus { outline: none; }
.page-head p { margin-bottom: 0; }
.receiver-card, .task-section { margin-top: 20px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 18px; }
.receiver-card { border-left: 4px solid var(--blue); }
.receiver-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.receiver-summary { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.receiver-summary strong { color: var(--ink); }
.receiver-detail { margin-top: 13px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 14px; color: var(--muted); }
.receiver-detail summary { cursor: pointer; color: #315788; font-weight: 600; min-height: 33px; }
.receiver-detail p { margin: 8px 0; }
.device-id { overflow-wrap: anywhere; font-family: Consolas, ui-monospace, monospace; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.section-subtitle { margin: 4px 0 0; font-size: 14px; }
.page-notice, .storage-notice { border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.page-notice { color: #284f80; background: var(--blue-soft); }
.page-notice.warn, .storage-notice { color: #754500; background: var(--amber-soft); }
.page-notice.error { color: var(--red); background: var(--red-soft); }
.task-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.task-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fff; }
.task-card[data-stage="received"] { border-color: #a8dec0; }
.task-card[data-stage="expired"], .task-card[data-stage="error"] { border-color: #edc3b4; }
.task-main { display: flex; gap: 12px; min-width: 0; }
.thumb { flex: 0 0 52px; width: 52px; height: 52px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; background: #ecf0f4; }
.thumb-placeholder { display: grid; place-items: center; color: #607083; font-size: 13px; }
.task-text { min-width: 0; flex: 1; }
.file-name { display: block; font-weight: 650; overflow-wrap: anywhere; line-height: 1.35; }
.file-meta { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.task-status { margin: 9px 0 0; font-weight: 650; font-size: 15px; }
.task-card[data-stage="received"] .task-status { color: var(--green); }
.task-card[data-stage="cloud_stored"] .task-status { color: #0458c0; }
.task-card[data-stage="expired"] .task-status, .task-card[data-stage="error"] .task-status { color: var(--red); }
.task-help { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.task-help.error { color: var(--red); }
.receipt-rail { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 14px; }
.receipt-step { border-top: 3px solid var(--line); padding-top: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
.receipt-step.done { border-color: var(--green); color: #146534; }
.receipt-step.current { border-color: var(--blue); color: #075acb; }
.task-progress { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: #e8edf4; }
.task-progress span { display: block; height: 100%; background: var(--blue); }
.task-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; flex-wrap: wrap; }
.task-actions .button { min-height: 44px; }
.empty-state { text-align: center; padding: 26px 10px 20px; color: var(--muted); }
.empty-state h3 { color: var(--ink); }
.empty-mark { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); font-size: 30px; font-weight: 300; }

.capture-actions { position: fixed; z-index: 3; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px max(16px, env(safe-area-inset-left)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 18px #243a5910; }
.capture-actions .button { min-height: 52px; }

@media (max-width: 390px) {
  .site-header { padding-left: 16px; padding-right: 12px; }
  main { width: calc(100% - 24px); }
  .panel, .receiver-card, .task-section { padding: 16px; }
  .receiver-top, .section-head { flex-wrap: wrap; }
  .receiver-top .button, .section-head .button { width: 100%; }
  .capture-actions { padding-left: 12px; padding-right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .loading-line { animation: none; }
  .button { transition: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }
