:root {
  --forest: #173f35;
  --forest-2: #0f3028;
  --sage: #a9bda8;
  --sage-soft: #e5ebe2;
  --ivory: #f5f1e8;
  --paper: #fffdf8;
  --ink: #1d2824;
  --muted: #6d756f;
  --line: #dddcd4;
  --amber: #e59a3a;
  --red: #b44f42;
  --shadow: 0 30px 80px rgba(34, 55, 46, .12);
  --radius: 28px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ivory); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 12%, rgba(169,189,168,.2), transparent 28rem),
    linear-gradient(180deg, #f8f5ed 0%, var(--ivory) 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.topbar {
  width: 100%;
  min-height: 78px;
  padding: 0 clamp(22px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23,63,53,.1);
  background: rgba(248,245,237,.82);
  backdrop-filter: blur(16px);
  position: relative;
  z-index: 5;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--forest); text-decoration: none; font-size: 22px; letter-spacing: -.04em; }
.brand strong { font-weight: 800; }
.brand-mark { position: relative; width: 25px; height: 34px; display: inline-flex; align-items: flex-end; gap: 3px; }
.brand-mark i { display: block; width: 6px; border-radius: 5px 5px 2px 2px; background: var(--forest); transform-origin: bottom; }
.brand-mark i:nth-child(1) { height: 25px; transform: rotate(-13deg); }
.brand-mark i:nth-child(2) { height: 34px; }
.brand-mark i:nth-child(3) { height: 20px; transform: rotate(16deg); }
.brand-mark.large { transform: scale(1.45); margin: 8px 0 18px; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.secure-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.online-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #4f9f71; box-shadow: 0 0 0 4px rgba(79,159,113,.12); }
.icon-link { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; text-decoration: none; color: var(--forest); letter-spacing: 2px; }
.icon-link:hover { background: var(--paper); }

.app-shell { width: min(920px, calc(100% - 36px)); margin: 0 auto; padding: clamp(54px, 8vh, 92px) 0 50px; }
.intro { text-align: center; margin-bottom: 42px; }
.eyebrow, .step-label { margin: 0 0 12px; color: #5f7b6b; font-size: 11px; font-weight: 800; letter-spacing: .17em; }
.intro h1 { margin: 0; color: var(--forest-2); font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 7vw, 70px); font-weight: 500; line-height: .98; letter-spacing: -.055em; }
.intro h1 em { color: #67826f; font-weight: 400; }
.intro > p:last-child { max-width: 520px; margin: 22px auto 0; color: var(--muted); font-size: 16px; line-height: 1.6; }

.print-card { padding: clamp(24px, 5vw, 44px); border: 1px solid rgba(23,63,53,.12); border-radius: var(--radius); background: rgba(255,253,248,.92); box-shadow: var(--shadow); }
.card-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 28px; }
.card-heading h2, .job-status h3 { margin: 0; color: var(--forest-2); font-size: clamp(25px, 4vw, 34px); line-height: 1.12; letter-spacing: -.035em; }
.printer-pill { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 99px; color: #55705f; background: var(--sage-soft); font-size: 12px; font-weight: 700; }
.printer-pill span { color: #4f9f71; font-size: 9px; }

.dropzone { min-height: 255px; padding: 30px; display: flex; flex-direction: column; justify-content: center; align-items: center; border: 1.5px dashed #a8b9aa; border-radius: 20px; background: #faf9f4; cursor: pointer; transition: .2s ease; }
.dropzone:hover, .dropzone.dragging { border-color: var(--forest); background: #f1f4ec; transform: translateY(-1px); }
.dropzone.compact { min-height: 122px; padding: 18px; }
.dropzone.compact .drop-title, .dropzone.compact .drop-divider, .dropzone.compact .drop-note { display: none; }
.dropzone.compact .paper-icon { width: 38px; height: 45px; margin-bottom: 10px; }
.dropzone.compact .choose-button::before { content: "Trocar "; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.paper-icon { width: 49px; height: 59px; margin-bottom: 18px; display: block; position: relative; border: 2px solid var(--forest); border-radius: 4px; background: var(--paper); box-shadow: 8px 8px 0 var(--sage-soft); }
.paper-icon::before { content: ""; position: absolute; right: -2px; top: -2px; width: 16px; height: 16px; border-left: 2px solid var(--forest); border-bottom: 2px solid var(--forest); background: var(--sage-soft); }
.paper-icon i, .paper-icon i::before, .paper-icon i::after { position: absolute; display: block; height: 2px; background: #91a594; content: ""; }
.paper-icon i { width: 24px; left: 10px; top: 28px; }
.paper-icon i::before { width: 24px; top: 8px; }
.paper-icon i::after { width: 16px; top: 16px; }
.drop-title { font-size: 17px; font-weight: 750; color: var(--forest-2); }
.drop-divider { margin: 8px 0; color: #999e99; font-size: 12px; }
.choose-button { padding: 10px 17px; border: 1px solid #c8cec6; border-radius: 9px; background: var(--paper); color: var(--forest); font-size: 13px; font-weight: 750; box-shadow: 0 3px 10px rgba(23,63,53,.05); }
.drop-note { margin-top: 14px; color: #888e89; font-size: 11px; }

.selected-file { margin-top: 14px; padding: 13px 14px; display: flex; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.file-badge { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: var(--forest); color: white; font-size: 9px; font-weight: 800; }
.file-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.file-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-meta small { color: var(--muted); font-size: 11px; }
.remove-file { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: #888; font-size: 24px; cursor: pointer; }
.remove-file:hover { background: #f0eee8; color: var(--red); }

.form-footer { margin-top: 24px; display: grid; grid-template-columns: 190px 1fr; gap: 18px; align-items: end; }
.copies-control { display: grid; gap: 9px; color: var(--forest-2); font-size: 12px; font-weight: 750; }
.stepper { height: 54px; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.stepper button { height: 100%; border: 0; background: transparent; cursor: pointer; font-size: 21px; color: #6f7e76; }
.stepper button:hover { background: #f1f3ee; }
.stepper input { min-width: 0; height: 100%; border: 0; border-left: 1px solid #ece9e0; border-right: 1px solid #ece9e0; outline: 0; text-align: center; color: var(--forest); background: transparent; font-weight: 800; appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { appearance: none; }
.print-button { min-height: 55px; padding: 0 24px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 12px; background: var(--forest); color: white; font-weight: 800; font-size: 13px; letter-spacing: .06em; cursor: pointer; box-shadow: 0 12px 22px rgba(23,63,53,.18); transition: .18s ease; }
.print-button:hover:not(:disabled) { background: var(--forest-2); transform: translateY(-1px); }
.print-button:disabled { cursor: not-allowed; opacity: .38; box-shadow: none; }
.button-icon { font-size: 17px; }

.job-status { min-height: 330px; padding: 40px 18px; text-align: center; place-items: center; align-content: center; }
.job-status:not([hidden]) { display: grid; }
.status-orbit { width: 72px; height: 72px; margin: 0 auto 26px; display: grid; place-items: center; border: 2px solid #d8e1d7; border-radius: 50%; }
.status-orbit span { width: 26px; height: 34px; display: block; border: 2px solid var(--forest); border-radius: 3px; background: var(--paper); }
.job-status[data-status="sending"] .status-orbit, .job-status[data-status="pending"] .status-orbit, .job-status[data-status="processing"] .status-orbit { animation: pulse 1.4s ease-in-out infinite; }
.job-status[data-status="printed"] .status-orbit { border-color: #63a87b; background: #e8f4ea; }
.job-status[data-status="printed"] .status-orbit span { width: 26px; height: 14px; border-width: 0 0 3px 3px; border-radius: 0; background: transparent; transform: rotate(-45deg) translate(2px, -2px); }
.job-status[data-status="failed"] .status-orbit { border-color: #cf8a80; background: #faece9; }
.job-status[data-status="failed"] .status-orbit span { border: 0; background: transparent; }
.job-status[data-status="failed"] .status-orbit span::before { content: "!"; color: var(--red); font-size: 31px; font-weight: 800; }
.job-status p:last-child { max-width: 490px; margin: 13px auto 0; color: var(--muted); line-height: 1.55; font-size: 14px; }
.secondary-button { min-height: 42px; padding: 0 18px; border: 1px solid #bfc9c0; border-radius: 10px; background: var(--paper); color: var(--forest); font-size: 12px; font-weight: 750; cursor: pointer; }
.job-status .secondary-button { margin: 24px auto 0; }
@keyframes pulse { 50% { transform: scale(1.06); box-shadow: 0 0 0 12px rgba(169,189,168,.13); } }

.assurance-row { margin: 25px auto 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 18px 36px; color: #6e7b73; font-size: 11px; }
.assurance-row span::first-letter { color: #4e8e68; }
footer { min-height: 76px; padding: 0 clamp(22px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; border-top: 1px solid rgba(23,63,53,.1); color: #849087; font-size: 11px; }
footer span:first-child { color: var(--forest); font-weight: 800; }

.login-overlay { position: fixed; z-index: 20; inset: 0; padding: 24px; place-items: center; background: rgba(12,38,31,.72); backdrop-filter: blur(12px); }
.login-overlay:not([hidden]) { display: grid; }
.login-card { width: min(430px, 100%); padding: 44px; border-radius: 26px; background: var(--paper); box-shadow: 0 30px 100px rgba(0,0,0,.25); text-align: center; }
.login-card h2 { margin: 0; color: var(--forest-2); font-family: Georgia, serif; font-size: 38px; font-weight: 500; line-height: 1.02; letter-spacing: -.035em; }
.login-card > p:not(.eyebrow):not(.form-error) { margin: 16px 0 25px; color: var(--muted); font-size: 14px; }
.login-card label { display: grid; gap: 8px; text-align: left; color: var(--forest); font-size: 12px; font-weight: 750; }
.login-card input { height: 52px; padding: 0 15px; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: white; }
.login-card input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(23,63,53,.1); }
.login-card .print-button { width: 100%; }
.form-error { min-height: 18px; margin: 9px 0; color: var(--red); font-size: 12px; text-align: left; }
.back-link { display: inline-block; margin-top: 17px; color: var(--muted); font-size: 12px; }

.admin-body { background: #f4f2ec; }
.admin-shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 70px; }
.admin-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.admin-title h1 { margin: 0; color: var(--forest-2); font-family: Georgia, serif; font-size: 46px; font-weight: 500; letter-spacing: -.04em; }
.text-button { border: 0; background: none; color: var(--forest); font-size: 12px; font-weight: 750; cursor: pointer; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.metrics button { min-height: 112px; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); cursor: pointer; }
.metrics button:hover { border-color: var(--sage); transform: translateY(-1px); }
.metrics span { color: var(--muted); font-size: 12px; }
.metrics strong { color: var(--forest); font-family: Georgia, serif; font-size: 38px; font-weight: 500; }
.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 12px 35px rgba(29,40,36,.05); }
.table-toolbar { padding: 21px 23px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #ebe9e2; }
.table-toolbar h2 { margin: 0; color: var(--forest); font-size: 17px; }
.table-toolbar select { min-height: 38px; padding: 0 35px 0 12px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); font-size: 12px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 750px; }
th { padding: 13px 18px; text-align: left; color: #8a918c; background: #faf9f5; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
td { padding: 16px 18px; border-top: 1px solid #eeece6; color: #5e6762; font-size: 12px; }
tbody tr:hover { background: #fdfcf8; }
.table-file { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.table-file > span { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: var(--sage-soft); color: var(--forest); font-size: 8px; font-weight: 800; }
.table-file strong { max-width: 310px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 12px; }
.error-detail { display: block; max-width: 330px; margin: 7px 0 0 45px; color: var(--red); }
.status-chip { display: inline-flex; padding: 6px 10px; border-radius: 99px; font-size: 10px; font-weight: 800; }
.status-chip.pending { color: #796127; background: #f8efd6; }
.status-chip.processing { color: #315f78; background: #e2eff5; }
.status-chip.printed { color: #356d4a; background: #e3f1e7; }
.status-chip.failed { color: #94483d; background: #fae8e5; }
.status-chip.cancelled { color: #686868; background: #ecebe8; }
.row-action { padding: 7px 10px; border: 1px solid #becabf; border-radius: 8px; background: white; color: var(--forest); font-size: 10px; font-weight: 750; cursor: pointer; }
.row-action.danger { color: var(--red); border-color: #e4c6c1; }
.empty-state { padding: 50px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.admin-note { max-width: 780px; margin: 18px auto 0; text-align: center; color: #7a827d; font-size: 11px; line-height: 1.5; }
.toast { position: fixed; z-index: 30; right: 25px; bottom: 25px; max-width: 380px; padding: 14px 18px; border-radius: 12px; background: var(--forest); color: white; box-shadow: 0 15px 40px rgba(0,0,0,.2); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .topbar { min-height: 66px; }
  .secure-label { display: none; }
  .app-shell { width: min(100% - 24px, 920px); padding-top: 42px; }
  .intro { margin-bottom: 28px; }
  .intro h1 { font-size: 43px; }
  .intro h1 br { display: none; }
  .print-card { padding: 22px 16px; border-radius: 20px; }
  .card-heading { display: grid; }
  .printer-pill { width: fit-content; }
  .dropzone { min-height: 230px; padding: 24px 18px; }
  .form-footer { grid-template-columns: 1fr; }
  .copies-control { grid-template-columns: 1fr 150px; align-items: center; }
  .form-footer .print-button { width: 100%; }
  .assurance-row { gap: 10px 18px; }
  footer { text-align: center; justify-content: center; }
  footer span:last-child { display: none; }
  .login-card { padding: 35px 24px; }
  .admin-shell { width: min(100% - 24px, 1240px); padding-top: 35px; }
  .admin-title h1 { font-size: 37px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics button { min-height: 96px; }
}

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