/* =========================================================================
   Digisat Assinaturas — Design System
   Direção: "confiança corporativa moderna" — azul Digisat dominante,
   profundidade com gradiente mesh + grão sutil, tipografia Sora + Manrope.
   ========================================================================= */

:root {
  /* Marca */
  --brand: #007fff;
  --brand-600: #0a67d6;
  --brand-700: #0c4f9e;
  --brand-ink: #06213f;
  --cyan: #19c3fe;

  /* Neutros (slate) */
  --ink: #0d1b2a;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --bg: #eef3f9;
  --card: #ffffff;

  /* Estados */
  --success: #15803d; --success-bg: #dcfce7; --success-line: #86efac;
  --danger:  #be123c; --danger-bg:  #ffe4e6; --danger-line:  #fda4af;
  --warn:    #b45309; --warn-bg:    #fef3c7; --warn-line:    #fcd34d;
  --info:    #0369a1; --info-bg:    #e0f2fe; --info-line:    #7dd3fc;

  /* Forma */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(6, 33, 63, .06), 0 1px 3px rgba(6, 33, 63, .07);
  --shadow: 0 6px 14px -6px rgba(6, 33, 63, .12), 0 12px 28px -12px rgba(6, 33, 63, .16);
  --shadow-lg: 0 28px 60px -18px rgba(6, 33, 63, .32);
  --ring: 0 0 0 4px rgba(0, 127, 255, .16);

  --font-display: "Sora", ui-sans-serif, sans-serif;
  --font-body: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --speed: .22s;
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 620px at 100% -12%, rgba(25, 195, 254, .14), transparent 60%),
    radial-gradient(960px 520px at -12% 112%, rgba(0, 127, 255, .12), transparent 55%);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
/* grão sutil por cima de tudo */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { max-width: 100%; display: block; }
a { color: var(--brand-600); text-decoration: none; transition: color var(--speed); }
a:hover { color: var(--brand-700); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ----- Tipografia ----- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; letter-spacing: -.02em; color: var(--brand-ink); }
.display { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; }
.eyebrow { font-family: var(--font-display); font-size: .74rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--brand-600); }
.muted { color: var(--slate-500); }
.small { font-size: .85rem; }

/* ----- Botões ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.25rem; border: 0; border-radius: var(--radius-sm);
  font-family: var(--font-display); font-weight: 600; font-size: .95rem;
  cursor: pointer; position: relative; isolation: isolate; white-space: nowrap;
  transition: transform var(--speed), box-shadow var(--speed), background var(--speed), opacity var(--speed);
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-600) 55%, var(--brand-700) 100%);
  box-shadow: 0 8px 18px -6px rgba(0, 127, 255, .55);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 26px -8px rgba(0, 127, 255, .6); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--brand-700); box-shadow: inset 0 0 0 1.5px var(--slate-200); }
.btn-ghost:hover { background: #fff; box-shadow: inset 0 0 0 1.5px var(--brand); }
.btn-soft { background: var(--info-bg); color: var(--brand-700); }
.btn-soft:hover { background: #d4ecfd; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn-block { width: 100%; }
.btn-lg { padding: .9rem 1.5rem; font-size: 1.02rem; }

/* ----- Campos ----- */
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.field > label { font-size: .82rem; font-weight: 600; color: var(--slate-600); }
.field .hint { font-size: .76rem; color: var(--slate-400); }
.control, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="file"], select, textarea {
  width: 100%; padding: .72rem .9rem;
  background: #fff; color: var(--ink);
  border: 1.5px solid var(--slate-200); border-radius: var(--radius-sm);
  transition: border-color var(--speed), box-shadow var(--speed), background var(--speed);
}
input::placeholder, textarea::placeholder { color: var(--slate-400); }
.control:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: var(--ring);
}
input.is-valid { border-color: var(--success-line); }
input.is-invalid { border-color: var(--danger-line); box-shadow: 0 0 0 4px rgba(190, 18, 60, .1); }
input[type="file"] { padding: .55rem .6rem; background: var(--slate-50); cursor: pointer; }
input[type="file"]::file-selector-button {
  margin-right: .8rem; padding: .45rem .8rem; border: 0; border-radius: 8px;
  background: var(--brand-ink); color: #fff; font-family: var(--font-display); font-weight: 600; cursor: pointer;
}
textarea { resize: vertical; min-height: 70px; }

