:root {
  --bolsiagro-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  --bolsi-btn-focus: 0 0 0 2px #fff, 0 0 0 4px rgba(16, 185, 129, 0.45);
  --bolsi-btn-focus-neutral: 0 0 0 2px #fff, 0 0 0 4px rgba(148, 163, 184, 0.5);
  --bolsi-btn-focus-danger: 0 0 0 2px #fff, 0 0 0 4px rgba(244, 63, 94, 0.4);
  --bolsi-btn-focus-warning: 0 0 0 2px #fff, 0 0 0 4px rgba(251, 146, 60, 0.45);
}

/* -------------------------------------------------------------------------- */
/* BOLSIAGRO — botões padronizados (primário / secundário / perigo / aviso)    */
/* -------------------------------------------------------------------------- */

.bolsi-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 2.25rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 9999px;
  border-width: 1px;
  border-style: solid;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.bolsi-btn:disabled,
.bolsi-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.bolsi-btn:focus-visible {
  outline: none;
}

.bolsi-btn--primary {
  border-color: #10b981;
  background-color: #059669;
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.bolsi-btn--primary:hover {
  background-color: #047857;
  border-color: #059669;
}

.bolsi-btn--primary:focus-visible {
  box-shadow: var(--bolsi-btn-focus);
}

.bolsi-btn--secondary {
  border-color: #e2e8f0;
  background-color: #fff;
  color: #334155;
}

.bolsi-btn--secondary:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

.bolsi-btn--secondary:focus-visible {
  box-shadow: var(--bolsi-btn-focus-neutral);
}

.bolsi-btn--danger {
  border-color: #fda4af;
  background-color: #fff1f2;
  color: #9f1239;
}

.bolsi-btn--danger:hover {
  background-color: #ffe4e6;
  border-color: #fb7185;
}

.bolsi-btn--danger:focus-visible {
  box-shadow: var(--bolsi-btn-focus-danger);
}

/** Destrutivo irreversível (ex.: confirmar purge) — preenchido */
.bolsi-btn--danger-filled {
  border-color: #e11d48;
  background-color: #e11d48;
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.bolsi-btn--danger-filled:hover {
  background-color: #be123c;
  border-color: #be123c;
}

.bolsi-btn--danger-filled:focus-visible {
  box-shadow: var(--bolsi-btn-focus-danger);
}

/** Destaque suave estilo menu (Criar Empresa) */
.bolsi-btn--soft-emerald {
  border-color: #a7f3d0;
  background-color: #d1fae5;
  color: #065f46;
}

.bolsi-btn--soft-emerald:hover {
  background-color: #a7f3d0;
  border-color: #6ee7b7;
}

.bolsi-btn--soft-emerald:focus-visible {
  box-shadow: var(--bolsi-btn-focus);
}

.bolsi-btn--warning {
  border-color: #fed7aa;
  background-color: #fff7ed;
  color: #9a3412;
}

.bolsi-btn--warning:hover {
  background-color: #ffedd5;
  border-color: #fdba74;
}

.bolsi-btn--warning:focus-visible {
  box-shadow: var(--bolsi-btn-focus-warning);
}

/** Largura mínima alinhada às ações em cards (Detalhes, Editar, …) */
.bolsi-btn--min-w {
  min-width: 5.125rem;
}

/** Botão compacto (ex.: Filtrar na barra de busca) */
.bolsi-btn--compact {
  min-height: 2rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/** Largura total (diálogos de status, formulários) */
.bolsi-btn--block {
  width: 100%;
}

/** Segmento interno (ex.: alternador público/privado no modal) */
.bolsi-btn--segment {
  flex: 1 1 0%;
  min-width: 0;
  border-radius: 0.5rem;
}

/** Ghost / texto na barra de busca — mantém hierarquia sem caixa pesada */
.bolsi-btn--ghost {
  min-height: auto;
  padding: 0.25rem 0.5rem;
  border-color: transparent;
  background-color: transparent;
  color: #059669;
  box-shadow: none;
}

.bolsi-btn--ghost:hover {
  background-color: rgba(16, 185, 129, 0.08);
  border-color: transparent;
  color: #047857;
}

.bolsi-btn--ghost:focus-visible {
  box-shadow: var(--bolsi-btn-focus);
}

/** Opções de status no modal (cores semânticas de negócio, formato unificado) */
.bolsi-btn--status-published {
  border-color: #a7f3d0;
  background-color: #d1fae5;
  color: #065f46;
}

.bolsi-btn--status-published:hover {
  background-color: #a7f3d0;
  border-color: #6ee7b7;
}

.bolsi-btn--status-draft {
  border-color: #fed7aa;
  background-color: #ffedd5;
  color: #9a3412;
}

.bolsi-btn--status-draft:hover {
  background-color: #fdba74;
  border-color: #fb923c;
}

.bolsi-btn--status-sold {
  border-width: 2px;
  border-color: #38bdf8;
  background-color: #bae6fd;
  color: #0c4a6e;
  box-shadow: 0 1px 2px rgba(14, 165, 233, 0.15);
}

.bolsi-btn--status-sold:hover {
  background-color: #7dd3fc;
  border-color: #0ea5e9;
}

.bolsi-btn--status-archived {
  border-width: 2px;
  border-color: #0a0a0a;
  background-color: #171717;
  color: #fff;
}

.bolsi-btn--status-archived:hover {
  background-color: #0a0a0a;
  border-color: #000;
}

.bolsi-btn--dialog-dismiss {
  border-radius: 0.5rem;
  min-height: auto;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-color: transparent;
  background-color: transparent;
  color: #64748b;
}

.bolsi-btn--dialog-dismiss:hover {
  background-color: #f1f5f9;
  color: #334155;
}

.bolsi-btn--dialog-dismiss:focus-visible {
  box-shadow: var(--bolsi-btn-focus-neutral);
}

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

main {
  min-height: calc(100vh - 180px);
}

.shadow-soft {
  box-shadow: var(--bolsiagro-shadow);
}

.bolsi-profile-menu {
  overflow: visible;
}

.bolsi-profile-dropdown {
  transform-origin: top right;
  transform: translateY(-6px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  transition: transform 170ms ease, opacity 170ms ease;
}

.bolsi-profile-menu[open] .bolsi-profile-dropdown {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.bolsi-profile-menu.is-closing .bolsi-profile-dropdown {
  transform: translateY(-6px) scale(0.98);
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 1024px) {
  nav {
    width: calc(100% - 6rem);
    margin: 0 auto 1.5rem;
    border-radius: 999px;
  }
}

.uploader-dropzone {
  border: 2px dashed rgba(16, 185, 129, 0.35);
  border-radius: 24px;
  min-height: 180px;
  padding: 28px;
  background: rgba(236, 253, 245, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.uploader-dropzone:hover {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(209, 250, 229, 0.7);
  transform: translateY(-2px);
}

.uploader-dropzone.is-dragover {
  border-color: rgba(16, 185, 129, 0.85);
  background: rgba(209, 250, 229, 0.85);
}

.preview-placeholder {
  border: 1px dashed rgba(148, 163, 184, 0.4);
  border-radius: 18px;
  padding: 24px;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(71, 85, 105, 0.75);
  text-align: center;
}

.preview-card {
  position: relative;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.preview-card__image {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 14px;
  background: #f8fafc;
}

.preview-card__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1f2937;
  word-break: break-word;
}

.preview-card__remove {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 600;
  color: #f43f5e;
  background: rgba(248, 113, 113, 0.08);
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.preview-card__remove:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.preview-card__move {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 600;
  color: #0f766e;
  background: rgba(20, 184, 166, 0.08);
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
  margin-right: 6px;
}

.preview-card__move:hover {
  background: rgba(13, 148, 136, 0.14);
  color: #0f766e;
}

.preview-card__controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================================
   GLOBAL FEEDBACK MODAL + TOASTS
   ============================================================================ */

.bolsi-feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.bolsi-feedback-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.bolsi-feedback-modal {
  width: min(92vw, 420px);
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(180deg, #2b2f3e 0%, #252938 100%);
  color: #e2e8f0;
  box-shadow: 0 18px 56px rgba(2, 6, 23, 0.5);
  padding: 20px;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s ease;
}

.bolsi-feedback-overlay--visible .bolsi-feedback-modal {
  transform: translateY(0) scale(1);
}

.bolsi-feedback-modal__header {
  margin-bottom: 8px;
}

.bolsi-feedback-modal__brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.bolsi-feedback-modal__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #10b981;
  display: inline-block;
}

.bolsi-feedback-modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
}

.bolsi-feedback-modal__message {
  margin: 0;
  font-size: 0.92rem;
  color: #e2e8f0;
  line-height: 1.45;
}

.bolsi-feedback-modal__actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.bolsi-feedback-btn {
  border: none;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.bolsi-feedback-btn--primary {
  background: #06b6d4;
  color: #ffffff;
}

.bolsi-feedback-btn--ghost {
  background: rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

.bolsi-feedback-toast-stack {
  position: fixed;
  right: 14px;
  bottom: 88px;
  z-index: 1201;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 320px);
}

.bolsi-feedback-toast {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transform: translateY(6px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.bolsi-feedback-toast--visible {
  transform: translateY(0);
  opacity: 1;
}

.bolsi-feedback-toast strong {
  font-size: 0.78rem;
}

.bolsi-feedback-toast span {
  font-size: 0.8rem;
  color: #334155;
}

.bolsi-feedback-toast--success {
  border-color: rgba(16, 185, 129, 0.32);
}

.bolsi-feedback-toast--error {
  border-color: rgba(244, 63, 94, 0.3);
}

.bolsi-feedback-toast--info {
  border-color: rgba(6, 182, 212, 0.32);
}

.bolsi-feedback-toast--warning {
  border-color: rgba(245, 158, 11, 0.38);
}

/* ============================================================================
   UPLOAD MODAL — Progresso e resultados de compressão
   ============================================================================ */

.bolsi-upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.bolsi-upload-overlay.bolsi-upload-visible {
  opacity: 1;
  pointer-events: auto;
}

.bolsi-upload-modal {
  width: min(92vw, 520px);
  max-height: 84vh;
  overflow: auto;
  border-radius: 28px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  padding: 24px;
  transform: translateY(12px) scale(0.98);
  opacity: 0.96;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.bolsi-upload-visible .bolsi-upload-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.bolsi-upload-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.bolsi-upload-subtitle {
  margin: 6px 0 0;
  color: #475569;
  font-size: 0.86rem;
}

.bolsi-upload-progress-track {
  margin-top: 16px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.bolsi-upload-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  transition: width 0.2s ease;
}

.bolsi-upload-progress-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  color: #334155;
}

.bolsi-upload-results {
  margin-top: 18px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  background: #f8fafc;
}

.bolsi-upload-results-header {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f766e;
}

.bolsi-upload-results-body {
  max-height: 220px;
  overflow: auto;
}

.bolsi-upload-file-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  color: #334155;
  font-size: 0.8rem;
}

.bolsi-upload-file-row:last-child {
  border-bottom: none;
}

.bolsi-upload-file-name {
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.bolsi-upload-file-metrics {
  text-align: right;
  color: #0f766e;
  font-weight: 600;
  white-space: nowrap;
}

.bolsi-upload-error {
  margin-top: 16px;
  border: 1px solid rgba(244, 63, 94, 0.28);
  border-radius: 14px;
  background: rgba(255, 241, 242, 0.9);
  padding: 10px 12px;
  color: #be123c;
  font-size: 0.82rem;
}

.bolsi-upload-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.bolsi-upload-btn {
  border: none;
  border-radius: 999px;
  background: #059669;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.bolsi-upload-btn:hover {
  background: #047857;
  transform: translateY(-1px);
}

.bolsi-upload-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* ============================================================================
   LIGHTBOX — Galeria de imagens em tela cheia
   ============================================================================ */

.bolsi-lightbox-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(6px);
  overflow: hidden;
}

.bolsi-lightbox-visible {
  opacity: 1;
}

.bolsi-lightbox-container {
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 56px;
}

.bolsi-lightbox-image-container {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.bolsi-lightbox-image {
  max-width: 100%;
  max-height: calc(100vh - 40px);
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.16s ease;
  transform: scale(1);
  transform-origin: center center;
  cursor: grab;
  will-change: transform;
}

body.bolsi-lightbox-open,
html.bolsi-lightbox-open {
  overflow: hidden !important;
}

.bolsi-lightbox-image-loaded {
  opacity: 1;
}

.bolsi-lightbox-image-zoomed {
  cursor: grab;
}

.bolsi-lightbox-image-dragging {
  cursor: grabbing;
  user-select: none;
}

.bolsi-lightbox-close,
.bolsi-lightbox-prev,
.bolsi-lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  transition: all 0.2s ease;
  z-index: 1001;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.bolsi-lightbox-close:hover,
.bolsi-lightbox-prev:hover,
.bolsi-lightbox-next:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.7);
  color: #6ee7b7;
  transform: scale(1.1);
}

.bolsi-lightbox-prev:hover,
.bolsi-lightbox-next:hover {
  transform: translateY(-50%) scale(1.1);
}

.bolsi-lightbox-prev:active,
.bolsi-lightbox-next:active {
  transform: translateY(-50%) scale(0.95);
}

.bolsi-lightbox-prev,
.bolsi-lightbox-next {
  font-size: 0;
  line-height: 0;
}

.bolsi-lightbox-prev svg,
.bolsi-lightbox-next svg {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}

.bolsi-lightbox-close {
  position: fixed;
  top: max(12px, calc(env(safe-area-inset-top) + 8px));
  right: max(12px, calc(env(safe-area-inset-right) + 8px));
  font-size: 1.8rem;
  z-index: 1003;
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(255, 255, 255, 0.55);
}

.bolsi-lightbox-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  transform-origin: center center;
}

.bolsi-lightbox-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  transform-origin: center center;
}

.bolsi-lightbox-btn-hidden {
  opacity: 0.25;
  pointer-events: none;
  cursor: not-allowed;
}

.bolsi-lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
  letter-spacing: 0.05em;
}

@media (max-width: 768px) {
  .bolsi-lightbox-container {
    padding: 16px 44px;
  }

  .bolsi-lightbox-close {
    top: max(10px, calc(env(safe-area-inset-top) + 6px));
    right: max(10px, calc(env(safe-area-inset-right) + 6px));
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .bolsi-lightbox-prev,
  .bolsi-lightbox-next {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }

  .bolsi-lightbox-prev {
    left: 10px;
  }

  .bolsi-lightbox-next {
    right: 10px;
  }

  .bolsi-lightbox-counter {
    bottom: 10px;
    font-size: 0.85rem;
    padding: 6px 12px;
  }
}

@media (max-width: 480px) {
  .bolsi-lightbox-container {
    padding: 10px 36px;
  }

  .bolsi-lightbox-close,
  .bolsi-lightbox-prev,
  .bolsi-lightbox-next {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }
}
