:root {
  --red: #c92d2d;
  --wine: #8f1f1f;
  --yellow: #f5c542;
  --green: #18794e;
  --green-soft: #eaf8f0;
  --ink: #1f1f1f;
  --muted: #626262;
  --paper: #fff;
  --mist: #f6f5f3;
  --line: #e8e4df;
  --soft-red: #fceeee;
  --soft-yellow: #fff9e4;
  --max: 1080px;
  --title: 'Montserrat', sans-serif;
  --body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--mist);
  font: 400 1rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(var(--max), calc(100% - 48px)); margin: 0 auto; }
:focus-visible { outline: 3px solid rgba(245, 197, 66, .95); outline-offset: 4px; }

.site-header { border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .97); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 84px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 92px; height: auto; }
.brand span { border-left: 1px solid var(--line); padding-left: 12px; color: var(--muted); font-size: .76rem; font-weight: 700; line-height: 1.25; }
.header-link { color: var(--red); font-size: .86rem; font-weight: 700; text-decoration: none; }
.header-link:hover { color: var(--wine); text-decoration: underline; }

main { padding: 52px 0 80px; }
.breadcrumbs { display: flex; gap: 8px; margin-bottom: 22px; color: #918b84; font-size: .8rem; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { color: var(--red); text-decoration: underline; }
.breadcrumbs strong { color: var(--ink); }
.intro { max-width: 720px; margin-bottom: 30px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--red); font: 700 .74rem/1.2 var(--title); letter-spacing: .12em; text-transform: uppercase; }
.eyebrow::before { width: 8px; height: 8px; border-radius: 50%; background: var(--red); content: ''; }
h1, h2, h3 { margin: 0; font-family: var(--title); line-height: 1.13; letter-spacing: -.04em; }
h1 { margin: 12px 0 12px; font-size: clamp(2rem, 4.6vw, 3.25rem); }
.intro p { max-width: 650px; margin: 0; color: var(--muted); font-size: 1.06rem; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 286px; gap: 24px; align-items: start; }
.card { border: 1px solid rgba(201, 45, 45, .16); border-radius: 18px; background: var(--paper); box-shadow: 0 18px 42px rgba(31, 31, 31, .08); }
.search-card { overflow: hidden; }
.card-heading { padding: 28px 30px 22px; border-bottom: 1px solid var(--line); }
.card-heading h2 { margin-bottom: 7px; font-size: 1.45rem; }
.card-heading p { margin: 0; color: var(--muted); font-size: .9rem; }
.method-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 22px 30px 0; }
.method-tab { min-height: 76px; padding: 12px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #fff; text-align: left; font-size: .78rem; font-weight: 700; line-height: 1.3; }
.method-tab:hover { border-color: rgba(201, 45, 45, .48); color: var(--red); }
.method-tab[aria-pressed="true"] { border-color: var(--red); color: var(--red); background: var(--soft-red); box-shadow: inset 0 -3px 0 var(--red); }
.method-tab-link { display: block; cursor: pointer; text-decoration: none; }
.method-tab small { display: block; margin-top: 5px; color: inherit; font-size: .68rem; font-weight: 500; }
.search-form { padding: 24px 30px 30px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { color: var(--ink); font-size: .8rem; font-weight: 700; }
.field input { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid #cfc8c0; border-radius: 9px; color: var(--ink); background: #fff; font-size: .92rem; }
.field input::placeholder { color: #a39d96; }
.field input:focus { border-color: var(--red); outline: 3px solid rgba(201, 45, 45, .12); }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 24px; }
.form-helper { margin: 0; color: var(--muted); font-size: .73rem; }
.form-actions { display: flex; gap: 10px; flex-shrink: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; padding: 12px 20px; border: 2px solid transparent; border-radius: 999px; font: 700 .82rem var(--title); text-decoration: none; transition: transform .2s ease, background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease; }
.button:hover { transform: translateY(-2px); }
.button-primary { color: #fff; background: var(--red); box-shadow: 0 9px 20px rgba(201, 45, 45, .2); }
.button-primary:hover { background: var(--wine); }
.button-secondary { color: var(--red); border-color: rgba(201, 45, 45, .4); background: transparent; }
.button-secondary:hover { border-color: var(--red); background: var(--soft-red); }
.button:disabled { cursor: wait; opacity: .72; transform: none; }
.button .arrow { font-size: 1.2em; line-height: 0; }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.feedback { margin: 18px 0 0; padding: 12px 14px; border-radius: 9px; font-size: .82rem; }
.feedback.error { color: #8f1f1f; background: var(--soft-red); }
.feedback.info { color: #7a5200; background: var(--soft-yellow); }
.result-card { margin-top: 24px; overflow: hidden; }
.result-status { display: flex; align-items: center; gap: 12px; padding: 18px 24px; color: var(--green); background: var(--green-soft); }
.result-status svg { width: 25px; height: 25px; flex: 0 0 25px; }
.result-status strong { display: block; font: 700 .96rem var(--title); }
.result-status span { display: block; font-size: .78rem; }
.result-body { padding: 24px; }
.result-body h2 { margin-bottom: 6px; font-size: 1.35rem; }
.result-intro { margin: 0 0 20px; color: var(--muted); font-size: .86rem; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.result-item { min-height: 76px; padding: 13px 14px; background: #fff; }
.result-item small { display: block; margin-bottom: 4px; color: var(--muted); font-size: .7rem; }
.result-item strong { display: block; font-size: .83rem; }
.result-item.status strong { color: var(--green); }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.result-actions .button { min-height: 42px; padding: 10px 17px; font-size: .76rem; }

.side-card { padding: 24px; }
.side-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 18px; border-radius: 12px; color: var(--red); background: var(--soft-red); }
.side-icon svg { width: 22px; height: 22px; }
.side-card h2 { margin-bottom: 10px; font-size: 1.08rem; }
.side-card p { margin: 0; color: var(--muted); font-size: .82rem; }
.side-list { display: grid; gap: 14px; margin: 22px 0 0; padding: 0; list-style: none; }
.side-list li { display: grid; grid-template-columns: 22px 1fr; gap: 9px; align-items: start; color: var(--muted); font-size: .77rem; line-height: 1.4; }
.side-list svg { width: 18px; height: 18px; color: var(--red); }
.side-contact { margin-top: 22px !important; padding-top: 18px; border-top: 1px solid var(--line); }
.side-contact a { display: inline-block; margin-top: 4px; color: var(--red); font-weight: 700; text-decoration: none; }
.side-contact a:hover { text-decoration: underline; }

.not-found { margin-top: 24px; padding: 24px; border: 1px solid #ecd8b4; border-radius: 18px; background: var(--soft-yellow); }
.not-found h2 { margin-bottom: 7px; font-size: 1.25rem; color: #754c00; }
.not-found p { margin: 0; color: #7a5d2a; font-size: .86rem; }
.not-found .button { margin-top: 18px; min-height: 42px; padding: 10px 17px; font-size: .76rem; }

.site-footer { padding: 28px 0; border-top: 1px solid var(--line); background: #fff; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-copy { margin: 0; color: var(--muted); font-size: .78rem; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.footer-links a { color: var(--ink); font-size: .78rem; font-weight: 700; text-decoration: none; }
.footer-links a:hover, .footer-links .current { color: var(--red); text-decoration: underline; }

@media (max-width: 820px) {
  .content-grid { grid-template-columns: 1fr; }
  .side-card { display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-items: start; }
  .side-icon { grid-row: span 2; margin: 0; }
  .side-list, .side-contact { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .shell { width: min(100% - 32px, var(--max)); }
  .header-inner { min-height: 72px; }
  .brand img { width: 82px; }
  .brand span { max-width: 120px; font-size: .68rem; }
  .header-link { font-size: .78rem; }
  main { padding: 36px 0 54px; }
  .breadcrumbs { margin-bottom: 18px; }
  .intro { margin-bottom: 24px; }
  .intro p { font-size: .95rem; }
  .card-heading, .search-form { padding-right: 20px; padding-left: 20px; }
  .method-tabs { gap: 6px; padding-right: 20px; padding-left: 20px; }
  .method-tab { min-height: 72px; padding: 10px 7px; font-size: .7rem; }
  .method-tab small { font-size: .61rem; }
  .field-grid, .result-grid { grid-template-columns: 1fr; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .result-body { padding: 20px; }
  .side-card { display: block; }
  .side-icon { margin-bottom: 16px; }
  .footer-inner { align-items: flex-start; flex-direction: column; gap: 12px; }
  .footer-links { gap: 10px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button, .spinner { animation: none; transition: none; }
}

/* Integração com o backend: múltiplos resultados, campos extras e documentos */
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.method-tab { cursor: pointer; }
.field input[aria-invalid="true"] { border-color: var(--red); background: #fffafa; }
.field-hint { margin: 0; color: var(--muted); font-size: .72rem; }
.field-full { grid-column: 1 / -1; }
.results { display: grid; gap: 24px; margin-top: 24px; }
.results:empty { display: none; }
.results .result-card { margin-top: 0; }
.result-count { margin: 24px 0 -8px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.result-status.invalid { color: var(--wine); background: var(--soft-red); }
.result-item.wide { grid-column: 1 / -1; }
.result-item.span-2 { grid-column: span 2; }
@media (max-width: 620px) { .result-item.span-2 { grid-column: auto; } }
.result-item.status.invalid strong { color: var(--wine); }
.result-item code { font: 600 .8rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.result-note { margin: 18px 0 0; padding: 12px 14px; border-radius: 9px; color: #7a5200; background: var(--soft-yellow); font-size: .8rem; }
.secondary-link { display: inline-flex; margin-top: 12px; color: var(--red); font-size: .78rem; font-weight: 700; text-decoration: none; }
.secondary-link:hover { text-decoration: underline; }
.field-hint .secondary-link { margin: 0; }
@media (max-width: 620px) {
  .result-actions .button { width: 100%; }
}