/* ----- Card ----- */
.card {
  background: var(--card); border: 1px solid rgba(6, 33, 63, .06);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1.6rem;
}
.card__head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.1rem; }
.card__head h2 { font-size: 1.15rem; }
.card__icon {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px;
  display: grid; place-items: center; color: var(--brand-700);
  background: linear-gradient(135deg, var(--info-bg), #fff); box-shadow: inset 0 0 0 1px var(--info-line);
}

/* ----- Alert / Toast ----- */
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; border: 1px solid transparent; }
.alert svg { flex: 0 0 auto; margin-top: 2px; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-line); }
.alert-warn    { background: var(--warn-bg);    color: var(--warn);    border-color: var(--warn-line); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info-line); }

#toasts { position: fixed; top: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .6rem; max-width: min(92vw, 380px); }
.toast { padding: .85rem 1rem; border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow-lg); border-left: 4px solid var(--brand); font-size: .9rem; animation: slideIn .3s ease both; }
.toast.is-success { border-color: var(--success); }
.toast.is-danger { border-color: var(--danger); }
.toast.is-warn { border-color: var(--warn); }

/* ----- Badge ----- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: 999px; font-size: .74rem; font-weight: 700; font-family: var(--font-display); letter-spacing: .01em; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--slate-100); color: var(--slate-500); }

/* ----- Spinner ----- */
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(0, 127, 255, .25); border-top-color: var(--brand); animation: spin .7s linear infinite; display: inline-block; }
.spinner-lg { width: 46px; height: 46px; border-width: 4px; }
/* spinner sobre botão de fundo escuro/azul (mantém o contraste branco) */
.spinner-on-dark { border-color: rgba(255, 255, 255, .45); border-top-color: #fff; }
.loading-overlay { display: flex; flex-direction: column; align-items: center; gap: .9rem; padding: 2rem; color: var(--slate-600); }

/* ----- Layout shell / topbar ----- */
.shell { width: 100%; max-width: 1080px; margin: 0 auto; padding: 1.5rem; position: relative; z-index: 1; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-200);
}
.topbar__in { max-width: 1080px; margin: 0 auto; padding: .8rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.topbar img { height: 34px; width: auto; }
.usermenu { display: flex; align-items: center; gap: .8rem; font-size: .9rem; }
.usermenu .avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-weight: 700; background: linear-gradient(135deg, var(--brand), var(--brand-700)); }

/* ----- Grid ----- */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* =========================================================================
   AUTENTICAÇÃO (login) — split screen
   ========================================================================= */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; position: relative; z-index: 1; }
