:root {
  --ink: #14181F;
  --ink-soft: #5B5F68;
  --paper: #FCFBF8;
  --paper-raised: #FFFFFF;
  --seal: #A23B2E;
  --seal-dark: #7E2E23;
  --slate: #3D5A73;
  --sand: #DAD4C4;
  --sand-hairline: rgba(20, 24, 31, 0.1);

  --font-display: 'Fraunces', 'Iowan Old Style', serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
}

.topbar {
  padding: 28px 32px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
}

.brand-mark {
  width: 22px;
  height: 22px;
  color: var(--seal);
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 32px 64px;
}

.state {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0 0 14px;
}

h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

.lede {
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 46ch;
}

/* ---- Campos ---- */

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field select,
.field input {
  width: 100%;
  border: 1px solid var(--sand-hairline);
  border-radius: 8px;
  background: var(--paper-raised);
  padding: 11px 13px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
}

.field input:focus-visible,
.field select:focus-visible,
button:focus-visible,
.dropzone:focus-visible {
  outline: 2px solid var(--slate);
  outline-offset: 2px;
}

.field-pin input {
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
  max-width: 160px;
}

/* ---- Dropzone ---- */

.dropzone {
  border: 1.5px dashed var(--sand);
  border-radius: 14px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  color: var(--ink-soft);
  transition: border-color 160ms ease, background 160ms ease;
  margin-bottom: 20px;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--seal);
  background: rgba(162, 59, 46, 0.035);
}

.dropzone-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  color: var(--slate);
}

.dropzone p {
  margin: 0;
  font-size: 14.5px;
}

.dropzone strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---- Lista de arquivos ---- */

.file-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--sand-hairline);
  border-radius: 10px;
  background: var(--paper-raised);
  font-size: 14px;
}

.file-row .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.file-status {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink-soft);
}

.file-status.is-done { color: #2E6B3B; }
.file-status.is-error { color: var(--seal); }
.file-status.is-signing { color: var(--slate); }

.file-remove {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
}
.file-remove:hover { color: var(--seal); }

.file-download {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--slate);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  white-space: nowrap;
}

/* ---- Botoes ---- */

.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 500;
  border-radius: 9px;
  padding: 12px 20px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { background: #262c38; }

.btn-ghost {
  background: transparent;
  border-color: var(--sand-hairline);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink-soft); }

.btn-seal {
  background: var(--seal);
  color: #fff;
}
.btn-seal:hover { background: var(--seal-dark); }
.btn-seal:disabled {
  background: var(--sand);
  color: var(--ink-soft);
  cursor: not-allowed;
}

.seal-icon {
  width: 15px;
  height: 15px;
}

.sign-controls {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 8px;
}

.form-error {
  color: var(--seal);
  font-size: 13.5px;
  margin-top: 12px;
}

/* ---- Selo de conclusao ---- */

.seal-stamp {
  width: 88px;
  height: 88px;
  margin-bottom: 18px;
  color: var(--seal);
}

.seal-stamp svg { width: 100%; height: 100%; }

.seal-ring {
  stroke: currentColor;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  animation: seal-ring-draw 480ms cubic-bezier(0.65, 0, 0.35, 1) 80ms forwards;
}

.seal-check {
  stroke: currentColor;
  stroke-dasharray: 64;
  stroke-dashoffset: 64;
  animation: seal-check-draw 320ms cubic-bezier(0.65, 0, 0.35, 1) 460ms forwards;
}

@keyframes seal-ring-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes seal-check-draw {
  to { stroke-dashoffset: 0; }
}

/* ---- Rodape ---- */

.footer {
  padding: 20px 32px 28px;
  text-align: center;
}

.footer p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* ---- Responsivo ---- */

@media (max-width: 480px) {
  .stage { padding: 32px 20px 48px; }
  h1 { font-size: 27px; }
  .sign-controls { flex-direction: column; align-items: stretch; }
  .field-pin input { max-width: none; }
}
