:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --text: #181f2d;
  --muted: #5b6478;
  --border: #e3e7ef;
  --primary: #4864a7;
  --primary-text: #ffffff;
  --primary-soft: #e8edf8;
  --ok: #006168;
  --ok-soft: #e0f1ee;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --danger: #b3261e;
  --grad: linear-gradient(90deg, #006168, #70ac83);
  --shadow: 0 1px 2px rgba(24, 31, 45, 0.06), 0 8px 24px rgba(24, 31, 45, 0.06);
  --radius: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #181f2d;
  --surface: #1f2738;
  --surface-2: #263047;
  --text: #f2f4f8;
  --muted: #a3acbf;
  --border: #2e3a52;
  --primary: #7b93cf;
  --primary-text: #131a29;
  --primary-soft: #26314b;
  --ok: #70ac83;
  --ok-soft: #1d3a36;
  --warn: #f0b95a;
  --warn-soft: #3a2f1a;
  --danger: #f2897f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Sora", system-ui, sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  transition: background 0.2s, color 0.2s;
}
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; gap: 20px;
}
.logo { height: 44px; width: 196px; overflow: hidden; flex: none; display: block; }
.logo img { height: 86px; width: auto; max-width: none; margin: -22px 0 0 -22px; display: block; }
.logo .logo-dark { display: none; }
:root[data-theme="dark"] .logo .logo-light { display: none; }
:root[data-theme="dark"] .logo .logo-dark { display: block; }
.topbar-progress { flex: 1; min-width: 0; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.progress-label strong { color: var(--text); font-weight: 700; font-size: 13px; }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.bar > i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 99px; transition: width 0.5s cubic-bezier(.2,.8,.2,1); }
.theme-toggle {
  flex: none; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; display: grid; place-items: center; color: var(--text);
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }

