@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/plex-mono-600.woff2") format("woff2");
  font-weight: 500 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: oklch(99.2% 0.003 165);
  --surface: oklch(97% 0.006 165);
  --raised: oklch(100% 0 0);
  --ink: oklch(23% 0.02 175);
  --muted: oklch(47% 0.018 175);
  --faint: oklch(62% 0.014 175);
  --line: oklch(91.5% 0.008 170);
  --line-strong: oklch(84% 0.012 170);
  --accent: oklch(50% 0.12 165);
  --accent-ink: oklch(42% 0.11 165);
  --accent-soft: oklch(95.5% 0.035 165);
  --on-accent: oklch(99% 0.005 165);
  --get: oklch(50% 0.14 250);
  --get-soft: oklch(95.5% 0.03 250);
  --warn: oklch(70% 0.15 70);
  --warn-ink: oklch(50% 0.12 65);
  --warn-soft: oklch(96.5% 0.04 80);
  --danger: oklch(55% 0.19 25);
  --danger-soft: oklch(96.5% 0.025 25);
  --code-bg: oklch(22% 0.018 185);
  --code-head: oklch(26% 0.018 185);
  --code-line: oklch(31% 0.018 185);
  --code-ink: oklch(92% 0.012 175);
  --code-muted: oklch(68% 0.02 185);
  --tok-str: oklch(84% 0.11 150);
  --shadow: 0 1px 2px oklch(20% 0.02 175 / 0.05), 0 4px 16px -6px oklch(20% 0.02 175 / 0.1);
  --sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --top: 3.5rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(16.5% 0.012 185);
  --surface: oklch(20.5% 0.014 185);
  --raised: oklch(22.5% 0.015 185);
  --ink: oklch(94% 0.008 170);
  --muted: oklch(73% 0.016 175);
  --faint: oklch(60% 0.016 180);
  --line: oklch(27.5% 0.014 185);
  --line-strong: oklch(35% 0.016 185);
  --accent: oklch(78% 0.13 163);
  --accent-ink: oklch(82% 0.12 163);
  --accent-soft: oklch(27% 0.045 170);
  --on-accent: oklch(18% 0.02 175);
  --get: oklch(78% 0.11 245);
  --get-soft: oklch(27% 0.045 245);
  --warn: oklch(80% 0.14 75);
  --warn-ink: oklch(84% 0.12 78);
  --warn-soft: oklch(27% 0.045 75);
  --danger: oklch(72% 0.16 25);
  --danger-soft: oklch(27% 0.05 25);
  --code-bg: oklch(13.5% 0.012 185);
  --code-head: oklch(17% 0.013 185);
  --code-line: oklch(25% 0.014 185);
  --shadow: 0 1px 2px oklch(0% 0 0 / 0.3), 0 6px 20px -8px oklch(0% 0 0 / 0.5);
}

