/* ==========================================================================
   FLUXUS — PONTO > CONVERSÃO DE ARQUIVO
   REFERÊNCIA VISUAL APROVADA E CONGELADA
   IMPORTANTE: estilos inteiramente escopados em .fx-conversao-arquivo-page
   ========================================================================== */

.fx-conversao-arquivo-page,
.fx-conversao-arquivo-page * {
  box-sizing: border-box;
}

.fx-conversao-arquivo-page {
  --fx-conversao-bg: #f8fafc;
  --fx-conversao-surface: #ffffff;
  --fx-conversao-text: #0f172a;
  --fx-conversao-muted: #64748b;
  --fx-conversao-border: #e2e8f0;
  --fx-conversao-control-border: #cbd5e1;
  --fx-conversao-primary: #2563eb;
  --fx-conversao-primary-hover: #1d4ed8;

  width: 100%;
  min-height: 590px;
  background: var(--fx-conversao-bg);
  color: var(--fx-conversao-text);
  border: 1px solid var(--fx-conversao-border);
  border-radius: 10px;
  overflow: hidden;
  font-family: inherit;
}

.fx-conversao-header {
  position: relative;
  height: 68px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--fx-conversao-border);
  background: var(--fx-conversao-surface);
}

.fx-conversao-title {
  margin: 0;
  padding: 0;
  font: 600 24px/1.2 inherit;
  color: var(--fx-conversao-text);
  letter-spacing: 0;
}

.fx-conversao-refresh {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--fx-conversao-muted);
  font: 500 30px/1 inherit;
  pointer-events: none;
  user-select: none;
}

.fx-conversao-body {
  padding: 28px 28px 20px;
  background: var(--fx-conversao-bg);
}

.fx-conversao-import-row {
  display: grid;
  grid-template-columns: max-content 300px 96px 96px 110px;
  align-items: center;
  column-gap: 12px;
  margin: 0 0 24px;
}

.fx-conversao-import-label {
  margin: 0 8px 0 0;
  color: var(--fx-conversao-text);
  font: 600 16px/1.2 inherit;
  white-space: nowrap;
}

.fx-conversao-file-display {
  width: 300px;
  height: 38px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--fx-conversao-control-border);
  border-radius: 6px;
  outline: none;
  background: #ffffff;
  color: var(--fx-conversao-text);
  font: 400 14px/1 inherit;
  box-shadow: none;
}

.fx-conversao-file-display:focus {
  border-color: var(--fx-conversao-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.10);
}

.fx-conversao-btn {
  min-width: 96px;
  height: 38px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid var(--fx-conversao-primary);
  border-radius: 6px;
  cursor: default;
  font: 500 14px/1 inherit;
  white-space: nowrap;
  box-shadow: none;
}

.fx-conversao-btn-primary {
  color: #ffffff;
  background: var(--fx-conversao-primary);
}

.fx-conversao-btn-primary:hover,
.fx-conversao-btn-primary:focus-visible {
  color: #ffffff;
  background: var(--fx-conversao-primary-hover);
  border-color: var(--fx-conversao-primary-hover);
  outline: none;
}

.fx-conversao-btn-secondary {
  border-color: var(--fx-conversao-control-border);
  background: var(--fx-conversao-surface);
  color: var(--fx-conversao-text);
}

.fx-conversao-btn-secondary:hover,
.fx-conversao-btn-secondary:focus-visible {
  border-color: var(--fx-conversao-control-border);
  background: var(--fx-conversao-bg);
  color: var(--fx-conversao-text);
  outline: none;
}

.fx-conversao-result-area {
  width: 100%;
  height: 360px;
  min-height: 360px;
  margin: 0;
  border: 1px solid var(--fx-conversao-control-border);
  border-radius: 8px;
  background: var(--fx-conversao-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  overflow: hidden;
  padding: 16px;
  font-family: inherit;
}

.fx-conversao-preview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  height: 100%;
}

.fx-conversao-preview-card {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 14px;
  border: 1px solid var(--fx-conversao-border);
  border-radius: 8px;
  background: var(--fx-conversao-surface);
}

.fx-conversao-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fx-conversao-card-header h2 {
  margin: 0;
  color: var(--fx-conversao-text);
  font: 600 16px/1.2 inherit;
}

