:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172630;
  background: #f3f1eb;
  --ink: #172630;
  --muted: #52646f;
  --navy: #123d5a;
  --navy-dark: #0b2e45;
  --paper: #fffefa;
  --line: #cbd3d6;
  --soft: #e9edef;
  --accent: #d9822b;
  --danger: #a12626;
  --warning: #765100;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background: #f3f1eb;
}

.page {
  width: min(100% - 1.25rem, 62rem);
  margin: 1rem auto 3rem;
  padding-bottom: env(safe-area-inset-bottom);
}

.page > header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: .6rem .25rem 1rem;
}

.header-copy { max-width: 42rem; }
.header-actions { display: flex; gap: .6rem; }
.header-actions button { flex: 1; }

.eyebrow {
  margin: 0 0 .25rem;
  color: #49606e;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--navy-dark);
  font-size: clamp(1.75rem, 7vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -.035em;
}

header p:last-child { margin: .65rem 0 0; line-height: 1.5; color: var(--muted); }
h2, h3 { color: var(--navy-dark); }

.capture-panel, .result, .login-panel > form, #curation-form {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.capture-panel { border-top: 4px solid var(--navy); }
.result { box-shadow: 0 10px 28px rgb(18 61 90 / 7%); }

.status-panel {
  margin-top: .75rem;
  padding: .9rem 1rem;
  border-left: 4px solid var(--accent);
  background: #fff8ed;
}

label { display: block; margin-bottom: .5rem; font-weight: 750; }
.form-row { display: flex; flex-direction: column; gap: .65rem; }

input, select, textarea, button { font: inherit; }

input, select, textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: .72rem .8rem;
  border: 1px solid #778995;
  border-radius: .35rem;
  background: #fff;
  color: var(--ink);
}

textarea { min-height: 6rem; resize: vertical; }
select, textarea { margin-bottom: 1rem; }

button {
  min-height: 46px;
  padding: .72rem 1rem;
  border: 1px solid var(--navy);
  border-radius: .35rem;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  font-weight: 750;
}

button:hover { background: var(--navy-dark); border-color: var(--navy-dark); }
button:disabled { cursor: wait; opacity: .58; }

.button-secondary { background: transparent; color: var(--navy); }
.button-secondary:hover { color: #fff; }

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--navy);
}

.button-quiet:hover { background: var(--soft); border-color: var(--soft); }

button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, pre:focus-visible {
  outline: 3px solid #f0a53a;
  outline-offset: 2px;
}

.help { margin-bottom: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.status-panel p { margin: .25rem 0; }
.error { color: var(--danger); }
.warning { color: var(--warning); }

.result-heading, .detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
}

.result h2, .detail-heading h3 { margin: 0; }
.result h2 { font-size: 1.22rem; }

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: .2rem .55rem;
  border: 1px solid #9eacb4;
  border-radius: 999px;
  background: var(--soft);
  color: #344d5b;
  font-size: .78rem;
  font-weight: 800;
}

pre {
  max-height: 34rem;
  margin: 1rem 0 0;
  padding: 1rem;
  overflow: auto;
  border: 1px solid #dce2e4;
  border-radius: .35rem;
  background: #f4f6f7;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

[hidden] { display: none !important; }

#queue-list { display: grid; gap: .55rem; list-style: none; padding: 0; }
#queue-list li { margin: 0; }
#queue-list button {
  width: 100%;
  border-color: #b7c3c9;
  background: #f8faf9;
  color: var(--ink);
  text-align: left;
  overflow-wrap: anywhere;
}
#queue-list button:hover { border-color: var(--navy); background: #eef4f6; }
#queue-list button[aria-current="true"] { border-left: 5px solid var(--accent); }
#queue-list button strong, #queue-list button span, #queue-list button small { display: block; }
#queue-list button span { margin-top: .22rem; color: var(--navy); font-size: .86rem; font-weight: 750; }
#queue-list button small { margin-top: .28rem; color: var(--muted); }

.status-badge[data-status="erro"] { border-color: #d29a9a; background: #fff0f0; color: var(--danger); }
.status-badge[data-status="analisando"],
.status-badge[data-status="aguardando_analise"] { border-color: #d8aa6c; background: #fff7e9; color: var(--warning); }
.status-badge[data-status="analisado"] { border-color: #79a88f; background: #edf8f1; color: #245b3d; }

#queue-detail { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.detail-actions { display: grid; gap: .55rem; }
dt { font-weight: 750; }
dd { margin: 0 0 .65rem; color: #334c5a; overflow-wrap: anywhere; }

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}

.login-panel { width: min(100%, 27rem); }
.login-panel > p:not(.eyebrow) { color: var(--muted); line-height: 1.5; }
.login-panel input, .login-panel button { width: 100%; }
.login-panel button { margin-top: 1rem; }

@media (min-width: 48rem) {
  .page { width: min(100% - 3rem, 62rem); margin-top: 2.5rem; }
  .page > header { flex-direction: row; align-items: flex-start; justify-content: space-between; }
  .header-actions { flex: 0 0 auto; }
  .header-actions button { flex: none; }
  .capture-panel, .result { padding: 1.35rem; }
  .form-row { flex-direction: row; }
  .form-row input { flex: 1; min-width: 0; }
  .detail-actions { display: flex; flex-wrap: wrap; }
}

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