* { box-sizing: border-box; }
html { background: var(--bg); scrollbar-color: var(--line-strong) transparent; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
::selection { background: var(--accent-soft); color: var(--ink); }
svg { flex: none; }
[hidden] { display: none !important; }
p { margin: 0 0 0.9rem; max-width: 68ch; }
strong { font-weight: 630; }
a {
  color: var(--accent-ink);
  text-decoration-line: underline;
  text-decoration-color: color-mix(in oklch, var(--accent) 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-color: currentColor; }
code { font-family: var(--mono); font-size: 0.86em; }
:not(pre) > code {
  padding: 0.1em 0.38em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  overflow-wrap: anywhere;
}
h1, h2, h3 { text-wrap: balance; }
h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.9rem, 1.5rem + 1.6vw, 2.5rem);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.08;
}
h2 {
  margin: 0 0 0.4rem;
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 630;
  letter-spacing: -0.012em;
}
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.opt { color: var(--muted); font-weight: 450; }
.fine { margin: 0; color: var(--muted); font-size: 0.86rem; }
.warn-text { margin: 0; font-size: 0.92rem; }
.flash[data-after-flow] { margin: 1.25rem 0 0; }
.gate-brand { display: flex; align-items: center; gap: 0.75rem; }
.gate-actions { margin-top: 1.5rem; }
.gate-note { margin-top: 1.5rem; font-size: 0.9rem; }
.gate-card .ink { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.gate-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  text-decoration-line: underline;
  text-decoration-color: color-mix(in oklch, var(--accent) 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.link-btn:hover { text-decoration-color: currentColor; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.label-row a { font-size: 0.85rem; }

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 20;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
}
.skip:focus { top: 0.6rem; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: var(--top);
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklch, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-weight: 620;
  font-size: 0.95rem;
  letter-spacing: -0.015em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark { color: var(--accent); }
.env {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.env::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: currentColor;
}
.env.sandbox { background: var(--get-soft); color: var(--get); }
.tabs { display: flex; gap: 0.15rem; }
.tabs a {
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 540;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}
.tabs a:hover { color: var(--ink); background: var(--surface); }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--surface); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.who { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface); }
.icon-btn .sun { display: none; }
[data-theme="dark"] .icon-btn .sun { display: block; }
[data-theme="dark"] .icon-btn .moon { display: none; }
.text-btn {
  min-height: 2.25rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  color: var(--ink);
  font: 540 0.85rem var(--sans);
  cursor: pointer;
}
.text-btn:hover { border-color: var(--line-strong); background: var(--surface); }
.account-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 590;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-end > .account-name { max-width: 14rem; }
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  max-width: 16rem;
  min-height: 2.25rem;
  padding: 0 0.5rem 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.account-btn:hover,
.account-btn[data-open] { border-color: var(--line-strong); background: var(--surface); }
.account-btn svg { flex: none; color: var(--muted); transition: transform 0.2s var(--ease); }
.account-btn[data-open] svg { transform: rotate(180deg); }
.switcher {
  position: fixed;
  inset: auto;
  margin: 0;
  width: max-content;
  min-width: 15rem;
  max-width: min(20rem, calc(100vw - 1rem));
  max-height: min(24rem, calc(100vh - 5rem));
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: opacity 0.16s var(--ease), translate 0.16s var(--ease);
}
@starting-style {
  .switcher:popover-open { opacity: 0; translate: 0 -4px; }
}
.switcher-title {
  margin: 0;
  padding: 0.45rem 0.6rem 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 560;
}
.switcher-list { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.switch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0 0.6rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: 520 0.9rem var(--sans);
  text-align: left;
}
button.switch-item { cursor: pointer; transition: background-color 0.15s; }
button.switch-item:hover { background: var(--surface); }
button.switch-item[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.switch-item[aria-current] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.switch-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-now {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 600;
}
.switch-now::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: currentColor; }

.page {
  max-width: 76rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}
.lede { margin-bottom: 2rem; }
.lede p { margin: 0; color: var(--muted); font-size: 1.02rem; }

.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid color-mix(in oklch, var(--accent) 25%, var(--line));
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.94rem;
}
.flash svg { margin-top: 0.2rem; color: var(--accent); }
.flash p { margin: 0; }

.reveal {
  margin: 0 0 2rem;
  overflow: hidden;
  border: 1px solid var(--code-line);
  border-radius: 12px;
  background: var(--code-bg);
  color: var(--code-ink);
  box-shadow: var(--shadow);
}
.reveal-body { padding: 1.1rem 1.25rem 1.2rem; }
.reveal h2 { color: var(--code-ink); font-size: 1.1rem; }
.reveal p { margin: 0 0 0.9rem; color: var(--code-muted); font-size: 0.94rem; }
.reveal p strong { color: var(--code-ink); }
.reveal .value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem 0.35rem 0.9rem;
  border: 1px solid var(--code-line);
  border-radius: 8px;
  background: var(--code-head);
}
.reveal .value code {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--tok-str);
  font-size: 0.95rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* Fluxo */