.fx-conversao-preview-card > p {
  margin: 8px 0 12px;
  color: var(--fx-conversao-muted);
  font: 400 12px/1.3 inherit;
}

.fx-conversao-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--fx-conversao-primary);
  font: 500 11px/1 inherit;
  white-space: nowrap;
}

.fx-conversao-badge-warning {
  background: #fef2f2;
  color: #dc2626;
}

.fx-conversao-table-scroll {
  min-height: 0;
  flex: 1;
  overflow: auto;
  border: 1px solid var(--fx-conversao-border);
  border-radius: 7px;
}

.fx-conversao-preview-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  color: var(--fx-conversao-text);
  font: 400 11px/1.25 inherit;
}

.fx-conversao-preview-table th,
.fx-conversao-preview-table td {
  min-width: 92px;
  height: 38px;
  padding: 6px 8px;
  border-right: 1px solid var(--fx-conversao-border);
  border-bottom: 1px solid var(--fx-conversao-border);
  text-align: left;
  white-space: nowrap;
}

.fx-conversao-preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  font-weight: 600;
}

.fx-conversao-preview-table tr.is-selected td {
  background: #eff6ff;
}

.fx-conversao-preview-table td input[type="text"] {
  width: 100%;
  min-width: 76px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid var(--fx-conversao-border);
  border-radius: 5px;
  background: #ffffff;
  color: var(--fx-conversao-text);
  font: 400 11px/1 inherit;
}

.fx-conversao-preview-table td input[type="text"]:focus {
  border-color: var(--fx-conversao-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.10);
}

.fx-conversao-preview-table .fx-conversao-select-cell {
  min-width: 34px;
  width: 34px;
  padding: 6px;
  text-align: center;
}

.fx-conversao-preview-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--fx-conversao-primary);
}

.fx-conversao-transfer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
}

.fx-conversao-transfer-controls button,
.fx-conversao-transfer-controls span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--fx-conversao-primary);
  font: 500 24px/1 inherit;
}

.fx-conversao-transfer-controls button {
  cursor: pointer;
}

.fx-conversao-export-popover {
  position: fixed;
  z-index: 1000;
  display: grid;
  min-width: 112px;
  padding: 4px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.fx-conversao-export-popover button {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  font: 500 13px/1 inherit;
  text-align: left;
}

.fx-conversao-export-popover button:hover {
  background: #f8fafc;
}

.fx-conversao-footer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 16px 0 0;
}

@media print {
  body * { visibility: hidden !important; }
  .fx-conversao-result-area,
  .fx-conversao-result-area * { visibility: visible !important; }
  .fx-conversao-result-area {
    position: fixed;
    inset: 0;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
    border: 0;
    box-shadow: none;
  }
}

.fx-conversao-btn-bottom {
  min-width: 104px;
  width: auto;
  flex: 0 0 auto;
}

.fx-conversao-footer-actions .fx-conversao-btn-bottom:nth-child(1),
.fx-conversao-footer-actions .fx-conversao-btn-bottom:nth-child(2) {
  border-color: var(--fx-conversao-control-border);
  background: var(--fx-conversao-surface);
  color: var(--fx-conversao-text);
}

.fx-conversao-footer-actions .fx-conversao-btn-bottom:nth-child(1):hover,
.fx-conversao-footer-actions .fx-conversao-btn-bottom:nth-child(2):hover,
.fx-conversao-footer-actions .fx-conversao-btn-bottom:nth-child(1):focus-visible,
.fx-conversao-footer-actions .fx-conversao-btn-bottom:nth-child(2):focus-visible {
  border-color: var(--fx-conversao-control-border);
  background: var(--fx-conversao-bg);
  color: var(--fx-conversao-text);
}

.fx-conversao-footer-actions .fx-conversao-btn-bottom:nth-child(3) {
  border-color: var(--fx-conversao-primary);
  background: var(--fx-conversao-primary);
  color: #ffffff;
}

.fx-conversao-footer-actions .fx-conversao-btn-bottom:nth-child(3):hover,
.fx-conversao-footer-actions .fx-conversao-btn-bottom:nth-child(3):focus-visible {
  border-color: var(--fx-conversao-primary-hover);
  background: var(--fx-conversao-primary-hover);
  color: #ffffff;
}

/* A referência aprovada é desktop. Este ajuste evita quebra estrutural em
   larguras menores sem redesenhar a tela. */
