:root {
  --ink: var(--tools-text);
  --muted: var(--tools-muted);
  --paper: var(--tools-bg);
  --surface: var(--tools-surface);
  --line: var(--tools-line);
  --green: var(--tools-green);
  --green-dark: var(--tools-green-strong);
  --green-soft: var(--tools-green-soft);
  --orange: var(--tools-green);
  --red: var(--tools-red);
  --shadow: var(--tools-shadow);
  color: var(--ink);
  background: var(--paper);
  font-family: var(--tools-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 15%, color-mix(in srgb, var(--green) 8%, transparent), transparent 25rem),
    var(--paper);
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; }
[v-cloak] { display: none; }

.site-header {
  width: min(1180px, calc(100% - 40px));
  height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(32, 91, 67, .14);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 750;
  letter-spacing: -.02em;
  text-decoration: none;
}

.brand > img { width: 42px; height: 42px; }

.brand-mark {
  position: relative;
  width: 27px;
  height: 27px;
  border: 2px solid var(--green);
  border-radius: 7px;
}

.brand-mark::before,
.brand-mark::after,
.brand-mark i::before,
.brand-mark i::after {
  position: absolute;
  width: 7px;
  height: 7px;
  border-color: var(--orange);
  content: "";
}

.brand-mark::before { top: -4px; left: -4px; border-top: 2px solid; border-left: 2px solid; }
.brand-mark::after { top: -4px; right: -4px; border-top: 2px solid; border-right: 2px solid; }
.brand-mark i::before { bottom: -4px; left: -4px; border-bottom: 2px solid; border-left: 2px solid; }
.brand-mark i::after { right: -4px; bottom: -4px; border-right: 2px solid; border-bottom: 2px solid; }

.local-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
}

main {
  width: min(1040px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  max-width: 820px;
  margin: 92px auto 54px;
  text-align: center;
}

.eyebrow, .step-label {
  margin: 0 0 12px;
  color: var(--orange) !important;
  font: 750 .72rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 900px;
  margin: 0 auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 6vw, 4.9rem);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.055em;
}

.hero-copy {
  max-width: 650px;
  margin: 28px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.16rem);
  line-height: 1.75;
}

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px 20px;
  margin: 22px 0 0;
  padding: 0;
  color: var(--green-dark);
  font-size: .77rem;
  font-weight: 750;
  list-style: none;
}

.hero-proof li::before {
  margin-right: 6px;
  content: "✓";
}

.workspace, .export-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 253, 248, .88);
  box-shadow: var(--shadow);
}

.workspace {
  min-height: 430px;
  overflow: hidden;
  transition: border-color .2s, transform .2s;
}

.workspace.is-dragging { border-color: var(--orange); transform: scale(1.005); }

.empty-state {
  min-height: 430px;
  padding: 62px clamp(24px, 7vw, 78px);
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 26px 50px;
}

.empty-state h2, .editor-heading h2, .export-heading h2, .camera-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  font-weight: 500;
  letter-spacing: -.035em;
}

