/* ============================================================
   Transcritor — Critério
   Sistema de design: Inter self-hosted + azul institucional Critério
   ============================================================ */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Tipografia */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Azul institucional Critério (amostrado do logo) */
  --blue-50:  #eef5fc;
  --blue-100: #d6e8f7;
  --blue-200: #aed2ef;
  --blue-300: #7db6e3;
  --blue-400: #3f92d2;
  --blue-500: #1276be;  /* CTA base */
  --blue-600: #0e5e9c;  /* hover (escurece) */
  --blue-700: #0c4a7b;  /* active / links */
  --blue-800: #0f3a61;
  --blue-900: #16294a;  /* navy do wordmark */

  /* Texto */
  --ink:   #16243f;   /* títulos */
  --ink-2: #33405c;   /* corpo */
  --muted: #5b647b;   /* secundário (AA em branco) */

  /* Superfícies e linhas */
  --bg:        #f4f7fb;
  --surface:   #ffffff;
  --line:      #e3e9f2;
  --soft-line: #edf1f8;

  /* Estados */
  --success:    #1a8452;
  --success-bg: #e7f4ec;
  --danger:     #c33b2c;
  --danger-bg:  #fbeae8;

  /* Escala de espaço (base-4) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px;

  /* Raio */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;

  /* Sombra em duas camadas */
  --shadow-sm: 0 1px 2px rgba(16, 36, 70, 0.06);
  --shadow-md: 0 1px 2px rgba(16, 36, 70, 0.06), 0 12px 28px -10px rgba(16, 36, 70, 0.12);
  --shadow-lg: 0 1px 3px rgba(16, 36, 70, 0.07), 0 24px 48px -16px rgba(16, 36, 70, 0.16);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(60rem 32rem at 8% -8%, rgba(18, 118, 190, 0.10), transparent 60%),
    radial-gradient(48rem 30rem at 100% 0%, rgba(63, 146, 210, 0.07), transparent 55%),
    linear-gradient(180deg, #f9fbfe 0%, var(--bg) 100%);
  background-attachment: fixed;
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-feature-settings: "cv05" 1, "ss01" 1;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-700); }

.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */

.shell {
  width: min(1060px, calc(100% - 2 * var(--s-5)));
  margin: 0 auto;
  padding: var(--s-8) 0 var(--s-16);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding-bottom: var(--s-6);
  margin-bottom: var(--s-10);
  border-bottom: 1px solid var(--soft-line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
  text-decoration: none;
  border-radius: var(--r-sm);
}

.brand img {
  display: block;
  width: 132px;
  height: auto;
}

.masthead-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--muted);
}

.masthead-tag::before {
  content: "";
  width: 1px;
  height: 22px;
  background: var(--line);
}

.product {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--blue-700);
  text-transform: uppercase;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  gap: var(--s-6);
  align-items: start;
}

/* Telas de fluxo único (job, upload, erro) ocupam a coluna toda */
.workspace.single { grid-template-columns: minmax(0, 1fr); }
.workspace.single .panel { max-width: 760px; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: clamp(24px, 4vw, 44px);
}

/* ---------- Tipografia ---------- */