@media (max-width: 1180px) {
  .fx-conversao-body {
    padding-left: 32px;
    padding-right: 32px;
  }

  .fx-conversao-import-row {
    grid-template-columns: max-content minmax(220px, 300px) 96px 96px 110px;
    column-gap: 16px;
  }

  .fx-conversao-file-display {
    width: 100%;
  }

}

/* Layout pixel-locked da própria tela. Não afeta componentes globais. */
.fx-conversao-arquivo-page {
  --fx-conversao-bg: #fdfdfd;
  --fx-conversao-surface: #ffffff;
  --fx-conversao-text: #111827;
  --fx-conversao-muted: #63708a;
  --fx-conversao-border: #e2e8f0;
  --fx-conversao-control-border: #d9e1ec;
  --fx-conversao-primary: #0d5ffb;
  --fx-conversao-primary-hover: #0b55e7;
  min-height: 815px;
  padding: 20px 22px 24px;
  border-color: #e5eaf1;
  border-radius: 10px;
  background: #ffffff;
}

.fx-conversao-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  column-gap: 20px;
  align-items: start;
  width: 100%;
}

.fx-conversao-main {
  min-width: 0;
  padding: 0;
  background: #ffffff;
}

.fx-conversao-import-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 24px;
  margin: 0;
  padding-top: 12px;
}

.fx-conversao-import-label {
  margin: 0 0 0 4px;
  color: #111827;
  font-size: 16px;
  font-weight: 600;
}

.fx-conversao-file-display {
  width: 100%;
  height: 46px;
  border-color: #d9e1ec;
  border-radius: 8px;
}

.fx-conversao-actions {
  display: flex;
  width: 190px;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.fx-conversao-actions .fx-conversao-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 190px;
  min-width: 190px;
  height: 52px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}

.fx-conversao-actions .fx-conversao-btn-primary {
  border-color: #0d5ffb;
  background: #0d5ffb;
  color: #ffffff;
}

.fx-conversao-actions .fx-conversao-btn-primary:hover,
.fx-conversao-actions .fx-conversao-btn-primary:focus-visible {
  border-color: #0b55e7;
  background: #0b55e7;
}

.fx-conversao-actions .fx-conversao-btn-secondary {
  border-color: #7fa8ff;
  background: #ffffff;
  color: #173b73;
}

.fx-conversao-actions .fx-conversao-btn-secondary:hover,
.fx-conversao-actions .fx-conversao-btn-secondary:focus-visible {
  border-color: #7fa8ff;
  background: #f6f9ff;
  color: #173b73;
}

.fx-conversao-actions .fx-conversao-btn-danger {
  border-color: #ff8589;
  background: #ffffff;
  color: #ef3e42;
}

.fx-conversao-actions .fx-conversao-btn-danger:hover,
.fx-conversao-actions .fx-conversao-btn-danger:focus-visible {
  border-color: #ff8589;
  background: #fff7f7;
  color: #ef3e42;
}

.fx-conversao-result-area {
  height: 555px;
  min-height: 555px;
  margin-top: 98px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.fx-conversao-preview-layout {
  grid-template-columns: minmax(0, 1.34fr) 54px minmax(0, 1fr);
  column-gap: 20px;
  height: 555px;
}

.fx-conversao-preview-card {
  min-height: 555px;
  padding: 14px 12px;
  border-radius: 10px;
}

.fx-conversao-card-header h2 {
  font-size: 17px;
  font-weight: 600;
}

.fx-conversao-preview-card > p {
  color: #63708a;
  font-size: 13px;
}

.fx-conversao-table-scroll {
  max-height: 463px;
}

.fx-conversao-preview-table th {
  font-size: 12px;
}

.fx-conversao-preview-table td,
.fx-conversao-preview-table td input[type="text"] {
  font-size: 11px;
}

.fx-conversao-preview-table td input[type="text"] {
  border-color: transparent;
  background: transparent;
}

.fx-conversao-preview-table td input[type="text"]:focus {
  border-color: #0d5ffb;
  background: #f7faff;
  border-radius: 4px;
}

.fx-conversao-transfer-controls {
  width: 54px;
  align-self: center;
}

@media (min-width: 1200px) and (max-width: 1439px) {
  .fx-conversao-shell {
    grid-template-columns: minmax(0, 1fr) 180px;
    column-gap: 16px;
  }
  .fx-conversao-actions,
  .fx-conversao-actions .fx-conversao-action {
    width: 180px;
    min-width: 180px;
  }
  .fx-conversao-preview-layout {
    grid-template-columns: minmax(0, 1.34fr) 50px minmax(0, 1fr);
    column-gap: 16px;
  }
}

/* Refinamento visual bloqueado: conteúdo rolável seguido da barra fixa. */
.fx-conversao-arquivo-page {
  --fx-conversao-bg: #f8fafc;
  --fx-conversao-surface: #ffffff;
  --fx-conversao-text: #172033;
  --fx-conversao-muted: #64748b;
  --fx-conversao-border: #e3e9f1;
  --fx-conversao-control-border: #cbd8e8;
  --fx-conversao-primary: #1f66e5;
  --fx-conversao-primary-hover: #1758cb;
  grid-row: 1 / -1;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--fx-conversao-bg);
  overflow: hidden;
}

