body.zcr-open { overflow: hidden; }

/* Credenciamento — ficha ERP (toolbar + abas + grupos), alinhada às referências Cad. Itens */
.zcr-overlay {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: none;
  background: #1a2744;
}
.zcr-overlay.show { display: block; }

.zcr-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  color: #1a2333;
  background: #e8eef5;
  animation: zcr-in 220ms ease-out;
  font-family: "Segoe UI", Tahoma, sans-serif;
}
.zcr-shell--comp {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--zarvia-surface);
  color: var(--zarvia-ink);
  font-family: inherit;
}

@keyframes zcr-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Title bar */
.zcr-titlebar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 6px 12px;
  background: linear-gradient(180deg, #f4f7fb 0%, #d9e3f0 100%);
  border-bottom: 1px solid #9eb0c8;
  box-shadow: inset 0 1px 0 #fff;
}
.zcr-titlebar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.zcr-titlebar__brand img { width: 26px; height: auto; flex-shrink: 0; }
.zcr-titlebar__brand strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #0a2a5c;
  line-height: 1.1;
}
.zcr-titlebar__brand span {
  display: block;
  font-size: 0.68rem;
  color: #5a6d86;
  line-height: 1.2;
}
.zcr-titlebar h1 {
  flex: 1 1 auto;
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f2748;
  letter-spacing: 0.01em;
}
.zcr-titlebar__x {
  width: 32px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #9eb0c8;
  border-radius: 3px;
  background: #eef3f9;
  color: #334155;
  cursor: pointer;
}
.zcr-titlebar__x:hover { background: #ffe4e4; border-color: #c45c5c; color: #9b1c1c; }

/* Toolbar */
.zcr-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 2px;
  flex: 0 0 auto;
  padding: 4px 8px;
  background: linear-gradient(180deg, #f7fafc 0%, #e2eaf3 100%);
  border-bottom: 1px solid #a8b8cc;
}
.zcr-tool {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 68px;
  min-height: 54px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #1e3354;
  font: inherit;
  cursor: pointer;
}
.zcr-tool:hover {
  background: #fff;
  border-color: #9eb0c8;
  box-shadow: 0 1px 2px rgba(15, 39, 72, 0.08);
}
.zcr-tool.is-primary {
  background: color-mix(in srgb, var(--zarvia-navy) 8%, #fff);
  border-color: #9eb0c8;
}
.zcr-tool.is-primary:hover { background: color-mix(in srgb, var(--zarvia-navy) 14%, #fff); }
.zcr-tool.is-danger:hover { background: #fff1f1; border-color: #d4a0a0; }
.zcr-tool:disabled { opacity: 0.45; cursor: not-allowed; }
.zcr-tool.is-loading { opacity: 0.7; cursor: wait; }
.zcr-tool__ico {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #0a3a7a;
}
.zcr-tool.is-danger .zcr-tool__ico { color: #b91c1c; }
.zcr-tool__lbl {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}
.zcr-tool__key {
  font-size: 0.62rem;
  color: #6b7c93;
  line-height: 1;
}

/* Tabs */
.zcr-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  flex: 0 0 auto;
  padding: 0 8px;
  background: #d5e0ec;
  border-bottom: 1px solid #8fa3bc;
}
.zcr-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 2px 0;
  padding: 7px 14px 8px;
  border: 1px solid #8fa3bc;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #c5d2e3;
  color: #334155;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.zcr-tab:hover { background: #dce5f0; }
.zcr-tab.is-active {
  background: #f3f6fa;
  color: #0a2a5c;
  z-index: 1;
  margin-bottom: -1px;
  padding-bottom: 9px;
}
.zcr-tab.is-done .zcr-tab__n {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.zcr-tab__n {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid #8fa3bc;
  font-size: 0.68rem;
  font-weight: 800;
  background: #fff;
}
.zcr-tab.is-active .zcr-tab__n {
  background: var(--zarvia-navy);
  border-color: var(--zarvia-navy);
  color: #fff;
}

/* Work area */
.zcr-work {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 16px;
  background:
    linear-gradient(180deg, #f3f6fa 0%, #e8eef5 100%);
}
.zcr-work__note {
  margin: 0 0 10px;
  padding: 6px 10px;
  border: 1px solid #b7c6d9;
  border-radius: 3px;
  background: #fff8e8;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #5c4a1f;
}

.zcr-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
.zcr-form--comp { padding: 12px 20px 0; gap: 0; }

.zcr-ficha { display: none; }
.zcr-ficha.is-active { display: block; animation: zcr-step-in 160ms ease; }
@keyframes zcr-step-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.zcr-ficha__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Group boxes — estilo ERP */
.zcr-grupo {
  margin: 0;
  padding: 12px 12px 14px;
  border: 1px solid #9eb0c8;
  border-radius: 4px;
  background: #f7fafc;
  min-width: 0;
  box-shadow: inset 0 1px 0 #fff;
}
.zcr-grupo legend {
  padding: 0 6px;
  margin-left: 2px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0a3a7a;
}

.zcr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  align-items: start;
}

/* Label à esquerda + controle — densidade ERP */
.zcr-field {
  display: grid;
  grid-template-columns: minmax(110px, 180px) minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  min-width: 0;
}
.zcr-field.wide,
.zcr-field.span-2 { grid-column: 1 / -1; }
.zcr-field.wide {
  grid-template-columns: minmax(110px, 180px) minmax(0, 1fr);
}
.zcr-lab {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #243447;
  text-align: right;
  line-height: 1.25;
}
.zcr-req {
  color: #dc2626;
  font-weight: 800;
}
.zcr-control {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}
.zcr-control > input,
.zcr-control > select,
.zcr-control > textarea {
  flex: 1 1 auto;
  min-width: 0;
}
.zcr-help,
.zcr-cnpj-status {
  grid-column: 2;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #5a6d86;
}
.zcr-cnpj-status.is-ok { color: #15803d; font-weight: 600; }
.zcr-cnpj-status.is-error { color: #b91c1c; font-weight: 600; }
.zcr-cnpj-status.is-warn { color: #a16207; font-weight: 600; }
.zcr-cnpj-status.is-loading { color: #0a3a7a; font-weight: 600; }

.zcr-f9 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 52px;
  padding: 0 8px;
  border: 1px solid #8fa3bc;
  border-radius: 3px;
  background: linear-gradient(180deg, #f8fbff 0%, #d5e0ec 100%);
  color: #0a2a5c;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.zcr-f9:hover { filter: brightness(1.04); }
.zcr-f9:disabled,
.zcr-f9.is-loading { opacity: 0.65; cursor: wait; }

.zcr-field input,
.zcr-field select,
.zcr-field textarea,
.zcr-control input,
.zcr-control select,
.zcr-control textarea {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid #8fa3bc;
  border-radius: 3px;
  background: #fff;
  color: #1a2333;
  font: inherit;
  font-size: 0.88rem;
  box-shadow: inset 1px 1px 0 rgba(15, 39, 72, 0.04);
}
.zcr-field textarea,
.zcr-control textarea { min-height: 72px; resize: vertical; }
.zcr-field input:focus,
.zcr-field select:focus,
.zcr-field textarea:focus,
.zcr-control input:focus,
.zcr-control select:focus,
.zcr-control textarea:focus {
  outline: none;
  border-color: #1d6fd8;
  box-shadow: 0 0 0 2px rgba(29, 111, 216, 0.2);
  background: #fffef5;
}
.zcr-field input.is-invalid,
.zcr-control input.is-invalid {
  border-color: #dc2626;
  background: #fff5f5;
}
.zcr-field.is-autofilled input,
.zcr-field.is-autofilled select {
  border-color: #6fbf84;
  background: #eef9f1;
}

.zcr-final {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.zcr-desafio { max-width: none; }
.zcr-desafio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.zcr-desafio-row #zcrPergunta {
  font-weight: 700;
  color: #0a2a5c;
  white-space: nowrap;
}
.zcr-desafio-row input {
  width: 72px;
  flex: 0 0 auto;
}
.zcr-aceite {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  grid-column: 1 / -1;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #243447;
  cursor: pointer;
  margin-top: 4px;
}
.zcr-aceite input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--zarvia-navy);
}

.zcr-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.zcr-msg {
  display: none;
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 3px;
  font-size: 0.84rem;
  line-height: 1.4;
}
.zcr-msg.show { display: block; }
.zcr-msg.error { background: #fde8e8; border: 1px solid #e5a0a0; color: #9b1c1c; }
.zcr-msg.ok { background: #e7f7ec; border: 1px solid #8fcfa3; color: #146c3a; }

/* Status bar */
.zcr-statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 12px;
  background: linear-gradient(180deg, #e2eaf3 0%, #cfdceb 100%);
  border-top: 1px solid #9eb0c8;
  font-size: 0.72rem;
  color: #334155;
}
.zcr-statusbar__mod {
  font-weight: 800;
  color: #0a3a7a;
  letter-spacing: 0.04em;
}
.zcr-statusbar__sep { color: #8fa3bc; }
.zcr-statusbar__hint { color: #5a6d86; }

/* Complemento (legado) */
.zcr-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--zarvia-surface);
  overflow: auto;
}
.zcr-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(18px, 3vh, 28px) clamp(18px, 3vw, 40px) 12px;
  border-bottom: 1px solid var(--zarvia-line);
}
.zcr-top h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  font-weight: 800;
  color: var(--zarvia-ink);
}
.zcr-lead {
  margin: 6px 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--zarvia-muted);
  max-width: 52ch;
}
.zcr-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--zarvia-line);
  border-radius: 10px;
  background: var(--zarvia-surface-2);
  color: var(--zarvia-ink);
  cursor: pointer;
}
.zcr-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding: 16px 0 calc(16px + env(safe-area-inset-bottom, 0px));
}
.zcr-actions__left,
.zcr-actions__right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.zcr-btn {
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background: var(--zarvia-navy);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
}
.zcr-btn:hover { filter: brightness(1.08); }
.zcr-btn.secondary {
  background: transparent;
  color: var(--zarvia-ink);
  border: 1px solid var(--zarvia-line);
}
.zcr-btn:disabled { opacity: 0.6; cursor: wait; }

@media (prefers-reduced-motion: reduce) {
  .zcr-shell, .zcr-ficha, .zcr-tool { animation: none; transition: none; }
}

@media (max-width: 900px) {
  .zcr-titlebar h1 { font-size: 0.92rem; text-align: left; }
  .zcr-titlebar__brand span { display: none; }
  .zcr-tool { min-width: 56px; min-height: 48px; }
  .zcr-tool__key { display: none; }
  .zcr-field {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .zcr-lab { text-align: left; }
  .zcr-help,
  .zcr-cnpj-status { grid-column: 1; }
}

@media (max-width: 640px) {
  .zcr-grid { grid-template-columns: 1fr; }
  .zcr-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .zcr-tab { white-space: nowrap; }
  .zcr-statusbar__hint { display: none; }
}