.auth__hero {
  position: relative; overflow: hidden; color: #eaf4ff; padding: 3rem;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(25, 195, 254, .35), transparent 55%),
    radial-gradient(700px 500px at 90% 90%, rgba(10, 79, 158, .55), transparent 60%),
    linear-gradient(150deg, #062f63 0%, #06213f 60%, #041527 100%);
}
.auth__hero::after {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 46px 46px; -webkit-mask-image: radial-gradient(circle at 30% 30%, #000, transparent 75%);
          mask-image: radial-gradient(circle at 30% 30%, #000, transparent 75%);
}
.auth__hero > * { position: relative; z-index: 1; }
.brandmark { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; display: flex; align-items: center; gap: .6rem; }
.brandmark .dot { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--cyan), var(--brand)); box-shadow: 0 0 18px var(--cyan); }
.hero-copy h1 { color: #fff; font-size: clamp(1.9rem, 3.4vw, 2.9rem); font-weight: 800; }
.hero-copy p { color: #b9d2ee; max-width: 42ch; margin-top: 1rem; }
.hero-points { list-style: none; padding: 0; margin-top: 1.8rem; display: flex; flex-direction: column; gap: .8rem; }
.hero-points li { display: flex; gap: .7rem; align-items: center; color: #cfe2f7; font-size: .95rem; }
.hero-points svg { color: var(--cyan); flex: 0 0 auto; }
.hero-foot { font-size: .8rem; color: #7fa6cf; }
.auth__panel { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth__box { width: 100%; max-width: 380px; }
.auth__box .logo { height: 40px; width: auto; margin-bottom: 1.8rem; }
.auth__box h2 { font-size: 1.6rem; }
.auth__box .sub { color: var(--slate-500); margin: .35rem 0 1.8rem; }
.status-row { display: flex; gap: 1rem; margin-top: 1.4rem; font-size: .78rem; color: var(--slate-500); border-top: 1px solid var(--slate-200); padding-top: 1rem; flex-wrap: wrap; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth__hero { display: none; }
  .auth__panel { min-height: 100vh; }
}

/* =========================================================================
   PAINEL
   ========================================================================= */
.page-head { margin-bottom: 1.6rem; }
.page-head h1 { font-size: 1.7rem; }
.envios { display: flex; flex-direction: column; gap: 1rem; }
.envio {
  background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; transition: box-shadow var(--speed), transform var(--speed);
  border-left: 4px solid var(--slate-300);
}
.envio:hover { box-shadow: var(--shadow); }
.envio.is-signed { border-left-color: var(--success); }
.envio.is-pending { border-left-color: var(--warn); }
.envio.is-waiting { border-left-color: var(--slate-300); }
.envio__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.envio__mail { font-weight: 700; font-family: var(--font-display); color: var(--brand-ink); word-break: break-all; }
.envio__meta { font-size: .82rem; color: var(--slate-500); margin-top: .15rem; }
.envio__docs { margin-top: .9rem; display: flex; flex-direction: column; gap: .45rem; }
.docline { display: flex; align-items: center; gap: .5rem; font-size: .9rem; padding: .5rem .7rem; background: var(--slate-50); border-radius: 9px; flex-wrap: wrap; }
.docline.is-missing { background: var(--danger-bg); }
.docline .doc-name { font-weight: 600; }
.docline .spacer { flex: 1; }
.linkbtn { background: none; border: 0; color: var(--brand-600); cursor: pointer; font-weight: 600; font-size: .85rem; padding: 0; }
.linkbtn:hover { color: var(--brand-700); text-decoration: underline; }
.filters { display: inline-flex; background: #fff; border: 1px solid var(--slate-200); border-radius: 999px; padding: .25rem; gap: .25rem; }
.filters a { padding: .35rem .9rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--slate-500); }
.filters a.active { background: var(--brand); color: #fff; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--slate-400); }

/* checkbox docs no formulário de envio */
.checks { display: flex; flex-direction: column; gap: .55rem; }
.check { display: flex; align-items: center; gap: .6rem; padding: .7rem .85rem; border: 1.5px solid var(--slate-200); border-radius: var(--radius-sm); cursor: pointer; transition: border-color var(--speed), background var(--speed); }
.check:hover { border-color: var(--brand); }
.check input { width: auto; }
.check.checked { border-color: var(--brand); background: var(--info-bg); }

/* =========================================================================
   CADASTRO
   ========================================================================= */
.cad-wrap { max-width: 880px; margin: 0 auto; padding: 1.5rem; position: relative; z-index: 1; }
.cad-header { text-align: center; margin: 1rem 0 2rem; }
.cad-header img { height: 44px; width: auto; margin: 0 auto 1rem; }
.section { margin-bottom: 1.4rem; }
.section__title { display: flex; align-items: center; gap: .7rem; font-family: var(--font-display); font-weight: 700; color: var(--brand-ink); font-size: 1.05rem; margin-bottom: 1rem; }
.section__num { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .85rem; flex: 0 0 auto; }
.consent { display: flex; gap: .65rem; align-items: flex-start; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-sm); padding: 1rem; font-size: .86rem; color: var(--slate-600); }
.consent input { width: auto; margin-top: 3px; }

/* =========================================================================
   ASSINAR (wizard)
   ========================================================================= */
.sign-wrap { max-width: 1000px; margin: 0 auto; padding: 1.5rem; position: relative; z-index: 1; }
.stepper { display: flex; align-items: center; gap: .5rem; justify-content: center; margin: 1.4rem 0; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: .5rem; }
.step .bubble { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: .9rem; background: #fff; border: 2px solid var(--slate-300); color: var(--slate-400); transition: all var(--speed); }
.step.active .bubble { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--ring); }
.step.done .bubble { background: var(--success); border-color: var(--success); color: #fff; }
.step .bar { width: 40px; height: 2px; background: var(--slate-200); }
.frame-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--slate-200); }
.frame-card iframe { width: 100%; height: 72vh; border: 0; display: block; background: var(--slate-50); }
.wizard-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; }
.success-screen { text-align: center; padding: 3rem 1.5rem; }
.success-screen .check-ring { width: 84px; height: 84px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: grid; place-items: center; margin: 0 auto 1.4rem; animation: pop .5s cubic-bezier(.2,1.3,.4,1) both; }

/* =========================================================================
   ERRO
   ========================================================================= */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem; position: relative; z-index: 1; }
.error-card { text-align: center; max-width: 460px; }
.error-card .big { font-family: var(--font-display); font-weight: 800; font-size: 5rem; color: var(--brand); line-height: 1; letter-spacing: -.04em; }

/* =========================================================================
   Animações
   ========================================================================= */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.reveal { opacity: 0; animation: fadeUp .6s cubic-bezier(.2,.7,.3,1) forwards; }
.reveal:nth-child(1) { animation-delay: .04s; }
.reveal:nth-child(2) { animation-delay: .12s; }
.reveal:nth-child(3) { animation-delay: .2s; }
.reveal:nth-child(4) { animation-delay: .28s; }
.reveal:nth-child(5) { animation-delay: .36s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* utilitários */
.hidden { display: none !important; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.text-center { text-align: center; }
.row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
