/* Apex Finance — portal do cliente. Ficheiro autónomo: nao usa styles.css. */
:root {
  --bg: #0b0f17;
  --surface: #161d2b;
  --surface-2: #1b2434;
  --borda: rgba(255, 255, 255, .08);
  --borda-forte: rgba(255, 255, 255, .16);
  --texto: #e8eef7;
  --texto-2: #94a3b8;
  --texto-3: #64748b;
  --azul: #3b82f6;
  --azul-esc: #1d4ed8;
  --vermelho: #e11d48;
  --verde: #10b981;
  --ambar: #f59e0b;
  --raio: 12px;
  --sombra: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.fundo {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(59, 130, 246, .16), transparent 60%),
    radial-gradient(700px 420px at 95% 105%, rgba(225, 29, 72, .12), transparent 60%);
}

.portal {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 56px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* -------------------------------------------------------------- topo */
.topo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--borda);
  border-radius: 16px;
  box-shadow: var(--sombra);
}
.logo { width: 46px; height: 46px; border-radius: 10px; object-fit: contain; background: #fff; padding: 3px; }
.topo-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.topo-txt strong { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.topo-txt span { color: var(--texto-2); font-size: 13px; }

.btn-sair {
  margin-left: auto;
  background: transparent;
  color: var(--texto-2);
  border: 1px solid var(--borda-forte);
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.btn-sair:hover { color: var(--texto); border-color: var(--azul); }

/* ------------------------------------------------------------ estados */
.estado {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px;
  background: var(--surface);
  border: 1px solid var(--borda);
  border-radius: 16px;
  color: var(--texto-2);
}
.estado p { margin: 0; }
.estado.erro { color: #fecdd3; border-color: rgba(225, 29, 72, .45); background: rgba(225, 29, 72, .08); }
.estado.erro .spinner { display: none; }
.estado.ok { display: none; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--borda-forte);
  border-top-color: var(--azul);
  border-radius: 50%;
  animation: girar .7s linear infinite;
  flex: 0 0 auto;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------- progresso */
.progresso-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--borda);
  border-radius: 16px;
     box-shadow: var(--sombra);
}
.progresso-txt { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.rotulo { display: block; color: var(--texto-2); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.progresso-txt strong { font-size: 20px; font-weight: 650; }
.pct { font-size: 22px; font-weight: 700; color: var(--azul); font-variant-numeric: tabular-nums; }

.barra {
  margin-top: 12px;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--borda);
}
.barra i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--azul-esc), var(--azul));
  transition: width .45s ease;
}
.barra.completa i { background: linear-gradient(90deg, #059669, var(--verde)); }

.aviso { margin: 10px 0 0; font-size: 13px; color: var(--texto-2); }
.aviso.forte { color: var(--ambar); }

/* -------------------------------------------------------------- lista */
.lista { display: flex; flex-direction: column; gap: 10px; }

.doc {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
}
.doc:hover { border-color: var(--borda-forte); }
.doc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.doc-nome { font-weight: 600; }
.doc-meta { color: var(--texto-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta.alerta { color: var(--vermelho); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.pendente { color: var(--texto-2); background: rgba(148, 163, 184, .12); border-color: var(--borda-forte); }
.badge.recebido { color: #bfdbfe; background: rgba(59, 130, 246, .14); border-color: rgba(59, 130, 246, .4); }
.badge.aprovado { color: #a7f3d0; background: rgba(16, 185, 129, .14); border-color: rgba(16, 185, 129, .4); }
.badge.rejeitado, .badge.vencido { color: #fecdd3; background: rgba(225, 29, 72, .14); border-color: rgba(225, 29, 72, .4); }

.btn-enviar {
  position: relative;
  overflow: hidden;
  background: var(--azul);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-enviar:hover { background: var(--azul-esc); }
.btn-enviar[disabled] { opacity: .55; cursor: progress; }
.btn-enviar input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.rodape { color: var(--texto-3); font-size: 12.5px; text-align: center; margin: 4px 0 0; }

/* ------------------------------------------------------------- toasts */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}
.toast {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  background: var(--surface-2);
  border: 1px solid var(--borda-forte);
  box-shadow: var(--sombra);
  max-width: 320px;
}
.toast.ok { border-color: rgba(16, 185, 129, .5); }
.toast.erro { border-color: rgba(225, 29, 72, .5); }

@media (max-width: 560px) {
  .doc { flex-wrap: wrap; }
  .btn-enviar { width: 100%; text-align: center; }
  .progresso-txt strong { font-size: 18px; }
}

/* ------------------------------------------------- pedido de novo link */
.pedir-link {
  background: var(--surface);
  border: 1px solid var(--borda);
  border-radius: 16px;
  padding: 18px 16px;
  box-shadow: var(--sombra);
}
.pedir-link h2 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 650;
}
.pedir-link p {
  margin: 0 0 12px;
  color: var(--texto-2);
  font-size: .875rem;
}
.pedir-link form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.pedir-link input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 11px 12px;
  color: var(--texto);
  background: var(--surface-2);
  border: 1px solid var(--borda-forte);
  border-radius: var(--raio);
  font: inherit;
}
.pedir-link input:focus-visible {
  outline: 2px solid var(--azul);
  outline-offset: 1px;
}
.pedir-link button {
  padding: 11px 18px;
  color: #fff;
  background: var(--azul-esc);
  border: 1px solid transparent;
  border-radius: var(--raio);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.pedir-link button:hover:not(:disabled) { background: var(--azul); }
.pedir-link button:disabled { opacity: .6; cursor: progress; }
.pedido-ok {
  margin: 0;
  padding: 10px 12px;
  color: #b9f6d4;
  background: rgba(16, 185, 129, .12);
  border: 1px solid rgba(16, 185, 129, .4);
  border-radius: var(--raio);
}
