:root {
  color-scheme: light;
  --ink: #17332d;
  --ink-soft: #5f746e;
  --forest: #154d40;
  --forest-deep: #0d392f;
  --mint: #dff2e8;
  --lime: #d9ed9d;
  --cream: #f6f2e9;
  --paper: rgba(255, 255, 255, .88);
  --line: rgba(23, 51, 45, .13);
  --danger: #a33b32;
  --warning: #8a6116;
  --shadow: 0 24px 70px rgba(21, 77, 64, .12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 0; min-height: 100%; background: var(--cream); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: linear-gradient(145deg, #f7f4ec 0%, #edf5ef 60%, #f6f2e9 100%); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(34, 121, 99, .35); outline-offset: 3px; }
[hidden] { display: none !important; }

.ambient { position: fixed; z-index: 0; border-radius: 999px; filter: blur(2px); pointer-events: none; }
.ambient--one { width: 420px; height: 420px; inset: -160px auto auto -120px; background: radial-gradient(circle, rgba(210, 235, 175, .7), transparent 70%); }
.ambient--two { width: 520px; height: 520px; inset: auto -200px -220px auto; background: radial-gradient(circle, rgba(143, 205, 187, .35), transparent 72%); }

.site-header { position: relative; z-index: 2; width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand__mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: white; background: var(--forest); box-shadow: 0 10px 24px rgba(21, 77, 64, .24); font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .04em; }
.brand small { margin-top: 2px; color: var(--ink-soft); font-size: 11px; letter-spacing: .16em; }
.env-badge { padding: 7px 11px; border: 1px solid rgba(21, 77, 64, .17); border-radius: 99px; background: rgba(255,255,255,.65); color: var(--forest); font-size: 12px; font-weight: 700; }
.env-badge[data-env="staging"] { color: #765313; background: #fff4d6; border-color: #e8c86a; }
.env-badge[data-env="production"] { color: #0d5d49; background: #e0f5ed; border-color: #8fcab8; }

.shell { position: relative; z-index: 1; width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 max(48px, env(safe-area-inset-bottom)); }
.login-layout { min-height: calc(100vh - 145px); display: grid; grid-template-columns: 1.08fr .92fr; align-items: center; gap: clamp(38px, 8vw, 110px); }
.hero-copy { max-width: 610px; }
.eyebrow { margin: 0 0 10px; color: #2e7562; font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.hero-copy h1, .workspace-heading h1, .complete-view h1 { margin: 0; font-family: ui-serif, Georgia, "Songti SC", serif; font-size: clamp(42px, 6vw, 74px); line-height: 1.06; font-weight: 650; letter-spacing: -.035em; }
.hero-copy > p:not(.eyebrow) { max-width: 550px; margin: 26px 0 30px; color: var(--ink-soft); font-size: 17px; line-height: 1.85; }
.trust-row { display: flex; flex-wrap: wrap; gap: 10px; }
.trust-row span { padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.62); border: 1px solid var(--line); font-size: 12px; font-weight: 700; }

.card { border: 1px solid rgba(255,255,255,.82); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-card { width: 100%; max-width: 440px; margin-inline-start: auto; padding: clamp(26px, 5vw, 42px); }
.card__heading { margin-bottom: 28px; }
.card__heading h2 { margin: 0 0 8px; font-size: 26px; }
.card__heading > p:last-child { margin: 0; color: var(--ink-soft); font-size: 14px; }
.field { display: grid; gap: 8px; margin-bottom: 18px; color: var(--ink); font-size: 13px; font-weight: 750; }
.field input { width: 100%; min-height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(249,250,247,.9); color: var(--ink); outline: none; transition: border .2s, box-shadow .2s; }
.field input:focus { border-color: #4a917d; box-shadow: 0 0 0 4px rgba(74,145,125,.12); }
.password-field { position: relative; display: block; }
.password-field input { padding-inline-end: 62px; }
.text-button { position: absolute; inset: 0 6px 0 auto; border: 0; background: transparent; color: var(--forest); font-size: 12px; font-weight: 800; cursor: pointer; }
.form-error { margin: -4px 0 14px; color: var(--danger); font-size: 13px; line-height: 1.5; }
.account-dialog { width: min(460px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 24px; color: var(--ink); background: #fbfcf9; box-shadow: 0 30px 100px rgba(5,25,19,.3); }
.account-dialog::backdrop { background: rgba(7,25,20,.62); backdrop-filter: blur(4px); }
.account-dialog form { padding: 26px; }
.account-dialog form > p:not(.eyebrow) { margin: 0 0 20px; color: var(--ink-soft); font-size: 13px; line-height: 1.65; }
.dialog-title { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.dialog-title h2 { margin: 2px 0 0; }
.dialog-close { flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 12px; background: #edf1ed; color: var(--ink); cursor: pointer; font-size: 22px; }
.form-note { margin: 17px 0 0; color: var(--ink-soft); text-align: center; font-size: 11px; line-height: 1.6; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 0 18px; border: 0; border-radius: 12px; text-decoration: none; cursor: pointer; font-weight: 800; font-size: 13px; transition: transform .18s, box-shadow .18s, opacity .18s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.button--wide { width: 100%; }
.button--primary { color: white; background: var(--forest); box-shadow: 0 12px 25px rgba(21,77,64,.22); }
.button--quiet { color: var(--forest); background: rgba(255,255,255,.72); border: 1px solid var(--line); }
.button--light { color: var(--forest-deep); background: var(--lime); }

.capture-layout { padding-top: 8px; }
.workspace-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.workspace-heading h1 { font-size: clamp(34px, 5vw, 54px); }
.workspace-heading > div > p:last-child { margin: 8px 0 0; color: var(--ink-soft); font-size: 13px; }
.user-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.user-chip { min-height: 44px; display: inline-flex; align-items: center; gap: 5px; padding: 0 14px; border-radius: 12px; background: rgba(255,255,255,.7); border: 1px solid var(--line); font-size: 12px; }
.batch-meta-card { margin-bottom: 22px; padding: 22px; border: 1px solid rgba(255,255,255,.9); border-radius: var(--radius-lg); background: rgba(255,255,255,.82); box-shadow: var(--shadow); }
.batch-meta-card__heading, .attachment-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.batch-meta-card__heading h2, .attachment-heading h2 { margin: 0; font-size: 22px; }
.batch-meta-card__heading p:last-child, .attachment-heading p:last-child { margin: 7px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.batch-meta-fields { display: grid; grid-template-columns: minmax(150px,.5fr) minmax(150px,.5fr) minmax(300px,1.5fr); gap: 14px; margin-top: 20px; }
.batch-meta-fields .field { margin: 0; }
.batch-meta-fields em { color: var(--danger); font-style: normal; }
.batch-summary-field { position: relative; }
.batch-summary-field textarea { width: 100%; min-height: 82px; resize: vertical; padding: 13px 15px 24px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(249,250,247,.9); color: var(--ink); font: inherit; font-weight: 500; line-height: 1.5; outline: none; }
.batch-summary-field textarea:focus { border-color: #4a917d; box-shadow: 0 0 0 4px rgba(74,145,125,.12); }
.batch-summary-field > small { position: absolute; inset: auto 10px 8px auto; color: var(--ink-soft); font-size: 10px; }
.batch-meta-card > .button { margin-top: 18px; }
.status-badge { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border-radius: 99px; color: #246650; background: #dceee6; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-badge--open { color: #8a6417; background: #f8edcf; }
.capture-grid { display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(330px, .72fr); gap: 22px; align-items: start; }
.camera-card, .queue-card { border-radius: var(--radius-lg); background: rgba(255,255,255,.82); border: 1px solid rgba(255,255,255,.9); box-shadow: var(--shadow); overflow: hidden; }
.camera-stage { position: relative; aspect-ratio: 4 / 3; min-height: 320px; overflow: hidden; background: #10251f; }
.camera-stage video { width: 100%; height: 100%; display: block; object-fit: cover; }
.camera-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; padding: 30px; color: white; text-align: center; background: radial-gradient(circle at 50% 30%, #2c6354, #10251f 75%); }
.camera-empty h2 { margin: 12px 0 7px; }
.camera-empty p { max-width: 310px; margin: 0 0 20px; color: rgba(255,255,255,.7); font-size: 13px; line-height: 1.6; }
.camera-icon { width: 70px; height: 70px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; font-size: 42px; }
.camera-hud { position: absolute; z-index: 2; inset: 16px 16px auto; display: flex; justify-content: space-between; gap: 12px; pointer-events: none; }
.live-pill, .count-pill { padding: 7px 10px; border-radius: 99px; color: white; background: rgba(8,24,19,.58); backdrop-filter: blur(8px); font-size: 11px; font-weight: 800; }
.live-pill.is-live::before { content: ""; width: 7px; height: 7px; display: inline-block; margin-inline-end: 6px; border-radius: 50%; background: #8fea9e; box-shadow: 0 0 0 4px rgba(143,234,158,.16); }
.camera-controls { min-height: 126px; display: grid; grid-template-columns: 82px 90px 82px; align-items: start; justify-content: center; gap: clamp(22px, 5vw, 58px); padding: 16px 20px 6px; }
.camera-control { min-width: 0; display: grid; justify-items: center; align-content: start; gap: 9px; }
.camera-control--primary { margin-top: -3px; }
.camera-control__label { color: var(--ink-soft); font-size: 11px; font-weight: 750; line-height: 1.25; text-align: center; white-space: nowrap; }
.round-button { width: 52px; height: 52px; border: 1px solid var(--line); border-radius: 50%; color: var(--forest); background: #f2f6f2; cursor: pointer; font-size: 23px; font-weight: 800; }
.round-button--finish { color: white; background: var(--forest); border-color: var(--forest); }
.shutter { width: 78px; height: 78px; display: grid; place-items: center; padding: 0; border: 3px solid var(--forest); border-radius: 50%; background: transparent; cursor: pointer; }
.shutter span { width: 62px; height: 62px; display: block; border-radius: 50%; background: var(--forest); transition: transform .13s, background .13s; }
.shutter:active span { transform: scale(.88); background: #2d7a65; }
.shutter:disabled { opacity: .35; cursor: not-allowed; }
.camera-tip { margin: 0; padding: 2px 20px 18px; color: var(--ink-soft); text-align: center; font-size: 11px; }

.queue-card { min-height: 420px; padding: 24px; }
.queue-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.queue-heading h2 { margin: 0; font-size: 22px; }
.queue-summary { display: grid; justify-items: end; }
.queue-summary strong { color: var(--forest); font-size: 28px; line-height: 1; }
.queue-summary span { margin-top: 4px; color: var(--ink-soft); font-size: 10px; }
.overall-progress { height: 5px; margin: 20px 0 10px; overflow: hidden; border-radius: 99px; background: #e4ece7; }
.overall-progress span { width: 0; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--forest), #6eaf8d); transition: width .3s; }
.queue-status { min-height: 18px; margin: 0 0 16px; color: var(--ink-soft); font-size: 11px; }
.photo-list { max-height: 480px; margin: 0; padding: 0; display: grid; gap: 10px; overflow: auto; list-style: none; }
.photo-item { display: grid; grid-template-columns: 58px minmax(0, 1fr) 38px; align-items: center; gap: 11px; padding: 9px; border: 1px solid var(--line); border-radius: 14px; background: rgba(248,250,247,.92); }
.photo-item img { width: 58px; height: 58px; display: block; border-radius: 10px; object-fit: cover; background: #dfe7e2; }
.photo-meta { min-width: 0; }
.photo-meta strong, .photo-meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-meta strong { font-size: 12px; }
.photo-meta small { margin-top: 4px; color: var(--ink-soft); font-size: 10px; }
.photo-state { margin-top: 5px; display: flex; align-items: center; gap: 6px; color: var(--warning); font-size: 10px; font-weight: 800; }
.photo-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.photo-state[data-state="ready"] { color: #267058; }
.photo-state[data-state="failed"] { color: var(--danger); }
.item-progress { height: 3px; margin-top: 6px; overflow: hidden; border-radius: 99px; background: #dfe7e2; }
.item-progress span { height: 100%; display: block; background: #46947c; transition: width .2s; }
.icon-button { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--danger); cursor: pointer; }
.empty-list { min-height: 270px; display: grid; place-content: center; justify-items: center; color: var(--ink-soft); text-align: center; }
.empty-list > span { font-size: 36px; opacity: .45; }
.empty-list p { margin: 10px 0 3px; color: var(--ink); font-weight: 800; }
.empty-list small { font-size: 11px; }

.attachment-card { margin-top: 22px; padding: 24px; border: 1px solid rgba(255,255,255,.9); border-radius: var(--radius-lg); background: rgba(255,255,255,.82); box-shadow: var(--shadow); }
.attachment-picker { position: relative; flex: 0 0 auto; }
.attachment-picker input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.attachment-picker.is-disabled { cursor: not-allowed; opacity: .5; }
.attachment-summary { display: flex; justify-content: space-between; gap: 16px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 11px; }
.attachment-summary strong { color: var(--forest); }
.attachment-list { display: grid; gap: 9px; margin: 14px 0 0; padding: 0; list-style: none; }
.attachment-item { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: #f8faf7; }
.attachment-file-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: var(--forest); background: #e5eee9; font-size: 10px; font-weight: 900; }
.attachment-meta { min-width: 0; }
.attachment-meta strong, .attachment-meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-meta strong { font-size: 12px; }.attachment-meta small { margin-top: 4px; color: var(--ink-soft); font-size: 10px; }
.attachment-actions { display: flex; gap: 6px; }
.attachment-actions a, .attachment-actions button { min-width: 42px; min-height: 38px; display: inline-grid; place-items: center; padding: 0 9px; border: 0; border-radius: 9px; color: var(--forest); background: #eaf1ed; text-decoration: none; cursor: pointer; font-size: 10px; font-weight: 800; }
.attachment-actions button { color: var(--danger); }
.empty-attachments { min-height: 100px; display: grid; place-content: center; justify-items: center; color: var(--ink-soft); }.empty-attachments span { font-size: 28px; }.empty-attachments p { margin: 4px 0 0; font-size: 11px; }

.complete-view { max-width: 720px; margin: 8vh auto 0; padding: clamp(32px, 7vw, 70px); border: 1px solid rgba(255,255,255,.9); border-radius: 36px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.complete-mark { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto 24px; border-radius: 50%; color: white; background: var(--forest); box-shadow: 0 14px 30px rgba(21,77,64,.22); font-size: 32px; }
.complete-view h1 { font-size: clamp(32px, 5vw, 52px); }
.complete-view > p:not(.eyebrow) { color: var(--ink-soft); line-height: 1.7; }
.result-grid { margin: 32px 0; display: grid; grid-template-columns: 1.5fr .65fr .65fr 1fr; border-block: 1px solid var(--line); }
.result-grid div { min-width: 0; padding: 19px 12px; }
.result-grid div + div { border-inline-start: 1px solid var(--line); }
.result-grid dt { color: var(--ink-soft); font-size: 10px; }
.result-grid dd { margin: 7px 0 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 800; }
.complete-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }

.toast-region { position: fixed; z-index: 20; inset: auto max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) auto; display: grid; gap: 8px; }
.toast { max-width: min(360px, calc(100vw - 32px)); padding: 13px 16px; border-radius: 12px; color: white; background: #17332d; box-shadow: 0 16px 35px rgba(9,35,28,.25); font-size: 12px; line-height: 1.5; animation: toast-in .2s ease-out; }
.toast--error { background: #80362f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; padding: 20px 0 50px; }
  .hero-copy { text-align: center; margin: 0 auto; }
  .hero-copy h1 { font-size: clamp(39px, 10vw, 62px); }
  .trust-row { justify-content: center; }
  .login-card { margin: 0 auto; }
  .capture-grid { grid-template-columns: 1fr; }
  .camera-stage { min-height: 0; aspect-ratio: var(--phone-screen-aspect, 9 / 19.5); }
  .queue-card { min-height: 320px; }
}

@media (max-width: 600px) {
  .site-header, .shell { width: min(100% - 24px, 1180px); }
  .site-header { padding: 14px 0; }
  .brand__mark { width: 38px; height: 38px; border-radius: 12px; }
  .brand small { display: none; }
  .shell { padding-top: 16px; }
  .login-layout { min-height: auto; gap: 28px; }
  .hero-copy h1 { font-size: 42px; }
  .hero-copy > p:not(.eyebrow) { margin: 18px 0 20px; font-size: 14px; line-height: 1.7; }
  .workspace-heading { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .workspace-heading h1 { font-size: 38px; }
  .user-actions { width: 100%; justify-content: flex-start; }
  .camera-card, .queue-card { border-radius: 22px; }
  .camera-controls { grid-template-columns: 74px 82px 74px; gap: clamp(14px, 5vw, 26px); min-height: 118px; padding-inline: 12px; }
  .round-button { width: 46px; height: 46px; }
  .shutter { width: 72px; height: 72px; }
  .shutter span { width: 57px; height: 57px; }
  .queue-card { padding: 20px 16px; }
  .batch-meta-card { padding: 18px 16px; }
  .batch-meta-card__heading, .attachment-heading { align-items: flex-start; flex-direction: column; }
  .batch-meta-fields { grid-template-columns: 1fr 1fr; }
  .batch-summary-field { grid-column: 1 / -1; }
  .attachment-card { padding: 20px 16px; }
  .attachment-picker { width: 100%; }
  .result-grid { grid-template-columns: 1fr; }
  .result-grid div + div { border-inline-start: 0; border-top: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