.flow {
  position: relative;
  display: grid;
  grid-template-columns: minmax(9.5rem, 1fr) minmax(13rem, 1.55fr) minmax(9.5rem, 1fr) minmax(13rem, 1.55fr) minmax(9.5rem, 1fr);
  grid-template-rows: auto auto;
  column-gap: 0;
  row-gap: 0.75rem;
  align-items: stretch;
  margin-bottom: 0;
}
.node {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  min-height: 8.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--raised);
  box-shadow: var(--shadow);
}
.node-name { font-weight: 640; font-size: 1.02rem; letter-spacing: -0.015em; }
.node-sub {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  overflow-wrap: anywhere;
}
.node.core {
  border-color: color-mix(in oklch, var(--accent) 55%, var(--line-strong));
  background: var(--accent-soft);
}
.node.core .node-name { color: var(--accent-ink); }
.lane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.15rem;
}
.link {
  --wire: var(--accent);
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 0.5rem;
  row-gap: 0.2rem;
  padding: 0.55rem 0.75rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}
.link:hover { background: var(--surface); }
.link[aria-current="step"] {
  border-color: color-mix(in oklch, var(--wire) 45%, var(--line));
  background: var(--raised);
  box-shadow: var(--shadow);
}
.link-name { font-size: 0.9rem; font-weight: 600; letter-spacing: -0.01em; }
.link-state {
  justify-self: end;
  font-size: 0.74rem;
  font-weight: 620;
  color: var(--accent-ink);
}
.link-summary {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}
.wire {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  height: 0.9rem;
  color: var(--wire);
}
.wire::before {
  content: "";
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: var(--wire);
  transform-origin: left center;
}
.wire.rev { flex-direction: row-reverse; }
.wire.rev::before { transform-origin: right center; }
.wire svg { margin: 0 -2px; }
.wire.rev svg { transform: rotate(180deg); }
.link.pending { --wire: var(--warn); }
.link.pending .link-state { color: var(--warn-ink); }
.link.pending .wire::before {
  background: repeating-linear-gradient(90deg, var(--wire) 0 7px, transparent 7px 12px);
}
.link.optional { --wire: var(--line-strong); }
.link.optional .link-state { color: var(--muted); }
.link.optional .wire::before {
  background: repeating-linear-gradient(90deg, var(--wire) 0 2px, transparent 2px 6px);
}
.link.drawn .wire::before { animation: draw 0.9s var(--ease) both; }
@keyframes draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.flow-extra {
  grid-column: 4 / 6;
  grid-row: 2;
  border-top: 1px dashed var(--line);
  padding-top: 0.6rem;
}

.panel {
  margin-top: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raised);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.5rem 1.75rem 0;
}
.panel-head h2:focus { outline: none; }
.panel-head p { margin: 0.25rem 0 0; color: var(--muted); }
.panel-body {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 2rem 3rem;
  padding: 1.5rem 1.75rem 1.75rem;
}
.panel-body.single { grid-template-columns: minmax(0, 46rem); }
.aside h3 { font-size: 0.95rem; }
.aside p, .aside li { color: var(--muted); font-size: 0.92rem; }
.aside ol { margin: 0 0 1rem; padding-left: 1.2rem; }
.aside li { margin: 0.35rem 0; max-width: 60ch; }
.aside li::marker { color: var(--faint); font-family: var(--mono); font-size: 0.85em; }