h1 {
  margin: 0 0 var(--s-4);
  color: var(--ink);
  font-size: clamp(34px, 4.6vw, 52px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.04;
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.lede {
  max-width: 60ch;
  margin: 0 0 var(--s-6);
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0 0 var(--s-4);
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--blue-500);
}

.meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ico {
  flex: none;
  vertical-align: middle;
}

/* ---------- Botões ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 48px;
  padding: 0 var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font: inherit;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.btn .ico { font-size: 19px; }

.btn--primary {
  background: linear-gradient(180deg, var(--blue-500), var(--blue-600));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: linear-gradient(180deg, var(--blue-600), var(--blue-700)); transform: translateY(-1px); }
.btn--primary:active { transform: translateY(0); }

.btn--ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.btn--ghost:hover { border-color: var(--blue-300); background: var(--blue-50); }

.btn--block { width: 100%; }

.btn[disabled], .btn[aria-disabled="true"] {
  cursor: progress;
  opacity: 0.85;
  transform: none;
}

/* ---------- Home: dropzone + upload ---------- */

.upload-form { display: grid; gap: var(--s-4); }

.dropzone {
  display: grid;
  justify-items: center;
  gap: var(--s-3);
  padding: var(--s-10) var(--s-6);
  border: 1.5px dashed var(--blue-200);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #fbfdff, var(--blue-50));
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.dropzone:hover,
.dropzone:focus-within,
.dropzone.is-dragover {
  border-color: var(--blue-500);
  background: var(--blue-50);
  box-shadow: inset 0 0 0 3px rgba(18, 118, 190, 0.06);
}

.dropzone.is-dragover { border-style: solid; }

.dropzone-prompt {
  display: grid;
  justify-items: center;
  gap: var(--s-3);
}
.dropzone-title, .dropzone-hint { display: block; }

.dropzone input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: var(--r-pill);
  background: #fff;
  border: 1px solid var(--blue-100);
  color: var(--blue-500);
  font-size: 26px;
  box-shadow: var(--shadow-sm);
}

.dropzone-title { color: var(--ink); font-size: 18px; font-weight: 600; }
.dropzone-hint  { color: var(--muted); font-size: 14px; line-height: 1.45; max-width: 42ch; }

/* estado: arquivo escolhido */
.dropzone.has-file {
  border-style: solid;
  border-color: var(--blue-400);
  background: var(--surface);
}
.dropzone.has-file .dropzone-icon { color: var(--success); border-color: var(--success); background: var(--success-bg); }

.dropzone-file {
  display: none;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  max-width: 420px;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  text-align: left;
}
.dropzone.has-file .dropzone-file { display: flex; }
.dropzone.has-file .dropzone-prompt { display: none; }

.dropzone-file .ico { font-size: 20px; color: var(--blue-600); }
.dropzone-file-meta { min-width: 0; }
.dropzone-file-name { display: block; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; text-align: left; }
.dropzone-file-size { display: block; color: var(--muted); font-size: 13px; text-align: left; }
.dropzone-file-swap { margin-left: auto; color: var(--blue-700); font-size: 13px; font-weight: 600; white-space: nowrap; }

.field-error {
  display: none;
  align-items: center;
  gap: var(--s-2);
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}
.field-error.show { display: flex; }
.field-error .ico { font-size: 17px; }

/* barra de progresso de upload (enquanto envia) */
.upload-progress { display: none; gap: var(--s-2); }
.upload-progress.show { display: grid; }
.upload-progress-label {
  display: flex; justify-content: space-between; gap: var(--s-3);
  color: var(--muted); font-size: 14px;
}
.upload-progress-label strong { color: var(--ink); font-weight: 600; }

/* ---------- Home: aside de especificações ---------- */

.specs {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.spec {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
}
.spec + .spec { border-top: 1px solid var(--soft-line); }

.spec-icon {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 20px;
}
.spec-label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.spec-value { color: var(--ink); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }

.specs-note {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-4);
  border-top: 1px solid var(--soft-line);
  background: var(--blue-50);
  color: var(--muted); font-size: 13px; line-height: 1.4;
}
.specs-note .ico { font-size: 18px; color: var(--blue-500); }

/* ---------- Job: cabeçalho ---------- */

.job-title {
  display: flex; align-items: center; gap: var(--s-3);
  margin: 0 0 var(--s-5);
  color: var(--ink); font-size: 21px; font-weight: 600; letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.job-title .ico { font-size: 22px; color: var(--blue-600); }

/* chip de status (andamento) — não é botão */
.status-chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-pill);
  background: var(--blue-50);
  color: var(--blue-700);
  font-size: 14px; font-weight: 600;
}
.status-chip.ok    { background: var(--success-bg); color: var(--success); }
.status-chip.error { background: var(--danger-bg);  color: var(--danger); }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(12, 74, 123, 0.28);
  border-top-color: var(--blue-600);
  border-radius: var(--r-pill);
  animation: spin 800ms linear infinite;
}

/* ---------- Job: progresso ---------- */

.progress-card {
  display: grid; gap: var(--s-4);
  margin: var(--s-5) 0;
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #fbfdff, var(--blue-50));
}

.progress-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4);
  color: var(--muted); font-size: 14px; line-height: 1.5;
}
.progress-head strong { color: var(--ink); font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.progress-detail { text-align: right; }

.progress-track {
  height: 10px; overflow: hidden;
  border-radius: var(--r-pill);
  background: #e2ebf5;
}
.progress-track span {
  display: block; height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-500), var(--blue-400));
  transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* estado indeterminado (percentual = 0) */
.progress-track.indeterminate span {
  width: 34% !important;
  background: linear-gradient(90deg, transparent, var(--blue-400), transparent);
  animation: indet 1.2s ease-in-out infinite;
}

.progress-foot {
  display: flex; align-items: center; gap: var(--s-2);
  color: var(--muted); font-size: 13px;
}
.progress-foot .ico { font-size: 15px; }

.live-block { margin-top: var(--s-5); }
.live-block .meta { display: block; margin-bottom: var(--s-2); }

.empty-note {
  display: flex; align-items: center; gap: var(--s-3);
  margin-top: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-sm);
  background: var(--blue-50);
  color: var(--muted); font-size: 14px; line-height: 1.5;
}
.empty-note .ico { font-size: 20px; color: var(--blue-400); }

.refresh-note { margin: var(--s-5) 0 0; color: var(--muted); font-size: 14px; }

.waiting-quip {
  margin: var(--s-4) 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  transition: opacity 350ms ease;
}

/* ---------- Transcrição (texto) ---------- */

