/* Painel admin — VisionLab
   Mesma largura do formulário (--max) para não “pular” ao trocar de tela.
*/

.admin-app {
  width: min(100% - 2rem, var(--max, 720px));
}

.admin-shell {
  width: 100%;
}

.admin-login-form {
  margin-top: 0.5rem;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  background:
    linear-gradient(135deg, rgba(47, 212, 200, 0.08), transparent 55%),
    var(--surface);
}

.admin-title {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.015em;
}

.admin-subtitle {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.admin-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.trash-entry {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.85rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid rgba(255, 123, 138, 0.45);
  background:
    linear-gradient(135deg, rgba(255, 123, 138, 0.16), rgba(255, 123, 138, 0.04)),
    var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.trash-entry:hover {
  border-color: rgba(255, 123, 138, 0.75);
  transform: translateY(-1px);
}

.trash-entry.is-active-tool {
  border-color: rgba(47, 212, 200, 0.55);
  background:
    linear-gradient(135deg, rgba(47, 212, 200, 0.14), rgba(47, 212, 200, 0.04)),
    var(--surface);
}

.trash-entry-main {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.trash-entry-title {
  font-weight: 700;
  font-size: 1rem;
  color: #ffb0ba;
}

.trash-entry.is-active-tool .trash-entry-title {
  color: var(--accent);
}

.trash-entry-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.trash-entry-side {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.toolbar-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.6rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 123, 138, 0.28);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

.trash-entry.is-active-tool .toolbar-badge {
  background: rgba(47, 212, 200, 0.28);
}

.trash-entry-cta {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffb0ba;
}

.trash-entry.is-active-tool .trash-entry-cta {
  color: var(--accent);
}

/* Chips de filtro por status */

.status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.7rem 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(7, 17, 31, 0.45);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.status-chip:hover {
  border-color: rgba(148, 180, 220, 0.35);
  color: var(--text);
}

.status-chip.is-active {
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.status-chip-count {
  min-width: 1.35rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.status-chip.is-active .status-chip-count {
  background: rgba(0, 0, 0, 0.22);
}

.status-chip.status-todos.is-active {
  background: linear-gradient(135deg, #3d8bfd, #2fd4c8);
}

.status-chip.status-nova.is-active,
.admin-item-status-select.status-nova {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.status-chip.status-em_analise.is-active,
.admin-item-status-select.status-em_analise {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1a1205;
}

.status-chip.status-contactado.is-active,
.admin-item-status-select.status-contactado {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: #fff;
}

.status-chip.status-proposta.is-active,
.admin-item-status-select.status-proposta {
  background: #06b6d4;
  border-color: #06b6d4;
  color: #042028;
}

.status-chip.status-ganho.is-active,
.admin-item-status-select.status-ganho {
  background: #22c55e;
  border-color: #22c55e;
  color: #052110;
}

.status-chip.status-perdido.is-active,
.admin-item-status-select.status-perdido {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.status-chip.status-arquivada.is-active,
.admin-item-status-select.status-arquivada {
  background: #64748b;
  border-color: #64748b;
  color: #fff;
}

.status-chip.status-lixeira.is-active {
  background: #475569;
  border-color: #475569;
  color: #fff;
}

.status-chip.status-lixeira:not(.is-active) {
  border-style: dashed;
}

.trash-hint {
  margin: -0.35rem 0 1rem;
  padding: 0 0.15rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.trash-hint strong {
  color: #ffb0ba;
  font-weight: 650;
}

/* Editor do questionário */

.quiz-status {
  margin: 0 0 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(47, 212, 200, 0.35);
  background: rgba(47, 212, 200, 0.08);
  color: var(--text);
  font-size: 0.9rem;
}

.quiz-status.is-error {
  border-color: rgba(255, 123, 138, 0.45);
  background: rgba(255, 123, 138, 0.1);
  color: #ffb0ba;
}

.quiz-editor {
  display: grid;
  gap: 1rem;
}

.quiz-block h2 {
  margin: 0 0 0.85rem;
  font-size: 1.1rem;
}

.quiz-block-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.quiz-block-head h2 {
  margin: 0;
}

.quiz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.quiz-grid label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quiz-grid label.is-wide {
  grid-column: 1 / -1;
}

.quiz-grid input:not([type="checkbox"]),
.quiz-grid textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(7, 17, 31, 0.55);
  color: var(--text);
  font: inherit;
}

.quiz-check {
  display: inline-flex !important;
  align-items: center;
  gap: 0.45rem;
  width: auto !important;
  margin: 0;
  margin-left: auto;
  color: var(--text-muted) !important;
  font-size: 0.82rem !important;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.quiz-check input[type="checkbox"] {
  width: 1.05rem !important;
  height: 1.05rem !important;
  min-width: 1.05rem;
  padding: 0 !important;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
  border-radius: 4px;
}

.quiz-field {
  margin-top: 0.9rem;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 180, 220, 0.14);
  background: rgba(7, 17, 31, 0.35);
}

.quiz-field-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.7rem;
}

.quiz-field-type {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(74, 168, 255, 0.15);
  color: #9ec9ff;
}

.btn-sm {
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

@media (max-width: 700px) {
  .quiz-grid {
    grid-template-columns: 1fr;
  }
}

.admin-item.is-trash {
  border-color: rgba(255, 123, 138, 0.22);
}

.admin-item-restore {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.admin-section-warning {
  border-color: rgba(255, 123, 138, 0.35);
  background: rgba(255, 123, 138, 0.08);
}

.admin-inline-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.admin-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.admin-empty h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.admin-empty p {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
}

.admin-list {
  display: grid;
  gap: 0.7rem;
}

.admin-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
  text-align: left;
  padding: 0.35rem 0.45rem 0.35rem 0.35rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--surface);
  color: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.admin-item:hover {
  border-color: rgba(47, 212, 200, 0.35);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.admin-item-open {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  margin: 0;
  padding: 0.75rem 0.65rem 0.75rem 0.85rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.admin-item-open:hover {
  background: rgba(47, 212, 200, 0.06);
}

.admin-item-main {
  min-width: 0;
}

.admin-item-id {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.admin-item-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-item-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.admin-item-status-wrap {
  padding-right: 0.55rem;
}

.admin-item-status-select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 7.5rem;
  padding: 0.45rem 1.7rem 0.45rem 0.7rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 0.7rem;
}

.admin-item-status-select.status-em_analise,
.admin-item-status-select.status-proposta,
.admin-item-status-select.status-ganho {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1205' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
}

.admin-item-chevron {
  color: var(--text-muted);
  font-size: 1.1rem;
  opacity: 0.7;
}

@media (max-width: 560px) {
  .admin-app {
    width: min(100% - 1.35rem, var(--max, 720px));
  }

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .admin-title {
    font-size: 1.28rem;
  }

  .admin-toolbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .admin-toolbar-actions .btn {
    width: 100%;
    min-height: 42px;
  }

  .status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .admin-item {
    grid-template-columns: 1fr;
    gap: 0.15rem;
    padding-bottom: 0.65rem;
  }

  .admin-item-status-wrap {
    padding: 0 0.65rem 0.35rem;
  }

  .admin-item-status-select {
    width: 100%;
  }
}

/* Drawer de detalhe */

.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 1rem;
}

.detail-drawer[hidden] {
  display: none !important;
}

.detail-drawer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 8, 16, 0.72);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.detail-drawer-panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 980px);
  height: calc(100dvh - 2rem);
  max-height: calc(100dvh - 2rem);
  margin: 0;
  padding: 1.5rem 1.75rem 1.25rem;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: drawerIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes drawerIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.admin-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(148, 180, 220, 0.12);
  flex: 0 0 auto;
}

.admin-detail-header h2 {
  margin: 0.45rem 0 0;
  font-size: 1.35rem;
}

.detail-ticket {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(47, 212, 200, 0.45);
  background: linear-gradient(135deg, rgba(47, 212, 200, 0.18), rgba(74, 168, 255, 0.12));
  box-shadow: 0 0 24px rgba(47, 212, 200, 0.18);
  color: #7ff5ec;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: none;
}

.detail-ticket-label {
  opacity: 0.75;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail-ticket-code {
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: #fff;
}

.admin-detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-detail-content {
  display: grid;
  gap: 0.85rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1.1rem 0.35rem 1rem 0;
  overscroll-behavior: contain;
}

.admin-section {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(7, 17, 31, 0.35);
}

.admin-section h3 {
  margin: 0 0 0.7rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.admin-kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.admin-kv {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.admin-kv.is-wide {
  grid-column: 1 / -1;
}

.admin-kv dt {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.admin-kv dd {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-status-select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(7, 17, 31, 0.55);
  color: var(--text);
  font: inherit;
  font-weight: 600;
}

.admin-status-select.status-nova {
  border-color: rgba(59, 130, 246, 0.55);
}

.admin-status-select.status-em_analise {
  border-color: rgba(245, 158, 11, 0.55);
}

.admin-status-select.status-contactado {
  border-color: rgba(139, 92, 246, 0.55);
}

.admin-status-select.status-proposta {
  border-color: rgba(6, 182, 212, 0.55);
}

.admin-status-select.status-ganho {
  border-color: rgba(34, 197, 94, 0.55);
}

.admin-status-select.status-perdido {
  border-color: rgba(239, 68, 68, 0.55);
}

.admin-status-select.status-arquivada {
  border-color: rgba(100, 116, 139, 0.55);
}

.admin-logo-thumb {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.35rem;
  margin-top: 0.35rem;
}

@media (max-width: 560px) {
  .detail-drawer {
    padding: 0.5rem;
  }

  .detail-drawer-panel {
    width: 100%;
    height: calc(100dvh - 1rem);
    max-height: calc(100dvh - 1rem);
    border-radius: 16px;
  }

  .admin-kv-grid {
    grid-template-columns: 1fr;
  }

  .admin-detail-header {
    flex-direction: column;
  }

  .admin-detail-actions {
    width: 100%;
  }

  .admin-detail-actions .btn {
    flex: 1;
  }
}

body.drawer-open,
body.confirm-open {
  overflow: hidden;
}

/* Botão excluir no detalhe */

.btn-danger-ghost {
  color: var(--danger);
  border-color: rgba(255, 123, 138, 0.35);
  background: transparent;
}

.btn-danger-ghost:hover {
  background: var(--danger-soft);
  border-color: rgba(255, 123, 138, 0.55);
  color: #ffb0ba;
}

.btn-danger {
  background: linear-gradient(135deg, #e5485d, #c23448);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 8px 20px rgba(196, 52, 72, 0.35);
}

.btn-danger:hover {
  filter: brightness(1.06);
}

.btn-danger:disabled,
.btn-danger-ghost:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

/* Modal de confirmação de exclusão */

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.confirm-modal[hidden] {
  display: none !important;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(2, 6, 14, 0.78);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.confirm-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 1.6rem 1.5rem 1.35rem;
  text-align: center;
  border-radius: 18px;
  border: 1px solid rgba(255, 123, 138, 0.28);
  background:
    radial-gradient(circle at top, rgba(255, 123, 138, 0.14), transparent 55%),
    var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: confirmIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes confirmIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.confirm-modal-icon {
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto 0.85rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 123, 138, 0.45);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
}

.confirm-modal-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.confirm-modal-desc {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.confirm-modal-desc strong {
  color: #ffb0ba;
  font-weight: 650;
}

.confirm-modal-ticket {
  display: grid;
  gap: 0.2rem;
  margin: 0 auto 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(7, 17, 31, 0.55);
  text-align: left;
}

.confirm-ticket-code {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #7ff5ec;
}

.confirm-ticket-name {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.confirm-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: stretch;
}

.confirm-modal-actions .btn {
  flex: 1 1 140px;
}

@media (max-width: 420px) {
  .confirm-modal-panel {
    padding: 1.35rem 1.15rem 1.2rem;
  }
}