.state {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.state.pending { background: var(--warn-soft); color: var(--warn-ink); }
.state.optional { background: var(--surface); color: var(--muted); }

/* Formulários */
.form { display: grid; gap: 1.15rem; align-content: start; }
.field { display: grid; gap: 0.35rem; }
.field label, .label {
  font-size: 0.9rem;
  font-weight: 590;
}
.field .hint { margin: 0; color: var(--muted); font-size: 0.83rem; }
.field .hint code { font-size: 0.82em; }
.input, .textarea, select.input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: 400 0.95rem var(--sans);
  caret-color: var(--accent);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input.mono { font-family: var(--mono); font-size: 0.88rem; }
.textarea { min-height: 5.5rem; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input[readonly], .input[readonly]:hover { border-color: var(--line); background: var(--surface); }
.input:hover, .textarea:hover, select.input:hover { border-color: color-mix(in oklch, var(--ink) 30%, var(--line-strong)); }
.input:focus, .textarea:focus, select.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"], select.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus, select.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in oklch, var(--danger) 20%, transparent); }
select.input {
  appearance: none;
  padding-right: 2.4rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7874' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
}
:root[data-theme="dark"] select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a8b5b0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
[data-operation-rates] { display: grid; gap: 0.65rem; }
.error {
  display: flex;
  gap: 0.4rem;
  margin: 0;
  color: var(--danger);
  font-size: 0.84rem;
  font-weight: 520;
}
.error svg { margin-top: 0.2rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; }
.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.92rem;
  cursor: pointer;
}
.check input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); }
.input[type="file"] { padding: 0.4rem 0.5rem; cursor: pointer; }
.input[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--raised);
  color: var(--ink);
  font: 550 0.85rem var(--sans);
  cursor: pointer;
}
.input[type="file"]::file-selector-button:hover { background: var(--surface); }
.select { position: relative; }
[data-operation-rates] { display: grid; gap: 0.65rem; }
.select .input {
  appearance: none;
  padding-right: 2.4rem;
  text-overflow: ellipsis;
  cursor: pointer;
}
.select::after {
  content: "";
  position: absolute;
  right: 0.95rem;
  top: 50%;
  width: 0.42rem;
  height: 0.42rem;
  border-right: 1.8px solid var(--muted);
  border-bottom: 1.8px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.suffix { position: relative; }
.suffix .input { padding-right: 2.2rem; }
.suffix span {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  font-size: 0.9rem;
  pointer-events: none;
}
.group-title {
  margin: 0.5rem 0 -0.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 630;
}
.group-title + p { margin: 0; color: var(--muted); font-size: 0.86rem; }
.form > .group-title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.form + .form { padding-top: 1.75rem; border-top: 1px solid var(--line); }
.form > .hint { margin: -0.6rem 0 0; color: var(--muted); font-size: 0.83rem; }
.error-box {
  padding: 0.75rem 0.9rem;
  border: 1px solid color-mix(in oklch, var(--danger) 40%, transparent);
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 520;
}
.error-box p { margin: 0 0 0.3rem; }
.error-box ul { margin: 0; padding-left: 1.1rem; }
.more {
  border: 1px solid var(--line);
  border-radius: 10px;
}
.more summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 2.9rem;
  padding: 0 1rem;
  font-size: 0.92rem;
  font-weight: 580;
  cursor: pointer;
  list-style: none;
}
.more summary::-webkit-details-marker { display: none; }
.more summary span { color: var(--muted); font-weight: 450; font-size: 0.84rem; }
.more summary svg { color: var(--muted); transition: transform 0.2s var(--ease); }
.more[open] summary svg { transform: rotate(180deg); }
.more-body { display: grid; gap: 1rem; padding: 0.25rem 1rem 1.1rem; }

.account-create {
  display: grid;
  grid-template-columns: minmax(0, 28rem) max-content;
  gap: 0.35rem 0.75rem;
  align-items: end;
  margin-bottom: 1.75rem;
}
.account-create .field { grid-column: 1; grid-row: 1; }
.account-create .btn { grid-column: 2; grid-row: 1; width: auto; justify-self: start; }
.account-create .error { grid-column: 1 / -1; grid-row: 2; margin: 0; }
.account-create .hint { grid-column: 1 / -1; grid-row: 3; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 1.15rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 0.94rem var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--accent-ink); }
.btn.quiet { border-color: var(--line-strong); background: var(--raised); color: var(--ink); }
.btn.quiet:hover { background: var(--surface); }
.btn.danger { border-color: color-mix(in oklch, var(--danger) 45%, var(--line)); background: var(--raised); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.btn[aria-busy="true"] .spin { display: block; }
.spin {
  display: none;
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Valores copiáveis */
.copyline {
  display: grid;
  gap: 0.3rem;
}
.copyline .label { font-size: 0.84rem; color: var(--muted); font-weight: 560; }
.copybox {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 2.6rem;
  padding: 0.25rem 0.3rem 0.25rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.copybox code {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}
.copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.25rem 0.6rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 550 0.8rem var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.copy:hover { color: var(--ink); background: var(--line); }
.copy[data-state="done"] { color: var(--accent-ink); }
.reveal .copy { color: var(--code-muted); }
.reveal .copy:hover { color: var(--code-ink); background: var(--code-line); }
.reveal .copy[data-state="done"] { color: var(--tok-str); }
.stack { display: grid; gap: 1rem; align-content: start; }

.hook {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.hook-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; }
.hook-head strong { font-size: 0.92rem; }
.hook-head span { color: var(--muted); font-size: 0.82rem; }
.events { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.events code { font-size: 0.74rem; }

/* Tabelas */
td form { margin: 0; }
.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
}
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
th, td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in oklch, var(--surface) 60%, transparent); }
th {
  background: var(--surface);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 560;
}
td.num, th.num { text-align: right; }
td .mono { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
td .ref { font-weight: 560; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  font-weight: 560;
}
.pill::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--accent-ink); }
.pill.wait { color: var(--get); }
.pill.late { color: var(--danger); }
.pill.muted { color: var(--faint); }