/* Layout */
.layout { max-width: 1120px; margin: 0 auto; padding: 28px 24px 80px; display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: start; }
.welcome { grid-column: 1 / -1; }
.welcome h1 { font-size: 26px; font-weight: 700; }
.welcome p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.steps { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 6px; }
.step-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; cursor: pointer; text-align: left; width: 100%;
}
.step-link:hover { background: var(--surface); }
.step-link[aria-current="step"] { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
.step-dot {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.step-link.done .step-dot { background: var(--ok); color: #fff; border-color: var(--ok); }
:root[data-theme="dark"] .step-link.done .step-dot { color: #10231f; }
.step-dot svg { width: 16px; height: 16px; }
.step-meta { min-width: 0; }
.step-meta b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.step-meta small { color: var(--muted); font-size: 12px; }

/* Panel */
.panel { min-width: 0; }
.panel-head { margin-bottom: 18px; }
.panel-head .eyebrow { font-size: 12px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.08em; }
.panel-head h2 { font-size: 22px; font-weight: 700; margin-top: 4px; }
.panel-head p { margin: 6px 0 0; color: var(--muted); }

.item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px;
  box-shadow: var(--shadow); transition: border-color 0.2s;
}
.item.sent { border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.item.na { border-style: dashed; opacity: 0.85; }
.item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.item-label { font-weight: 600; font-size: 15px; }
.item-help { color: var(--muted); font-size: 13px; margin-top: 3px; }
.badge { flex: none; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.badge.pending { background: var(--surface-2); color: var(--muted); }
.badge.editing { background: var(--primary-soft); color: var(--primary); }
.badge.sent { background: var(--ok-soft); color: var(--ok); }
.badge.na { background: var(--surface-2); color: var(--muted); }

.field { margin-top: 14px; }
.field input[type="text"], .field textarea, .field select {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); padding: 11px 13px; outline: none;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.field input:disabled, .field textarea:disabled { opacity: 0.75; cursor: not-allowed; background: var(--surface-2); }
.options { display: flex; flex-direction: column; gap: 8px; }
.option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--bg); }
.option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.option:has(input:disabled) { cursor: not-allowed; opacity: 0.8; }
.option input { accent-color: var(--primary); width: 16px; height: 16px; }
.cred { margin-top: 12px; display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px; background: var(--warn-soft); color: var(--text); font-size: 13.5px; cursor: pointer; }
.cred input { margin-top: 3px; accent-color: var(--ok); width: 16px; height: 16px; }
.cred small { display: block; color: var(--muted); margin-top: 2px; }

.drop {
  border: 2px dashed var(--border); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; background: var(--bg);
}
.drop:hover, .drop.over { border-color: var(--primary); color: var(--text); background: var(--primary-soft); }
.drop strong { color: var(--primary); }
.file-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-2); border-radius: 10px; font-size: 13.5px; }
.file-list .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fsize { color: var(--muted); font-size: 12px; }
.file-list button { border: 0; background: none; color: var(--danger); cursor: pointer; font-size: 12.5px; font-weight: 600; }

.actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 10px 18px; font-weight: 600; font-size: 14px; cursor: pointer;
  transition: transform 0.05s, background 0.15s, opacity 0.15s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.primary:hover:not(:disabled) { background: var(--primary); filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.finish { background: var(--ok); border-color: var(--ok); color: #fff; padding: 13px 26px; font-size: 15px; }
:root[data-theme="dark"] .btn.finish { color: #10231f; }
.btn.finish:hover:not(:disabled) { background: var(--ok); filter: brightness(1.1); }
.btn:focus-visible, .step-link:focus-visible, .theme-toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 2px; }

.step-footer {
  margin-top: 22px; padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.step-footer.done { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.step-footer p { margin: 0; color: var(--muted); font-size: 13.5px; }
.step-footer.done p { color: var(--ok); font-weight: 600; }

.all-done { margin-bottom: 20px; padding: 22px; border-radius: var(--radius); background: var(--grad); color: #fff; box-shadow: var(--shadow); }
.all-done h2 { font-size: 20px; }
.all-done p { margin: 6px 0 0; opacity: 0.95; }

/* Full-screen states */
.center { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.center img { width: 72px; height: 72px; }
.center h1 { font-size: 22px; margin-top: 14px; }
.center p { color: var(--muted); max-width: 42ch; margin: 8px auto 0; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; transform: scale(0.94); } }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow); animation: in 0.2s ease-out; max-width: 340px; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 20px 16px 70px; gap: 18px; }
  .steps { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 6px; gap: 8px; scrollbar-width: thin; }
  .step-link { width: auto; flex: none; padding: 8px 12px; border-color: var(--border); background: var(--surface); }
  .step-meta small { display: none; }
  .step-meta b { white-space: nowrap; font-size: 12.5px; }
  .topbar-inner { padding: 8px 16px; gap: 12px; flex-wrap: wrap; }
  .logo { width: 156px; height: 36px; }
  .logo img { height: 68px; margin: -17px 0 0 -18px; }
  .topbar-progress { order: 3; flex-basis: 100%; }
  .welcome h1 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Tela inicial e área Sigma */
.home { max-width: 920px; margin: 0 auto; padding: 56px 24px 80px; }
.home.narrow { max-width: 460px; padding-top: 72px; }
.hero { text-align: center; margin-bottom: 36px; }
.hero-icon { width: 72px; height: 72px; }
.hero h1 { font-size: 32px; font-weight: 800; margin-top: 14px; }
.hero p { color: var(--muted); max-width: 56ch; margin: 10px auto 0; }
.home-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h2 { font-size: 18px; font-weight: 700; }
.card p { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.card.sigma { background: var(--surface-2); }
.card .field input { width: 100%; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); padding: 11px 13px; outline: none; }
.card .field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
a.btn { text-decoration: none; display: inline-block; color: inherit; }
.muted { color: var(--muted); font-size: 13px; }

.admin { max-width: 920px; margin: 0 auto; padding: 32px 24px 80px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.admin-head h1 { font-size: 26px; font-weight: 700; }
.admin-head p { margin: 4px 0 0; }
.list-title { font-size: 17px; margin: 28px 0 12px; }
.created { margin-top: 16px; padding: 14px; border-radius: 10px; background: var(--ok-soft); display: flex; flex-direction: column; gap: 8px; }
.created code { word-break: break-all; font-size: 13px; background: var(--surface); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); }
.created .actions { margin: 0; }
.client-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; align-items: center; }
.client-main strong { display: block; font-size: 16px; }
.client-row .actions { grid-column: 1 / -1; margin: 0; }
.client-bar .progress-label { margin-bottom: 6px; }

@media (max-width: 860px) {
  .home-cards, .client-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 24px; }
  .home { padding-top: 32px; }
}

/* Telas com fundo ilustrado (início e login Sigma). O bg já traz o logo no centro:
   o conteúdo se organiza acima e abaixo dele. */
body.has-stage { background: #031122; }
.stage {
  --imgH: max(100vh, 56.28vw);
  --top-h: calc(50vh - 0.0611 * var(--imgH) - 16px);
  --gap-h: calc(0.0914 * var(--imgH) + 44px);
  position: relative; min-height: 100vh; color: #f2f4f8;
  background: url("assets/bg.webp") center / cover no-repeat, #031122;
  display: flex; flex-direction: column; align-items: center; padding: 0 20px 56px;
}
.stage-top { height: var(--top-h); min-height: 120px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; text-align: center; padding-bottom: 8px; }
.stage-top h1 { font-size: clamp(24px, 3.4vw, 36px); font-weight: 800; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55); }
.stage-top p { margin: 8px 0 0; max-width: 64ch; text-wrap: balance; color: rgba(242, 244, 248, 0.82); text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6); }
.stage-gap { height: var(--gap-h); flex: none; }
.stage .home-cards { width: 100%; max-width: 860px; }
.stage .home-cards.single { max-width: 400px; grid-template-columns: 1fr; }
.card.glass { background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); border-color: color-mix(in srgb, var(--border) 70%, transparent); }
.topbar.bare { position: absolute; left: 0; right: 0; background: transparent; border: 0; backdrop-filter: none; }
.topbar.bare .topbar-inner { justify-content: flex-end; }
.topbar.bare .theme-toggle { background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(8px); }

@media (max-width: 860px) {
  .stage {
    --imgH: 129.4vw;
    --top-h: calc(0.4389 * var(--imgH) - 16px);
    --gap-h: calc(0.0914 * var(--imgH) + 44px);
    background: url("assets/bg.webp") top center / 230% auto no-repeat, #031122;
  }
  .stage::before { content: ""; position: absolute; left: 0; right: 0; top: calc(var(--imgH) * 0.62); height: calc(var(--imgH) * 0.38); background: linear-gradient(transparent, #031122); pointer-events: none; }
  .stage > * { position: relative; }
  .stage-top h1 { font-size: 22px; }
}

.stage .card { color: var(--text); }
:root:not([data-theme="dark"]) .card.glass { background: color-mix(in srgb, var(--surface) 90%, transparent); }
.topbar.bare .topbar-inner { max-width: none; padding: 12px 24px; }
