/* Configuração — alinhada ao Painel de Trading */

:root {
  --footer-h: 4.25rem;
  --rail-w: 212px;
}

body {
  line-height: 1.45;
}

.shell {
  padding:
    calc(1.2rem + var(--safe-t))
    max(1rem, var(--safe-x))
    calc(var(--footer-h) + var(--safe-b) + 1.25rem);
}

.page-meta {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  margin: -0.55rem 0 var(--space);
}

.header-actions .btn-ghost-text {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.header-actions .btn-ghost-text:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

/* Progresso mobile */
.m-progress {
  display: none;
  margin-bottom: 1rem;
}

.m-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
  gap: 0.75rem;
}

.m-progress-row .step-name {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.m-progress-row .step-count {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar {
  height: 3px;
  background: rgba(140, 160, 185, 0.14);
  border-radius: 99px;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(226, 179, 74, 0.45), var(--gold));
  border-radius: 99px;
  transition: width 0.25s ease;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.rail {
  position: sticky;
  top: calc(0.75rem + var(--safe-t));
  max-height: calc(100dvh - var(--footer-h) - 2rem);
  overflow: auto;
  padding: 0.15rem 0.15rem 0.15rem 0;
}

.rail-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  border-left: 1px solid var(--line);
  margin-left: 0.55rem;
  padding-left: 0;
}

.rail-list button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.48rem 0.55rem 0.48rem 0.85rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  cursor: pointer;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.rail-list button:hover {
  color: var(--text);
  background: rgba(140, 160, 185, 0.05);
}

.rail-list button.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: rgba(226, 179, 74, 0.08);
}

.rail-list button.done { color: var(--text); }

.rail-list button.done::after {
  content: "";
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  margin-left: 0.4rem;
  border-radius: 50%;
  background: var(--good);
  vertical-align: middle;
  opacity: 0.85;
}

.main {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 28rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.main::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, rgba(226, 179, 74, 0.65), transparent 75%);
  pointer-events: none;
  z-index: 1;
}

.main-head {
  padding: 1.15rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(226, 179, 74, 0.04), transparent 40%);
}

.main-head h2 {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.main-head p {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 0.35rem;
  max-width: 42rem;
  line-height: 1.45;
}

.main-body {
  padding: 1.15rem 1.25rem 1.35rem;
  flex: 1 1 auto;
}

/* Campos */
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.95rem 1rem;
}

.field { min-width: 0; }
.field.span-2 { grid-column: 1 / -1; }

.field > .lbl {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.field > .hint {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  margin-top: 0.35rem;
  line-height: 1.35;
}

input[type="text"],
input[type="number"],
input[type="password"],
select {
  width: 100%;
  background: var(--panel-soft);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

input[type="number"] {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(226, 179, 74, 0.5);
  background: rgba(11, 16, 23, 0.9);
}

input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}

.toggle:has(input:checked) {
  border-color: rgba(226, 179, 74, 0.55);
  color: var(--gold);
  background: rgba(226, 179, 74, 0.08);
}

.toggle input { accent-color: var(--gold); }

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.check-field input { margin-top: 0.15rem; accent-color: var(--gold); }
.check-field .lbl {
  margin: 0;
  font-weight: 600;
  font-size: 0.88rem;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font);
  color: var(--text);
}
.check-field .hint { margin-top: 0.2rem; }

/* Choices */
.choices {
  display: grid;
  gap: 0.55rem;
}

.choices.cols-2 { grid-template-columns: 1fr 1fr; }
.choices.cols-3 { grid-template-columns: 1fr; }

@media (min-width: 640px) {
  .choices.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

.choice {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.9rem;
  background: var(--panel-soft);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.choice:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}

.choice.selected {
  border-color: rgba(226, 179, 74, 0.65);
  background: rgba(226, 179, 74, 0.08);
  box-shadow: inset 2px 0 0 var(--gold);
}

.choice strong {
  display: block;
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.choice span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

/* Profiles */
.profiles { display: flex; flex-direction: column; gap: 0.55rem; }

.profile {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.95rem;
  background: var(--panel-soft);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.profile:hover { border-color: var(--line-strong); }

.profile.selected {
  border-color: rgba(226, 179, 74, 0.65);
  background: rgba(226, 179, 74, 0.08);
  box-shadow: inset 2px 0 0 var(--gold);
}

.profile-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.profile h3 {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.badge {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0.14rem 0.45rem;
  border-radius: 99px;
}

.profile p {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.35rem;
  line-height: 1.4;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

/* Preview / review */
.preview {
  margin-top: 0.35rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  background: rgba(226, 179, 74, 0.06);
  border: 1px solid rgba(226, 179, 74, 0.2);
}

.preview .title {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 0.45rem;
}

.preview .body {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
}

.preview .body strong { color: var(--text); font-weight: 650; }

.layer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.layer-chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  padding: 0.28rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(8, 12, 18, 0.55);
  border: 1px solid var(--line);
  color: var(--text);
}

.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.review-item {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.review-item.span-2 { grid-column: 1 / -1; }

.review-item .k {
  display: block;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.28rem;
}

.review-item .v {
  font-size: 0.9rem;
  font-weight: 600;
  word-break: break-word;
}

.sys-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.sys-panel h3 {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.status-hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.65rem;
}

/* Footer */
.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 0.7rem max(1rem, var(--safe-x)) calc(0.7rem + var(--safe-b));
  background: rgba(8, 12, 18, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.footer-nav { display: flex; gap: 0.45rem; }
.footer-end { display: flex; gap: 0.45rem; align-items: center; }

.msg {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  min-height: 1.2em;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg.ok { color: var(--good); }
.msg.err { color: var(--bad); }

.btn {
  border: 1px solid var(--line-strong);
  background: #121a24;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn:hover {
  border-color: rgba(226, 179, 74, 0.35);
  background: #161f2b;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--gold);
  color: #1a1408;
  border-color: transparent;
}

.btn-primary:hover {
  background: #ebc05a;
  border-color: transparent;
}

.btn-ghost { background: transparent; }

.btn-danger {
  border-color: rgba(217, 123, 104, 0.35);
  color: #f0b4a8;
  background: rgba(217, 123, 104, 0.06);
}

/* Dialogs */
.pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 1rem;
}

#pinOverlay { z-index: 60; }
.pin-overlay[hidden] { display: none !important; }

.pin-dialog {
  position: relative;
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 1.2rem;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.pin-dialog::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--gold), transparent);
}

.pin-dialog h3 {
  font-family: var(--display);
  font-size: 1.08rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.pin-dialog > p {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.pin-dialog label {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.pin-dialog label.lbl-spaced { margin-top: 0.65rem; }

.pin-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.9rem;
}

.pin-err {
  color: var(--bad);
  font-size: 0.78rem;
  min-height: 1em;
  margin-top: 0.4rem;
}

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .rail { display: none; }
  .m-progress { display: block; }
  .main { min-height: 0; }
  .fields { grid-template-columns: 1fr; }
  .choices.cols-2 { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .review-item.span-2 { grid-column: auto; }
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }
  .footer-nav, .footer-end { justify-content: stretch; }
  .footer-nav .btn, .footer-end .btn { flex: 1; }
  .msg { text-align: left; white-space: normal; }
  :root { --footer-h: 7.5rem; }
}