.fx-conversao-shell {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.fx-conversao-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 18px 20px 24px;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.fx-conversao-import-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 160px 220px;
  column-gap: 12px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #d9e2e9;
  border-radius: 8px;
  background: #ffffff;
}

.fx-conversao-import-field {
  display: grid;
  min-width: 0;
  row-gap: 7px;
}

.fx-conversao-import-label {
  margin: 0;
  color: var(--fx-conversao-text);
  font-size: 13px;
  font-weight: 600;
}

.fx-conversao-file-display {
  width: 100%;
  height: 34px;
  padding: 5px 9px;
  border-color: #bcc9d2;
  border-radius: 5px;
  font-size: 12px;
}

.fx-conversao-context-input {
  width: 100%;
  height: 34px;
  min-width: 0;
  padding: 5px 9px;
  border: 1px solid #bcc9d2;
  border-radius: 5px;
  outline: none;
  background: #ffffff;
  color: var(--fx-conversao-text);
  font: 400 12px/1 inherit;
}

.fx-conversao-context-input:focus {
  border-color: var(--fx-conversao-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .10);
}

@media (max-width: 900px) {
  .fx-conversao-import-row {
    grid-template-columns: minmax(220px, 1fr) 130px minmax(160px, .7fr);
    column-gap: 8px;
  }
}

.fx-conversao-result-area {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.fx-conversao-result-area:empty {
  display: none;
}

.fx-conversao-preview-layout {
  grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
  column-gap: 14px;
  height: 100%;
}

.fx-conversao-preview-card {
  min-height: 0;
  padding: 12px 14px;
  border-color: var(--fx-conversao-border);
  border-radius: 8px;
}

.fx-conversao-card-header h2 {
  font-size: 14px;
  font-weight: 600;
}

.fx-conversao-preview-card > p {
  color: var(--fx-conversao-muted);
  font-size: 11px;
}

.fx-conversao-table-scroll {
  max-height: none;
  overflow: auto;
}

.fx-conversao-preview-table th {
  font-size: 12px;
}

.fx-conversao-preview-table td,
.fx-conversao-preview-table td input[type="text"] {
  font-size: 12px;
}

.fx-conversao-preview-table td input[type="text"] {
  border-color: transparent;
  background: transparent;
}

.fx-conversao-preview-table td input[type="text"]:focus {
  border-color: var(--fx-conversao-primary);
  background: #f7faff;
  border-radius: 3px;
}

.fx-conversao-transfer-controls {
  width: 38px;
  align-self: center;
}

.fx-workspace > .fx-actions[data-conversao-active="true"] {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.fx-workspace > .fx-actions[data-conversao-active="true"] > :not(.fx-conversao-global-command) {
  display: none !important;
}

.fx-workspace > .fx-actions[data-conversao-active="true"] .fx-conversao-global-command {
  display: grid !important;
  min-width: 0;
}

.fx-workspace > .fx-actions[data-conversao-active="true"] .fx-conversao-global-command-primary {
  border-color: var(--fx-accent);
  background: linear-gradient(105deg, var(--fx-accent), var(--fx-glow));
  color: var(--fx-deep);
  font-weight: 700;
}

.fx-workspace > .fx-actions[data-conversao-active="true"] .fx-conversao-global-command-primary > span {
  color: var(--fx-deep);
}