.transcript {
  max-height: 520px;
  margin: 0;
  padding: var(--s-5);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.transcript--live { max-height: 300px; background: #fbfdff; }

/* ---------- Job: sucesso ---------- */

.result-head {
  display: flex; align-items: flex-start; gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.result-head .result-badge {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border-radius: var(--r-pill);
  background: var(--success-bg); color: var(--success);
  font-size: 26px;
}
.result-head--error .result-badge { background: var(--danger-bg); color: var(--danger); }
.result-head h1 { margin: 0; font-size: 26px; line-height: 1.15; }
.result-head p { margin: var(--s-1) 0 0; color: var(--muted); font-size: 15px; }

.transcript-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.transcript-card > .transcript { border: 0; border-radius: 0; max-height: 560px; }

.transcript-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--soft-line);
  background: #fbfdff;
}
.transcript-header .meta { margin: 0; }
.transcript-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.btn--sm { min-height: 38px; padding: 0 var(--s-3); font-size: 14px; }
.btn--sm .ico { font-size: 17px; }

/* ---------- Job: arquivos ---------- */

.files-section { margin-top: var(--s-8); padding-top: var(--s-6); border-top: 1px solid var(--soft-line); }
.files-section > .meta { display: block; margin-bottom: var(--s-3); }

.files { display: grid; gap: var(--s-2); }

.file-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}
.file-row:hover { border-color: var(--blue-300); background: var(--blue-50); transform: translateY(-1px); }

.file-row-icon {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: none;
  border-radius: var(--r-sm);
  background: var(--blue-50); color: var(--blue-600);
  font-size: 20px;
}
.file-row--zip .file-row-icon { background: #eef1f6; color: var(--blue-800); }
.file-row-body { min-width: 0; flex: 1; }
.file-row-name { display: block; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; line-height: 1.35; }
.file-row-desc { display: block; color: var(--muted); font-size: 13px; }
.file-row-dl { color: var(--muted); font-size: 20px; flex: none; }
.file-row:hover .file-row-dl { color: var(--blue-600); }

.next-step { margin-top: var(--s-8); padding-top: var(--s-6); border-top: 1px solid var(--soft-line); }

.split-note {
  display: flex; gap: var(--s-3);
  margin-bottom: var(--s-5);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  color: var(--ink-2); font-size: 15px; line-height: 1.55;
}
.split-note .ico { font-size: 22px; color: var(--blue-600); flex: none; margin-top: 2px; }

.error-detail {
  margin: var(--s-4) 0 var(--s-6);
  padding: var(--s-4);
  border-radius: var(--r-sm);
  background: #fbfbfc;
  border: 1px solid var(--soft-line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px; line-height: 1.5;
  overflow-wrap: anywhere;
}

/* ---------- Foco visível ---------- */

:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.btn:focus-visible { outline-offset: 3px; }
.dropzone:focus-within { outline: none; }

/* ---------- Animações ---------- */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes indet {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .spinner { animation: none; border-top-color: var(--blue-600); }
  .progress-track.indeterminate span { animation: none; width: 100% !important; background: var(--blue-300); }
  .btn:hover, .file-row:hover { transform: none; }
}

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

@media (max-width: 800px) {
  .workspace { grid-template-columns: 1fr; }
  .shell { padding-top: var(--s-6); }
  .topbar { margin-bottom: var(--s-6); }
  .brand img { width: 116px; }
  h1 { font-size: 32px; }
  .progress-head { flex-direction: column; gap: var(--s-2); }
  .progress-detail { text-align: left; }
  .transcript-actions { width: 100%; }
  .transcript-actions .btn { flex: 1; }
}


/* ===== Integração CritérioLab (19/08/2026) ===== */
:root {
  --blue-500: #0f70b7;
  --blue-600: #0c5a94;
  --blue-700: #0c5a94;
  --blue-900: #172554;
  --bg: #f8fafc;
  --line: #e2e8f0;
  --blue-100: #dbeafe;
  --font-titulo: "Space Grotesk", "Inter", system-ui, sans-serif;
}
.topbar {
  background: linear-gradient(135deg, #172554, #0f172a);
  border-radius: 14px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.topbar .brand, .topbar .masthead-tag { display: none; }
.lab-volta { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.lab-nome { font-family: var(--font-titulo); font-weight: 700; font-size: 20px; color: #fff; letter-spacing: -0.01em; }
.lab-nome b { color: #7cc4f0; font-weight: 700; }
.lab-sep { width: 1px; height: 22px; background: rgba(255,255,255,.25); }
.lab-produto { font-family: var(--font-titulo); font-weight: 600; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #93c5fd; }
.lab-voltar-txt { margin-left: auto; font-family: var(--font-titulo); font-size: 13px; font-weight: 600; color: #cbd5e1; text-decoration: none; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; padding: 6px 12px; transition: color .15s, border-color .15s; }
.lab-voltar-txt:hover { color: #fff; border-color: rgba(255,255,255,.6); }
h1, h2.panel-title, .eyebrow { font-family: var(--font-titulo); }
@media (max-width: 560px) { .lab-voltar-txt { display: none; } .lab-produto { letter-spacing: .08em; } }
