:root {
  --bg: #000000;
  --panel: #0c0c0c;
  --panel-2: #141414;
  --line: #262626;
  --ink: #ffffff;
  --muted: #9b9b9b;
  --lime: #D6DE23;
  --lime-ink: #000000;
  --green: #00A652;
  --deep: #006838;
  --radius: 10px;
  --display: 'Bricolage Grotesque', 'Helvetica Neue', sans-serif;
  --body: 'IBM Plex Sans', 'Helvetica Neue', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 12% -8%, rgba(214, 222, 35, 0.13), transparent 62%),
    radial-gradient(700px 600px at 110% 30%, rgba(0, 104, 56, 0.22), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--body);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.55;
}
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-weight: 600; letter-spacing: 0.08em; font-size: 0.72rem; text-transform: uppercase; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: var(--ink); }

/* ---------- telas de entrada ---------- */
.screen { min-height: 100vh; display: flex; align-items: center; padding: 48px 20px; }
.screen-inner { width: 100%; max-width: 680px; margin: 0 auto; animation: rise 0.7s var(--ease) both; }
.screen-logo { width: 44px; height: 44px; border-radius: 10px; display: block; margin-bottom: 40px; }
.kicker { color: var(--lime); margin: 0 0 14px; }
.display { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 8vw, 4.6rem); line-height: 0.96; letter-spacing: -0.03em; margin: 0 0 22px; }
.lead { font-family: var(--display); font-weight: 300; font-size: clamp(1.3rem, 3.4vw, 1.75rem); line-height: 1.25; margin: 0 0 26px; color: #e9e9e9; }
.intro-body p { color: var(--muted); margin: 0 0 14px; max-width: 58ch; }
.name-form { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.name-form label { display: block; font-weight: 600; margin-bottom: 10px; }
.name-row, .code-form { display: flex; gap: 10px; flex-wrap: wrap; }
.name-row input, .code-form input { flex: 1 1 220px; }
.code-form { margin-top: 8px; }
.code-form input { text-transform: uppercase; font-family: var(--mono); letter-spacing: 0.1em; }
.error { color: #ff8a7a; min-height: 1.4em; margin-top: 12px; }

/* ---------- campos ---------- */
input[type=text], textarea {
  width: 100%;
  background: #070707;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea { min-height: 96px; resize: vertical; }
input[type=text]:focus, textarea:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(214, 222, 35, 0.16); }
::placeholder { color: #5d5d5d; }

.btn-primary {
  background: var(--lime);
  color: var(--lime-ink);
  border: 0;
  border-radius: 8px;
  padding: 13px 22px;
  font-weight: 600;
  transition: transform 0.15s var(--ease), filter 0.2s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 18px;
  font-weight: 400;
  transition: border-color 0.2s;
}
.btn-ghost:hover { border-color: var(--lime); }
.hint { color: var(--muted); font-size: 0.88rem; margin: 6px 0 0; }

/* ---------- topo ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 14px; padding: 12px 20px; max-width: 1240px; margin: 0 auto; }
.topbar-logo { width: 30px; height: 30px; border-radius: 7px; }
.topbar-title { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.topbar-title .mono { color: var(--lime); font-size: 0.64rem; }
.topbar-title strong { font-family: var(--display); font-weight: 800; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.save-status { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
.save-status.err { color: #ff8a7a; }
.who { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 0.82rem; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who:hover { border-color: var(--lime); }
.progress { height: 3px; background: #151515; }
.progress span { display: block; height: 100%; width: 0; background: var(--lime); transition: width 0.5s var(--ease); }

/* ---------- layout ---------- */
.layout { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 48px; padding: 0 20px; }
.sections-nav { position: sticky; top: 84px; align-self: start; padding: 32px 0; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 90px); overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; background: none; border: 0; text-align: left; padding: 9px 10px; border-radius: 8px; color: var(--muted); transition: background 0.2s, color 0.2s; }
.nav-item:hover { background: var(--panel-2); color: var(--ink); }
.nav-item.active { color: var(--ink); background: var(--panel-2); }
.nav-num { font-family: var(--mono); font-size: 0.7rem; width: 22px; color: #5d5d5d; }
.nav-item.active .nav-num { color: var(--lime); }
.nav-label { flex: 1; font-size: 0.92rem; }
.nav-count { font-family: var(--mono); font-size: 0.66rem; color: #5d5d5d; }
.nav-item.full .nav-count { color: var(--lime); }

.main { padding: 44px 0 120px; max-width: 780px; min-width: 0; }

/* ---------- seção ---------- */
.section-head { margin-bottom: 40px; }
.section-head .mono { color: var(--lime); }
.section-title { font-family: var(--display); font-weight: 800; font-size: clamp(2.3rem, 6.5vw, 4rem); line-height: 0.98; letter-spacing: -0.03em; margin: 12px 0 14px; }
.section-desc { color: var(--muted); font-size: 1.05rem; max-width: 60ch; margin: 0; }
.group-label { display: flex; align-items: center; gap: 10px; margin: 44px 0 16px; color: var(--ink); }
.group-label::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px rgba(214, 222, 35, 0.7); }
.group-label.open::before { background: transparent; border: 1.5px solid var(--lime); box-shadow: none; }
.group-sub { color: var(--muted); font-size: 0.92rem; margin: -8px 0 18px; }

.card {
  background: linear-gradient(180deg, var(--panel) 0%, #090909 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 14px;
  animation: rise 0.55s var(--ease) both;
  transition: border-color 0.25s;
}
.card.done { border-color: #343a10; }
.card.fact { border-left: 3px solid #2c2c2c; }
.card.fact.s-ok { border-left-color: var(--lime); }
.card.fact.s-fix { border-left-color: #ffffff; }
.card.fact.s-unknown { border-left-color: #555; }
.fact-text { font-size: 1.08rem; font-weight: 400; margin: 0 0 16px; }
.q-text { font-weight: 600; font-size: 1.04rem; margin: 0 0 4px; }
.q-hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }
.q-body { margin-top: 12px; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button, .chip {
  background: transparent;
  border: 1px solid #333;
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.12s var(--ease);
}
.seg button:hover, .chip:hover { border-color: #666; }
.seg button:active, .chip:active { transform: scale(0.96); }
.seg button.on-ok, .chip.on { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); font-weight: 600; }
.seg button.on-fix { background: var(--ink); border-color: var(--ink); color: #000; font-weight: 600; }
.seg button.on-unknown { background: #2a2a2a; border-color: #2a2a2a; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.extra { margin-top: 12px; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); font-size: 0.85rem; text-decoration: underline; text-underline-offset: 3px; margin-top: 12px; }
.linkish:hover { color: var(--ink); }
.linkish.on { color: var(--lime); }
.unknown-tag { display: inline-block; margin-top: 10px; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.meta { margin-top: 10px; font-family: var(--mono); font-size: 0.66rem; color: #5d5d5d; letter-spacing: 0.04em; }

.pair { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 14px 0; border-top: 1px dashed #222; }
.pair:first-child { border-top: 0; padding-top: 4px; }
.pair-head { display: flex; justify-content: space-between; align-items: center; }
.pair-head .mono { color: #5d5d5d; }
.pair textarea { min-height: 70px; }
.remove { background: none; border: 0; color: #666; font-size: 0.8rem; }
.remove:hover { color: #ff8a7a; }

.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1.5px dashed #333; border-radius: 10px; padding: 26px 16px; text-align: center; transition: border-color 0.2s, background 0.2s; }
.drop:hover, .drop.drag { border-color: var(--lime); background: rgba(214, 222, 35, 0.04); }
.drop strong { font-weight: 600; }
.drop span { color: var(--muted); font-size: 0.85rem; }
.files { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.files li { font-size: 0.88rem; display: flex; gap: 8px; align-items: center; }
.files li::before { content: '↑'; color: var(--lime); font-family: var(--mono); }
.files li.pending::before { content: '…'; color: var(--muted); }
.files li.failed { color: #ff8a7a; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.pager .btn-primary { margin-left: auto; }

/* ---------- revisão ---------- */
.review { display: flex; flex-direction: column; gap: 8px; margin: 28px 0 36px; }
.review-row { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; text-align: left; width: 100%; }
.review-row:hover { border-color: #444; }
.review-row .nav-num { width: 26px; }
.review-row .bar { flex: 0 0 90px; height: 4px; background: #1d1d1d; border-radius: 4px; overflow: hidden; }
.review-row .bar span { display: block; height: 100%; background: var(--lime); }
.review-row .count { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); width: 48px; text-align: right; }
.sent { border: 1px solid #343a10; background: rgba(214, 222, 35, 0.06); border-radius: 10px; padding: 18px; margin-bottom: 20px; }

.loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; }
.loading span { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #222; border-top-color: var(--lime); animation: spin 0.8s linear infinite; }
.loading.hide { opacity: 0; pointer-events: none; transition: opacity 0.3s; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 0; padding: 0; }
  .sections-nav { position: sticky; top: 58px; z-index: 15; flex-direction: row; overflow-x: auto; padding: 10px 16px; gap: 6px; max-height: none; background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .sections-nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: 0 0 auto; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; gap: 8px; }
  .nav-item .nav-label { font-size: 0.84rem; white-space: nowrap; }
  .nav-count { display: none; }
  .nav-num { width: auto; }
  .main { padding: 30px 16px 100px; }
  .card { padding: 18px 16px; }
  .topbar-inner { padding: 10px 16px; gap: 10px; }
  .save-status { display: none; }
  .save-status.err { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