.accounts td:first-child { white-space: normal; min-width: 16rem; }
.rename-toggle summary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  margin: -0.2rem -0.4rem;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  list-style: none;
}
.rename-toggle summary::-webkit-details-marker { display: none; }
.rename-toggle summary:hover { background: var(--surface); }
.account-title { font-weight: 590; overflow-wrap: anywhere; }
.rename-cue { display: inline-flex; color: var(--faint); transition: color 0.15s; }
.rename-toggle summary:hover .rename-cue,
.rename-toggle summary:focus-visible .rename-cue,
.rename-toggle[open] .rename-cue { color: var(--accent-ink); }
.rename { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.45rem 0.5rem; align-items: center; margin-top: 0.55rem; }
.rename .input { min-height: 2.35rem; padding: 0.35rem 0.7rem; }
.rename .error { grid-column: 1 / -1; }
.account-groups {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.account-groups svg { flex: none; color: var(--faint); }

.text-btn.danger { border-color: transparent; background: none; color: var(--muted); }
.text-btn.danger:hover,
.text-btn.danger:focus-visible { border-color: color-mix(in oklch, var(--danger) 45%, var(--line)); background: var(--danger-soft); color: var(--danger); }

.groups .account-create { margin-bottom: 1.25rem; }
.group-blocks { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.group-block {
  display: grid;
  gap: 0.9rem;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
  scroll-margin-top: 5rem;
}
.group-block:target { border-color: color-mix(in oklch, var(--accent) 45%, var(--line)); }
.group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; }
.group-head h3 { margin: 0; font-size: 1.02rem; font-weight: 630; letter-spacing: -0.012em; }
.group-count { color: var(--muted); font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.group-head form { margin-left: auto; }
.group-empty { margin: 0; color: var(--muted); font-size: 0.9rem; }
.member-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0; padding: 0; list-style: none; }
.member-chips li {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  min-height: 2.1rem;
  padding: 0.15rem 0.2rem 0.15rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.88rem;
  font-weight: 540;
}
.chip-x {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.chip-x:hover { background: var(--danger-soft); color: var(--danger); }
.group-add {
  display: grid;
  grid-template-columns: minmax(0, 20rem) max-content;
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}
.group-add .input { min-height: 2.35rem; padding-block: 0.3rem; }
.group-add .btn { min-height: 2.35rem; padding: 0 0.9rem; font-size: 0.88rem; }
.group-add .error { grid-column: 1 / -1; margin: 0; }
.accounts th:last-child, .accounts td:last-child { width: 1%; text-align: right; }
.accounts .detail {
  display: block;
  margin-top: 0.15rem;
  padding-left: 0.9rem;
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: break-word;
}
.accounts .btn { min-height: 2.35rem; padding: 0 0.9rem; font-size: 0.88rem; white-space: nowrap; }
.accounts tr.is-fresh td { background: color-mix(in oklch, var(--accent-soft) 70%, transparent); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 3.5rem 0 1rem;
}
.section-head p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.94rem; }
.empty {
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  text-align: center;
}
.empty h3 { margin-bottom: 0.35rem; }
.empty p { margin: 0 auto; color: var(--muted); font-size: 0.94rem; }

.search { display: flex; gap: 0.5rem; max-width: 34rem; margin: 0 0 1.25rem; }
.search .input { flex: 1; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; color: var(--muted); font-size: 0.88rem; }
.pager .actions { gap: 0.5rem; }
.pager .btn { min-height: 2.4rem; }
.pager .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

/* Acesso */
.gate {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
}
.gate-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.5rem; }
.gate-main { display: grid; place-items: center; padding: 1.5rem 1.25rem 3rem; }
.gate-card { width: 100%; max-width: 27rem; }
.gate-card h1 { font-size: clamp(1.7rem, 1.4rem + 1vw, 2.1rem); }
.gate-card > p { color: var(--muted); }
.gate-card .form { margin-top: 1.75rem; }
.gate-card .btn { width: 100%; }
.gate-foot { padding: 1.25rem 1.5rem 1.75rem; color: var(--muted); font-size: 0.85rem; text-align: center; }
.mini-flow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
}
.mini-flow span { white-space: nowrap; }
.mini-flow span.core { color: var(--accent-ink); font-weight: 600; }
.mini-flow i { flex: 1; height: 2px; min-width: 1rem; border-radius: 2px; background: var(--accent); opacity: 0.6; }

