/* Tokens do design system SolarGrid (Brandbook jul/2026): Aurora como acento, base Sirius, tema escuro Órion */
:root {
  --brand: #EC6E2D;
  --brand-press: #D5531A;
  --on-brand: #FFFFFF;
  --o-50: #FDF2EA;
  --o-100: #FBE0CD;
  --canvas: #F3F3F3;
  --paper: #FFFFFF;
  --peach: #EAEEF0;
  --ink: #0B1A2A;
  --ink-2: #46566A;
  --ink-3: #6E7B85;
  --line: #DCE3E6;
  --line-2: #C7D2D5;
  --ok: #1DA46B;
  --ok-bg: #E3F4EC;
  --warn: #B87F0E;
  --warn-bg: #FAF0D8;
  --bad: #C2310F; /* Vega escurecido para texto pequeno passar no contraste AA */
  --bad-bg: #FCE6E0;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --sh-s: 0 1px 2px rgba(8, 25, 40, .07), 0 1px 3px rgba(8, 25, 40, .05);
  --font: "Montserrat", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #F0843F;
    --brand-press: #EC6E2D;
    --on-brand: #0D1116; /* branco sobre o Aurora claro não tem contraste suficiente */
    --o-50: #221812;
    --o-100: #33231A;
    --canvas: #0D1116;
    --paper: #151B21;
    --peach: #1C2530;
    --ink: #EEF1F3;
    --ink-2: #A7B3BD;
    --ink-3: #8492A0;
    --line: #232C36;
    --line-2: #31404C;
    --ok: #3FBA86;
    --ok-bg: #10241B;
    --warn: #F0B84A;
    --warn-bg: #241C0E;
    --bad: #F4634A;
    --bad-bg: #2A130F;
    --sh-s: 0 2px 8px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .40);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Topo */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.logo { display: block; height: 22px; width: auto; }

.badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--o-50);
  color: var(--brand-press);
  font-size: 12px;
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .badge { color: var(--brand); }
}


/* Página */
.page {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 16px 56px;
}

.intro {
  position: relative;
  padding-right: 120px;
  margin-bottom: 28px;
}

/* O Sol é elemento gráfico: acento, longe do wordmark e sem recolorir */
.sun {
  position: absolute;
  top: -6px;
  right: 0;
  width: 92px;
  height: auto;
  pointer-events: none;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.01em;
}

.intro p {
  margin: 0;
  color: var(--ink-2);
  max-width: 54ch;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-s);
  padding: 28px;
}

/* Campos */
.fields {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.field {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
  min-width: 0;
}

label, legend, .label {
  display: block;
  margin-bottom: 8px;
  padding: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.req { color: var(--brand-press); }
.optional { color: var(--ink-3); font-weight: 500; }

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.counter {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
  color: var(--ink);
  font: 500 15px/1.4 var(--font);
  transition: border-color .18s, box-shadow .18s;
}

textarea.input {
  resize: vertical;
  min-height: 140px;
}

.input::placeholder { color: var(--ink-3); font-weight: 400; }


.input:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--o-100);
}

.field.has-error .input { border-color: var(--bad); }
.field.has-error .input:focus-visible { box-shadow: 0 0 0 4px var(--bad-bg); }

.field-error {
  margin: 6px 0 0;
  color: var(--bad);
  font-size: 13px;
  font-weight: 500;
}

/* Opções em chips (radio) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip { position: relative; margin: 0; }

.chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: border-color .18s, background .18s, color .18s;
}

.chip span::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  flex: none;
  transition: .18s;
}

.chip:hover span { border-color: var(--ink-3); }

.chip input:checked + span {
  border-color: var(--brand);
  background: var(--o-50);
  color: var(--ink);
}

.chip input:checked + span::before {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: inset 0 0 0 3px var(--paper);
}

.chip input:focus-visible + span {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.field.has-error .chip span { border-color: var(--bad); }

/* Upload */
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 26px 20px;
  border: 2px dashed var(--line-2);
  border-radius: var(--r-lg);
  background: var(--paper);
  text-align: center;
  font-weight: 400;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.drop:hover, .drop.dragging {
  border-color: var(--brand);
  background: var(--o-50);
}

.drop:focus-within {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  border-radius: var(--r-md);
  background: var(--o-50);
  color: var(--brand);
}

.drop-icon svg { width: 24px; height: 24px; }

.drop-title { font-size: 14.5px; color: var(--ink); }
.drop-title strong { font-weight: 600; }
.drop-title .link { color: var(--brand-press); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.drop-hint { font-size: 12.5px; color: var(--ink-3); }

@media (prefers-color-scheme: dark) {
  .drop-title .link, .req { color: var(--brand); }
}

.field.has-error .drop { border-color: var(--bad); }

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

.file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
}

/* Prévia da imagem escolhida; abre em tamanho real numa nova aba */
.file-thumb {
  flex: none;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--ok-bg);
}

.file-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.file-thumb:hover { border-color: var(--ink-3); }
.file-thumb:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}

.icon-button:hover { background: var(--peach); color: var(--ink); }
.icon-button svg { width: 18px; height: 18px; }

/* Envio */
.submit-area {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.turnstile { min-height: 65px; }

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
}

.hint.is-error { color: var(--bad); font-weight: 500; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--r-md);
  font-family: var(--font);
  cursor: pointer;
  transition: background .18s, opacity .18s;
}

/* 19px em negrito conta como texto grande para o contraste AA do branco sobre o Aurora */
.button-primary {
  background: var(--brand);
  color: var(--on-brand);
  font-size: 19px;
  font-weight: 700;
}

.button-primary:hover:not(:disabled) { background: var(--brand-press); }

.button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.button-ghost {
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--line-2);
  font-size: 15px;
  font-weight: 600;
}

.button-ghost:hover { background: var(--peach); }

.spinner { display: none; width: 22px; height: 22px; }
.button[aria-busy="true"] .spinner { display: block; animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .button[aria-busy="true"] .spinner { animation-duration: 2.4s; }
  * { transition: none !important; }
}

/* Alertas: a cor mora no tile do ícone, não na área */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
}

.alert p { margin: 6px 0 0; font-size: 14px; font-weight: 500; }

.alert-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--bad-bg);
  color: var(--bad);
  flex: none;
}

.alert-icon svg { width: 18px; height: 18px; }
.alert-warn .alert-icon { background: var(--warn-bg); color: var(--warn); }

/* Sucesso */
.success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 28px;
}

.success:focus { outline: none; }

.success-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  border-radius: var(--r-lg);
  background: var(--ok-bg);
  color: var(--ok);
}

.success-icon svg { width: 28px; height: 28px; }

.success h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.success > p { margin: 0 0 22px; color: var(--ink-2); max-width: 46ch; }

.protocol {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--canvas);
}

.protocol-label {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
}

.protocol-id {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.copied {
  min-height: 20px;
  margin: 8px 0 14px;
  font-size: 13px;
  color: var(--ok);
  font-weight: 500;
}

.success .alert { text-align: left; max-width: 460px; }

.footer {
  padding: 20px 16px 28px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* Celular */
@media (max-width: 600px) {
  .topbar { padding: 14px 16px; }
  .page { padding: 28px 16px 40px; }
  .intro { padding-right: 76px; margin-bottom: 22px; }
  .sun { width: 60px; top: 0; }
  h1 { font-size: 23px; }
  .card { padding: 20px 16px; }
  .row { grid-template-columns: 1fr; }
  .success { padding: 32px 18px; }
  .protocol-id { font-size: 17px; }
}