.empty-state p:not(.step-label), .editor-heading p:not(.step-label) {
  max-width: 590px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.empty-visual {
  width: 150px;
  height: auto;
  aspect-ratio: 3 / 2;
  grid-row: span 4;
  object-fit: contain;
}

.capture-actions {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.action-card {
  min-height: 100px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 15px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefa;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}

.action-card:hover { transform: translateY(-2px); border-color: #aebbb2; box-shadow: 0 10px 25px rgba(35, 50, 42, .08); }
.action-card-primary { color: white; border-color: var(--green); background: var(--green); }
.action-card-primary:hover { border-color: var(--green-dark); box-shadow: 0 10px 28px rgba(32, 91, 67, .22); }
.action-card span:last-child { display: grid; gap: 4px; }
.action-card strong { font-size: .94rem; }
.action-card small { color: inherit; font-size: .72rem; opacity: .7; }

.action-icon {
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 11px;
  font-size: 1.45rem;
}

.camera-icon { position: relative; }
.camera-icon::before {
  width: 20px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 3px;
  content: "";
}
.camera-icon::after {
  position: absolute;
  width: 5px;
  height: 5px;
  border: 2px solid currentColor;
  border-radius: 50%;
  content: "";
}

.drop-hint {
  grid-column: 2;
  margin: -10px 0 0 !important;
  color: #8b918d !important;
  font-size: .75rem;
  text-align: center;
}

.capture-proof {
  grid-column: 2;
  margin: -3px 0 -2px !important;
  color: var(--green-dark) !important;
  font-size: .73rem;
  font-weight: 700;
  text-align: center;
}

.drop-overlay {
  position: absolute;
  z-index: 20;
  inset: 10px;
  display: grid;
  place-content: center;
  gap: 12px;
  color: var(--green);
  text-align: center;
  border: 2px dashed var(--orange);
  border-radius: 18px;
  background: rgba(245, 242, 234, .96);
}
.drop-overlay span { font-size: 3rem; }

.document-editor { padding: clamp(24px, 5vw, 48px); }

.editor-heading, .export-heading, .camera-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.editor-actions { display: flex; gap: 10px; }

.button {
  min-height: 44px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
  transition: transform .18s, background .18s, box-shadow .18s;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-secondary { color: var(--green); border-color: #c9d5cd; background: white; }
.button-primary {
  min-height: 54px;
  padding-inline: 24px;
  color: white;
  background: var(--green);
  box-shadow: 0 10px 25px rgba(32, 91, 67, .2);
}
.button-primary:hover:not(:disabled) { background: var(--green-dark); }

.mini-camera {
  width: 15px;
  height: 11px;
  position: relative;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.mini-camera::after {
  position: absolute;
  width: 3px;
  height: 3px;
  inset: 2px auto auto 4px;
  border: 1px solid currentColor;
  border-radius: 50%;
  content: "";
}

.page-grid {
  margin: 34px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  list-style: none;
}

.page-card {
  position: relative;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.page-number {
  position: absolute;
  z-index: 2;
  top: 16px;
  left: 16px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: var(--green);
  font-size: .72rem;
  font-weight: 800;
}

.page-preview {
  height: 210px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.page-preview img {
  max-width: 94%;
  max-height: 94%;
  object-fit: contain;
  box-shadow: 0 4px 15px rgba(0, 0, 0, .12);
  transition: transform .2s;
}

.page-meta {
  margin: 10px 2px 8px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .7rem;
}
.page-meta span:first-child { color: var(--ink); font-weight: 750; }

.page-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.page-controls button {
  height: 34px;
  color: var(--green);
  border: 1px solid #e2e1db;
  border-radius: 7px;
  background: #faf9f5;
  font-size: 1rem;
}
.page-controls button:hover:not(:disabled) { background: var(--green-soft); }
.page-controls button.danger { color: var(--red); }
.page-controls button.danger:hover { background: #f8e6e3; }

.editor-summary {
  margin-top: 22px;
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: .78rem;
}

.export-panel { margin-top: 24px; padding: clamp(26px, 5vw, 50px); }
.export-heading { align-items: center; }

.settings-grid {
  margin-top: 34px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
}

.field { display: grid; gap: 9px; }
.field > span:first-child, .quality-options legend {
  color: #4d5752;
  font-size: .75rem;
  font-weight: 750;
}

.field input, .field select, .filename-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
}

.field select { padding: 0 40px 0 14px; color: var(--ink); }
.filename-input { display: flex; align-items: center; overflow: hidden; }
.filename-input input { min-width: 0; padding: 0 4px 0 14px; border: 0; outline: 0; }
.filename-input b { padding-right: 14px; color: #89908c; font-size: .8rem; }

.quality-options {
  margin: 28px 0 0;
  padding: 0;
  border: 0;
}
.quality-options legend { margin-bottom: 9px; }
.quality-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.quality-options legend { grid-column: 1 / -1; }
.quality-options label {
  min-height: 78px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  cursor: pointer;
}
.quality-options label.selected { border-color: var(--green); background: var(--green-soft); }
.quality-options input { position: absolute; opacity: 0; pointer-events: none; }
.radio-mark {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 1px solid #98a29c;
  border-radius: 50%;
  background: white;
}
.selected .radio-mark { border: 5px solid var(--green); }
.quality-options label > span:last-child { display: grid; gap: 4px; }
.quality-options strong { font-size: .82rem; }
.quality-options small { color: var(--muted); font-size: .68rem; line-height: 1.35; }

.export-footer {
  margin-top: 30px;
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  border-top: 1px solid var(--line);
}
.export-footer p {
  max-width: 470px;
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.55;
}

.progress-area { margin-top: 25px; }
.progress-copy { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; }
.progress-copy strong { color: var(--green); }
.progress-track { height: 7px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: #dfe4df; }
.progress-track i { height: 100%; display: block; border-radius: inherit; background: var(--green); transition: width .2s; }

.message {
  margin-top: 24px;
  padding: 15px 17px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-radius: 10px;
  font-size: .8rem;
}
.message span:not(.success-check) { display: grid; gap: 3px; }
.message small { color: inherit; opacity: .75; }
.message-error { color: #742d27; border: 1px solid #e1b5af; background: #f9e9e6; }
.message-success { color: var(--green-dark); border: 1px solid #b9d3c2; background: var(--green-soft); }
.success-check { width: 29px; height: 29px; display: grid; place-items: center; color: white; border-radius: 50%; background: var(--green); }

.trust-row {
  margin: 70px 0 78px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}
.trust-row article { display: flex; gap: 16px; }
.trust-number { color: var(--orange); font: 700 .67rem/1.5 ui-monospace, monospace; }
.trust-row strong { font-family: Georgia, serif; font-size: 1.05rem; font-weight: 500; }
.trust-row p { margin: 6px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.55; }

footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 25px 0 35px;
  display: flex;
  justify-content: space-between;
  color: #7c837f;
  border-top: 1px solid var(--line);
  font-size: .7rem;
}

.camera-modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(13, 20, 17, .82);
  backdrop-filter: blur(10px);
}

.camera-sheet {
  width: min(880px, 100%);
  max-height: calc(100vh - 40px);
  padding: 24px;
  overflow: auto;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .35);
}
.camera-header { align-items: center; }
.camera-header h2 { font-size: 2rem; }
.close-button {
  width: 42px;
  height: 42px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  font-size: 1.6rem;
}
.camera-stage {
  position: relative;
  min-height: 340px;
  margin-top: 20px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #101512;
}
.camera-stage video { width: 100%; max-height: 62vh; display: block; object-fit: contain; }
.camera-frame {
  position: absolute;
  inset: 8%;
  border: 2px solid rgba(255, 255, 255, .8);
  border-radius: 6px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .16);
  pointer-events: none;
}
.camera-loading, .camera-error {
  position: absolute;
  z-index: 3;
  inset: 0;
  padding: 30px;
  display: grid;
  place-content: center;
  color: white;
  text-align: center;
  background: #101512;
}
.camera-error { gap: 10px; }
.camera-error p { max-width: 450px; margin: 0 0 10px; color: #bfc6c2; line-height: 1.5; }
.camera-footer {
  min-height: 84px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: .72rem;
}
.camera-footer span:last-child { text-align: right; }
.shutter {
  width: 62px;
  height: 62px;
  padding: 5px;
  border: 2px solid var(--green);
  border-radius: 50%;
  background: transparent;
}
.shutter i { width: 100%; height: 100%; display: block; border-radius: 50%; background: var(--green); transition: transform .15s; }
.shutter:active i { transform: scale(.9); }

.toast {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  max-width: calc(100% - 44px);
  padding: 13px 17px;
  color: white;
  border-radius: 10px;
  background: var(--ink);
  box-shadow: 0 12px 35px rgba(0, 0, 0, .22);
  font-size: .78rem;
}

.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, label:has(input:focus-visible) {
  outline: 3px solid color-mix(in srgb, var(--green) 55%, transparent);
  outline-offset: 3px;
}

/* Shared Tools visual language */
.workspace,
.export-panel {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.action-card,
.button-secondary,
.page-card,
.field input,
.field select,
.filename-input,
.quality-options label,
.radio-mark,
.close-button {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

.action-card.action-card-primary {
  color: #fff;
  border-color: var(--green);
  background: linear-gradient(135deg, #5c9655, var(--green-dark));
  box-shadow: 0 10px 28px color-mix(in srgb, var(--green) 24%, transparent);
}

.page-controls button {
  border-color: var(--line);
  background: var(--tools-surface-soft);
}

.drop-overlay {
  color: var(--green);
  border-color: var(--green);
  background: color-mix(in srgb, var(--paper) 96%, transparent);
}

.eyebrow,
.step-label,
.trust-number {
  color: var(--tools-green-text) !important;
}

.field > span:first-child,
.quality-options legend,
footer {
  color: var(--muted);
}

.footer-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
  text-decoration: none;
}

.footer-home img {
  width: 30px;
  height: 30px;
}

@media (max-width: 820px) {
  .empty-state { grid-template-columns: 1fr; text-align: center; }
  .empty-visual { grid-row: auto; margin: 0 auto; }
  .capture-actions, .capture-proof, .drop-hint { grid-column: 1; }
  .page-grid { grid-template-columns: repeat(2, 1fr); }
  .editor-heading { align-items: flex-start; flex-direction: column; }
  .editor-actions { width: 100%; }
  .editor-actions .button { flex: 1; }
  .trust-row { grid-template-columns: 1fr; max-width: 500px; margin-inline: auto; }
}

@media (max-width: 620px) {
  .site-header, main, footer { width: min(100% - 26px, 1040px); }
  .hero { margin: 62px auto 38px; }
  .hero h1 { font-size: clamp(2.65rem, 12vw, 4rem); }
  .empty-state { padding: 40px 18px; }
  .capture-actions, .settings-grid, .quality-options { grid-template-columns: 1fr; }
  .action-card { min-height: 88px; }
  .document-editor, .export-panel { padding: 23px 14px; }
  .page-grid { gap: 9px; }
  .page-preview { height: 175px; }
  .page-meta { font-size: .63rem; }
  .editor-actions { flex-direction: column; }
  .export-heading { align-items: flex-start; flex-direction: column; }
  .quality-options legend { grid-column: 1; }
  .export-footer { align-items: stretch; flex-direction: column; }
  .button-primary { width: 100%; }
  .camera-modal { padding: 0; }
  .camera-sheet { min-height: 100vh; max-height: 100vh; padding: 18px 13px; border-radius: 0; }
  .camera-stage { min-height: 48vh; }
  .camera-footer { grid-template-columns: 1fr auto 1fr; }
  .camera-footer span { font-size: .62rem; }
  footer { gap: 18px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