@media (max-width: 1080px) {
  .who { display: none; }
  .panel-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .flow {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0;
  }
  .node { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; padding: 0.85rem 1rem; }
  .lane {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    padding: 0.4rem 0;
  }
  .lane .link { grid-template-rows: auto auto 1fr; padding: 0.5rem 0.6rem 0.6rem 2.1rem; }
  .lane .wire {
    grid-column: auto;
    position: absolute;
    left: 0.7rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 0.9rem;
    height: auto;
    flex-direction: column;
  }
  .lane .wire.rev { flex-direction: column-reverse; }
  .lane .wire::before { width: 2px; height: auto; flex: 1; transform-origin: center top; }
  .lane .wire.rev::before { transform-origin: center bottom; }
  .lane .wire svg { transform: rotate(90deg); margin: -2px 0; }
  .lane .wire.rev svg { transform: rotate(-90deg); }
  .lane .link.pending .wire::before { background: repeating-linear-gradient(180deg, var(--wire) 0 7px, transparent 7px 12px); }
  .flow-extra { grid-column: 1; grid-row: auto; margin-top: 0.75rem; }
  .link.drawn .wire::before { animation-name: draw-y; }
  @keyframes draw-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; height: auto; gap: 0.25rem 0.75rem; padding: 0.55rem 1rem 0.35rem; }
  .brand-text { display: none; }
  .account-btn { max-width: 11rem; }
  .topbar-end > .account-name { max-width: 9rem; }
  .tabs { order: 3; width: 100%; margin-inline: -0.5rem; overflow-x: auto; }
  .tabs a { padding-inline: 0.5rem; white-space: nowrap; }
  .account-create { grid-template-columns: minmax(0, 1fr); }
  .account-create .btn { grid-column: 1; grid-row: 2; justify-self: start; }
  .account-create .error { grid-row: 3; }
  .account-create .hint { grid-row: 4; }
  .accounts thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .accounts, .accounts tbody { display: block; }
  .accounts tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.4rem 0.75rem;
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid var(--line);
  }
  .accounts tbody tr:last-child { border-bottom: 0; }
  .accounts td { display: block; padding: 0; border: 0; white-space: normal; }
  .accounts td:first-child { grid-column: 1 / -1; min-width: 0; }
  .accounts td:last-child { grid-column: 2; width: auto; justify-self: end; }
  .group-add { grid-template-columns: minmax(0, 1fr); }
  .group-add .btn { justify-self: start; }
  .accounts tr.is-fresh { background: color-mix(in oklch, var(--accent-soft) 70%, transparent); }
  .accounts tr.is-fresh td, .accounts tbody tr:hover td { background: none; }
  .page { padding: 1.75rem 1rem 4rem; }
  .panel-head { padding: 1.25rem 1.1rem 0; }
  .panel-body { padding: 1.25rem 1.1rem 1.4rem; }
  .lane { grid-template-columns: minmax(0, 1fr); }
  th, td { padding: 0.6rem 0.75rem; }
}
@media (pointer: coarse) {
  .copy, .icon-btn, .text-btn, .account-btn, .switch-item, .accounts .btn, .group-add .btn, .group-add .input { min-height: 2.75rem; }
  .icon-btn { min-width: 2.75rem; }
  .chip-x { width: 2.25rem; height: 2.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
