/* ============================================================
   estrutura.css — Estilos estruturais do FTP Manager
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&display=swap');

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #f4f5f7; color: #111827; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; line-height: 1.5; min-height: 100vh; }
a { text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 200; height: 52px; background: #0f1117; border-bottom: 1px solid #1f2130; display: flex; align-items: center; padding: 0 28px; }
.topbar-logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-logo-link { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.topbar-logo-text { color: #f1f0f8; font-weight: 600; font-size: 15px; letter-spacing: -0.015em; }
.topbar-spacer { flex: 1; }
.topbar-nav { display: flex; align-items: stretch; height: 52px; gap: 2px; }
.topbar-nav-item { display: flex; align-items: center; gap: 6px; padding: 0 16px; background: none; border: none; border-bottom: 2px solid transparent; border-top: 2px solid transparent; color: #6b7280; font-size: 14px; font-weight: 400; white-space: nowrap; transition: color 0.15s; text-decoration: none; }
.topbar-nav-item:hover { color: #9ca3af; }
.topbar-nav-item.active { border-bottom-color: #c42030; color: #f4a8ae; font-weight: 500; }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.main-content { padding-top: 52px; min-height: 100vh; }
.page { padding: 28px 32px; max-width: 1400px; margin: 0 auto; }

/* Cabeçalho de página com busca */
.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-header-row h1 { font-size: 21px; font-weight: 600; color: #111827; letter-spacing: -0.025em; }
.page-header-row p { font-size: 14px; color: #6b7280; margin-top: 3px; }

/* Cabeçalho simples */
.page-header { margin-bottom: 22px; }
.page-header h1 { font-size: 21px; font-weight: 600; color: #111827; letter-spacing: -0.025em; }
.page-header p { font-size: 14px; color: #6b7280; margin-top: 3px; }

/* ============================================================
   CARD
   ============================================================ */
.card { background: #fff; border-radius: 8px; border: 1px solid #e5e7eb; }
.card-padding { padding: 20px; }
.card-footer { margin-top: 6px; padding-top: 14px; border-top: 1px solid #f3f4f6; }
.card-section-title { font-size: 12px; font-weight: 700; color: #9ca3af; letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 12px; }

/* ============================================================
   TABELA DE DADOS
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 16px; text-align: left; white-space: nowrap; font-size: 11px; font-weight: 700; color: #9ca3af; letter-spacing: 0.07em; text-transform: uppercase; border-bottom: 2px solid #f3f4f6; }
.data-table td { padding: 10px 16px; border-bottom: 1px solid #f3f4f6; font-size: 14px; color: #374151; }
.data-table tbody tr:nth-child(even) { background: #fafafa; }
.data-table tbody tr:hover { background: #fff1f2; transition: background 0.1s; }

/* Estado vazio de tabelas */
.table-empty-cell { padding: 52px 16px; text-align: center !important; color: #9ca3af; }
.table-empty-icon { display: block; font-size: 33px; margin-bottom: 8px; }
.table-empty-text { font-size: 14px; }

/* Colunas da tabela de clientes */
#clients-body td:last-child { text-align: right; }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid transparent; font-size: 14px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all 0.12s; white-space: nowrap; }
.btn-primary { background: #c42030; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #a81a28; }
.btn-secondary { background: #fff; color: #374151; border-color: #e5e7eb; }
.btn-secondary:hover:not(:disabled) { background: #f9fafb; }
.btn-danger { background: #fff; color: #b91c1c; border-color: #fca5a5; }
.btn-danger:hover:not(:disabled) { background: #fef2f2; }
.btn:disabled, .btn[disabled] { background: #e5e7eb; color: #9ca3af; border-color: #e5e7eb; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 15px; }
.btn-sm i { font-size: 16px; }
.btn i { font-size: 16px; }

/* Botão FTP (inline na tabela) */
.ftp-btn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 5px; font-size: 13px; font-weight: 500; background: transparent; color: #c42030; border: 1px solid #fecdd0; cursor: pointer; transition: all 0.12s; font-family: inherit; }
.ftp-btn:hover { background: #c42030; color: #fff; border-color: #c42030; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { display: inline-block; padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.badge-swop { background: #dbeafe; color: #1e40af; }
.badge-swe { background: #d1fae5; color: #065f46; }

/* Status badges (envio) */
.status-badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 100px; text-transform: uppercase; letter-spacing: 0.04em; }
.status-badge--aguardando { background: #f3f4f6; color: #6b7280; }
.status-badge--enviando { background: #dbeafe; color: #1e40af; }
.status-badge--sucesso { background: #d1fae5; color: #065f46; }
.status-badge--aviso { background: #fef3c7; color: #92400e; }
.status-badge--erro { background: #fee2e2; color: #991b1b; }

/* ============================================================
   INPUTS & SELECTS
   ============================================================ */
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; left: 10px; color: #9ca3af; font-size: 15px; pointer-events: none; }
.form-input { width: 100%; padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 14px; color: #374151; background: #fff; outline: none; transition: border-color 0.15s; }
.form-input:focus { border-color: #c42030; }
textarea.form-input { resize: vertical; }
.input-wrapper .form-input { padding-left: 32px; }
.form-select { padding: 7px 10px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 14px; color: #374151; background: #fff; cursor: pointer; outline: none; transition: border-color 0.15s; }
.form-select:focus { border-color: #c42030; }
.form-select-full { width: 100%; }

/* ============================================================
   DROP ZONE
   ============================================================ */
.drop-zone { padding: 28px 20px; text-align: center; background: #fafafa; border: 2px dashed #e5e7eb; border-radius: 8px; cursor: pointer; transition: all 0.15s; }
.drop-zone:hover { border-color: #f4a8ae; background: #fff1f2; }
.drop-zone.drag-over { border-color: #c42030; background: #fff1f2; }
.drop-zone.has-files { border-radius: 8px 8px 0 0; border-bottom: none; }
.drop-zone-icon { font-size: 27px; color: #d1d5db; display: block; margin-bottom: 5px; }
.drop-zone-text { font-size: 14px; font-weight: 500; color: #374151; }
.drop-zone-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: center; }
.drop-zone-actions .btn { font-size: 13px; }

/* ============================================================
   LISTA DE ARQUIVOS (na config de envio)
   ============================================================ */
.file-list { border: 2px solid #e5e7eb; border-top: none; border-radius: 0 0 8px 8px; overflow: hidden; }
.file-list-header { display: flex; align-items: center; gap: 6px; padding: 6px 14px; background: #f3f4f6; border-bottom: 1px solid #e5e7eb; font-size: 13px; color: #6b7280; font-weight: 500; }
.file-list-item { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-bottom: 1px solid #f9fafb; }
.file-list-item:last-child { border-bottom: none; }
.file-list-item:nth-child(even) { background: #fafafa; }
.file-remove-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; background: #f3f4f6; border: 1px solid #e5e7eb; cursor: pointer; color: #6b7280; border-radius: 6px; transition: color 0.12s, background 0.12s, border-color 0.12s; }
.file-remove-btn:hover { color: #ef4444; background: #fee2e2; border-color: #fecaca; }
.file-list-item i { font-size: 15px; }
.file-list-name { font-size: 14px; color: #374151; }
.file-remove-btn i { font-size: 15px; }

/* Linha de adicionar item (input + botão) — usada na exclusão e no executar */
.chip-input-row, .excluir-add { display: flex; align-items: center; gap: 8px; }
.chip-input-row .form-input, .excluir-add .form-input { flex: 1; }
.excluir-prefix { display: inline-flex; align-items: center; height: 38px; padding: 0 10px; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 6px; color: #6b7280; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }

/* Domínios selecionados (chips abaixo do multiselect) */
.selected-domains { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.selected-domains-label { font-size: 12px; color: #6b7280; margin-right: 2px; }
.domain-chip { display: inline-flex; align-items: center; gap: 4px; background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12px; }
.domain-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: none; background: none; color: #e11d48; cursor: pointer; border-radius: 50%; font-size: 15px; line-height: 1; }
.domain-chip-x:hover { background: #fecdd3; color: #881337; }
.selected-domains-clear { border: none; background: none; color: #6b7280; cursor: pointer; font-size: 12px; text-decoration: underline; padding: 2px 4px; }
.selected-domains-clear:hover { color: #c42030; }

/* ============================================================
   PAGINAÇÃO
   ============================================================ */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid #f3f4f6; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid #e5e7eb; border-top-color: #c42030; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin {
  to { transform: rotate(360deg); }
}
.pagination-info { font-size: 13px; color: #9ca3af; }
.pagination-btns { display: flex; gap: 4px; }
.pagination-left, .pagination-right { display: flex; align-items: center; gap: 16px; }
.pagination-perpage, .pagination-goto { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #6b7280; }
.pg-select { height: 30px; border: 1px solid #e5e7eb; border-radius: 5px; background: #fff; color: #374151; font-size: 13px; font-family: inherit; padding: 0 6px; cursor: pointer; }
.pg-goto-input { width: 64px; height: 30px; border: 1px solid #e5e7eb; border-radius: 5px; background: #fff; color: #374151; font-size: 13px; font-family: inherit; padding: 0 8px; }
.pg-btn { min-width: 30px; height: 30px; padding: 0 6px; display: flex; align-items: center; justify-content: center; border: 1px solid #e5e7eb; border-radius: 5px; background: #fff; color: #374151; font-size: 13px; cursor: pointer; font-family: inherit; transition: all 0.1s; }
.pg-btn.active { border-color: #c42030; background: #c42030; color: #fff; }
.pg-btn:disabled { color: #d1d5db; cursor: not-allowed; }
.pg-btn i { font-size: 14px; }
.pg-ellipsis { min-width: 24px; height: 30px; display: flex; align-items: flex-end; justify-content: center; color: #9ca3af; font-size: 13px; user-select: none; }

/* ============================================================
   CARDS DE ENVIO (Enviar Arquivos)
   ============================================================ */
.send-cards { display: flex; flex-direction: column; gap: 6px; }
.send-card { background: #fff; border-radius: 8px; border: 1px solid #e5e7eb; border-left-width: 3px; padding: 11px 16px; transition: border-left-color 0.4s; margin-bottom: 10px; }
.send-card--aguardando { border-left-color: #e5e7eb; }
.send-card--enviando { border-left-color: #3b82f6; }
.send-card--sucesso { border-left-color: #10b981; }
.send-card--aviso { border-left-color: #f59e0b; }
.send-card--erro { border-left-color: #ef4444; }
.send-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.send-card-top.no-margin { margin-bottom: 0; }
.progress-bar { flex: 1; height: 3px; background: #e5e7eb; border-radius: 2px; overflow: hidden; }
.progress-shimmer { height: 100%; width: 60%; background: linear-gradient(90deg, #93c5fd, #3b82f6, #93c5fd); border-radius: 2px; animation: shimmer 1.2s ease-in-out infinite; }
@keyframes shimmer {
  0% { transform: translateX(-150%); }
  100% { transform: translateX(250%); }
}

/* Chips de filtro de status */
.filter-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 100px; font-size: 13px; font-weight: 600; border: none; background: #f3f4f6; color: #9ca3af; cursor: pointer; font-family: inherit; transition: all 0.12s; }
.filter-chip.active-all { background: #111827; color: #fff; }
.filter-chip.active-enviando { background: #dbeafe; color: #1e40af; }
.filter-chip.active-sucesso { background: #d1fae5; color: #065f46; }
.filter-chip.active-erro { background: #fee2e2; color: #991b1b; }
.filter-chip.active-aguardando { background: #ffedd5; color: #c2410c; }
.filter-chip.active-aviso { background: #fef9c3; color: #854d0e; }
.chip-count { background: rgba(0,0,0,0.1); border-radius: 100px; padding: 1px 5px; font-size: 11px; }

/* Botões de controle (Retomar / Parar) */
.ctrl-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px; border-radius: 100px; font-size: 14px; font-weight: 600; border: none; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.ctrl-play { background: #d1fae5; color: #9ca3af; cursor: default; }
.ctrl-play.ready { background: #059669; color: #fff; cursor: pointer; }
.ctrl-stop { background: #fee2e2; color: #9ca3af; cursor: default; }
.ctrl-stop.running { background: #ef4444; color: #fff; cursor: pointer; }
.affected-server { font-family: monospace; border-radius: 4px; padding: 1px 6px; }

/* Send / progress cards */
.copy-btn { display: inline-flex; align-items: center; justify-content: center; background: transparent; color: #d1d5db; cursor: pointer; transition: background 0.12s, color 0.12s; flex-shrink: 0; font-size: 18px; }
.copy-btn:hover { background: #f3f4f6; color: #6b7280; }
.send-card-domain { font-weight: 700; font-size: 15px; color: #111827; }
.send-card-progress-info { font-size: 12px; color: #6b7280; white-space: nowrap; }
.send-card-output { margin-top: 15px; font-size: 12px; color: #374151; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 4px; padding: 6px 8px; overflow-x: auto; }
.send-card-output-group { margin-top: 12px; }
.send-card-output-group .send-card-output { margin-top: 4px; }
.send-card-output-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.send-card-debug { margin-top: 8px; }
.send-card-debug summary { font-size: 12px; color: #6b7280; cursor: pointer; user-select: none; }
.send-card-debug summary:hover { color: #374151; }
.send-card-debug .send-card-output { margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.send-msg { font-size: 13px; margin-top: 15px; }
.send-msg--sucesso { color: #059669; display: flex; align-items: center; gap: 5px; }
.send-msg--aviso { color: #b45309; display: flex; align-items: center; gap: 5px; }
.send-msg--erro { color: #dc2626; display: flex; align-items: center; gap: 5px; }
.send-msg--aguardando { color: #9ca3af; }
#done-label { display: none; font-size: 13px; color: #059669; font-weight: 600; align-items: center; gap: 5px; }

/* ============================================================
   MODAL DE CONFIRMAÇÃO
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 400px; max-width: calc(100vw - 32px); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15); }
.modal h3 { font-size: 17px; font-weight: 600; color: #111827; margin-bottom: 10px; }
.modal p { font-size: 15px; color: #6b7280; margin-bottom: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-warning-icon { color: #f59e0b; margin-right: 8px; }
#modal-alerta-icon { margin-right: 8px; }

/* ============================================================
   FTP MANAGER LAYOUT
   ============================================================ */

/* Wrapper que ocupa tela toda abaixo da topbar */
.ftp-wrapper { position: fixed; top: 52px; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; overflow: hidden; }

/* Barra de contexto da conexão FTP */
.ftp-context-bar { display: flex; align-items: center; gap: 10px; padding: 0 24px; height: 44px; flex-shrink: 0; background: #2a0a0e; border-bottom: 1px solid #521018; }
.ftp-ctx-label { font-size: 13px; font-weight: 600; color: #fad0d3; }
.ftp-ctx-login { font-size: 13px; color: #f4a8ae; font-family: 'Fira Code', monospace; }
.ftp-ctx-sep { color: #7a1a22; margin: 0 2px; }
.ftp-ctx-domain { font-size: 13px; color: #e07a84; }
.ftp-server-badge { font-size: 12px; font-family: monospace; font-weight: 700; background: #521018; color: #e07a84; border-radius: 4px; padding: 2px 7px; }
.ftp-ctx-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ftp-ctx-spacer { flex: 1; }
.ftp-exit-btn { display: flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 5px; background: transparent; border: 1px solid #7a1a22; color: #e07a84; font-size: 13px; cursor: pointer; font-family: inherit; transition: all 0.12s; }
.ftp-exit-btn:hover { background: #521018; border-color: #a81a28; }
.ftp-exit-btn i { font-size: 14px; }

/* Corpo do FTP (sidebar + main) */
.ftp-body { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* --- Sidebar: Árvore de Pastas --- */
.ftp-sidebar { width: 216px; flex-shrink: 0; background: #fff; border-right: 1px solid #e5e7eb; overflow-y: auto; }
.ftp-sidebar-title { padding: 10px 12px 4px; font-size: 11px; font-weight: 700; color: #9ca3af; letter-spacing: 0.07em; text-transform: uppercase; }
.ftp-sidebar-search { position: relative; padding: 6px 10px 4px; }
.ftp-sidebar-search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 13px; pointer-events: none; }
.ftp-sidebar-search-input { width: 100%; height: 28px; padding: 0 8px 0 26px; border: 1px solid #e5e7eb; border-radius: 5px; font-size: 12px; color: #374151; background: #f9fafb; outline: none; box-sizing: border-box; transition: border-color 0.15s; }
.ftp-sidebar-search-input:focus { border-color: #c42030; background: #fff; }
.folder-item { display: flex; align-items: center; gap: 6px; width: 100%; padding: 5px 12px; background: none; border: none; color: #374151; font-size: 14px; cursor: pointer; text-align: left; font-family: inherit; transition: background 0.1s; white-space: nowrap; }
.folder-item:hover { background: #f9fafb; }
.folder-item.active { background: #fee2e4; color: #8c1520; }
.folder-item i { font-size: 14px; color: #9ca3af; flex-shrink: 0; }
.folder-item.active i { color: inherit; }
.folder-item.depth-0 { padding-left: 12px; }
.folder-item.depth-1 { padding-left: 24px; }
.folder-item.depth-2 { padding-left: 36px; }
.folder-item.depth-3 { padding-left: 48px; }
.folder-item.depth-4 { padding-left: 60px; }
.folder-item.depth-5 { padding-left: 72px; }
.folder-item.depth-6 { padding-left: 84px; }
.folder-item.depth-7 { padding-left: 96px; }
.folder-item.depth-8 { padding-left: 108px; }

/* --- Main Panel (toolbar + tabela + statusbar) --- */
.ftp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: #f9fafb; }
.ftp-toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 14px; background: #fff; border-bottom: 1px solid #e5e7eb; flex-shrink: 0; flex-wrap: wrap; }
.ftp-toolbar-nav { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 260px; }
.ftp-toolbar-sep { width: 1px; height: 16px; background: #e5e7eb; margin: 0 2px; }
.ftp-toolbar-spacer { flex: 1; }

/* Breadcrumb */
.ftp-breadcrumb { display: flex; align-items: center; }
.ftp-bc-btn { background: none; border: none; padding: 2px 4px; color: #374151; font-weight: 400; cursor: pointer; font-family: 'Fira Code', 'Courier New', monospace; font-size: 13px; }
.ftp-bc-btn.current { color: #c42030; font-weight: 600; cursor: default; }
.ftp-bc-sep { font-size: 12px; color: #d1d5db; margin: 0 1px; }
.ftp-refresh { background: none; border: none; cursor: pointer; color: #6b7280; padding: 4px 6px; border-radius: 5px; font-size: 17px; transition: background 0.1s, color 0.1s; display: flex; align-items: center;  }
.ftp-refresh:hover { background: #f3f4f6; color: #111827; }
.ftp-back-btn { background: none; border: none; cursor: pointer; color: #6b7280; padding: 4px 6px; border-radius: 5px; font-size: 17px; transition: background 0.1s, color 0.1s; display: flex; align-items: center; }
.ftp-back-btn:hover:not(:disabled) { background: #f3f4f6; color: #111827; }
.ftp-back-btn:disabled { color: #d1d5db; cursor: default; }

/* --- Tabela de Arquivos FTP --- */
.ftp-table-wrap { flex: 1; overflow-y: auto; overflow-x: auto; position: relative; }
.ftp-drop-overlay { display: none; position: absolute; inset: 0; background: rgba(37,99,235,.06); border: 2px dashed #2563eb; border-radius: 8px; z-index: 10; pointer-events: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #2563eb; font-size: 16px; font-weight: 600; }
.ftp-drop-overlay.active { display: flex; }
.ftp-drop-overlay i { font-size: 52px; opacity: .5; }
.ftp-table { width: 100%; border-collapse: collapse; min-width: 480px; }
.ftp-table th { padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 700; color: #9ca3af; letter-spacing: 0.07em; text-transform: uppercase; background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.ftp-th-sort { cursor: pointer; user-select: none; }
.ftp-th-sort:hover { color: #374151; }
.ftp-sort-icon { font-size: 13px; opacity: 0.4; vertical-align: middle; margin-left: 2px; }
.ftp-th-sort:hover .ftp-sort-icon { opacity: 0.7; }
.ti-sort-ascending, .ti-sort-descending { opacity: 1 !important; color: #c42030; }
.ftp-table th:first-child { width: 40px; padding: 8px 14px; }
.ftp-table th:last-child { width: 40px; }
.ftp-table td { padding: 7px 12px; border-bottom: 1px solid #f3f4f6; font-size: 14px; }
.ftp-table td:first-child { padding: 7px 14px; }
.ftp-table td:nth-child(3) { color: #6b7280; }
.ftp-table td:nth-child(4) { color: #6b7280; font-size: 13px; }
.ftp-table td:nth-child(5) .mono { color: #9ca3af; }
.ftp-table td:last-child { text-align: right; }
.ftp-table tbody tr { background: #fff; }
.ftp-table tbody tr:nth-child(even) { background: #fafafa; }
.ftp-table tbody tr:hover { background: #f1f1f1; }
.ftp-table tbody tr.selected { background: #fff1f2; }
.ftp-name-btn { background: none; border: none; padding: 0; color: #374151; font-family: 'Fira Code', 'Courier New', monospace; cursor: default; text-decoration: none; font-size: 14px; }
.ftp-name-btn.is-dir { color: #2563eb; cursor: pointer; }
.ftp-name-btn i { font-size: 15px; margin-right: 6px; }
.ftp-del-btn { background: none; border: none; cursor: pointer; color: #d1d5db; padding: 4px; transition: color 0.12s; }
.ftp-del-btn:hover { color: #ef4444; }
.ftp-del-btn i { font-size: 19px; }

/* --- Busca na toolbar --- */
.ftp-search-wrap { position: relative; display: flex; align-items: center; }
.ftp-search-icon { position: absolute; left: 8px; color: #9ca3af; font-size: 14px; pointer-events: none; }
.ftp-search-input { height: 30px; padding: 0 10px 0 28px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 13px; color: #374151; background: #f9fafb; outline: none; width: 180px; transition: border-color 0.15s, background 0.15s; }
.ftp-search-input:focus { border-color: #c42030; background: #fff; }

/* --- Toasts --- */
#toast-container { position: fixed; bottom: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
#toast-container .toast { background: #fff; padding: 12px 16px 12px 14px; border-radius: 10px; display: flex; align-items: flex-start; gap: 12px; min-width: 220px; max-width: 360px; box-shadow: 0 4px 20px rgba(0,0,0,.12); border: 1px solid #e5e7eb; }
#toast-container .toast-icon { flex-shrink: 0; font-size: 24px; margin-top: 1px; }
#toast-container .toast-body { display: flex; flex-direction: column; gap: 2px; }
#toast-container .toast-title { font-weight: 600; font-size: 14px; color: #111827; }
#toast-container .toast-msg { font-size: 13px; color: #6b7280; }

/* --- Status Bar FTP --- */
.ftp-status-bar { display: flex; align-items: center; gap: 16px; padding: 5px 14px; background: #fff; border-top: 1px solid #e5e7eb; flex-shrink: 0; }
.ftp-status-text { font-size: 12px; color: #9ca3af; }
.ftp-status-selected { font-size: 12px; color: #c42030; font-weight: 600; }
.ftp-status-spacer { flex: 1; }
.ftp-status-path { font-size: 12px; color: #d1d5db; font-family: 'Fira Code', monospace; }

/* ============================================================
   GRID HELPERS
   ============================================================ */
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ============================================================
   UTILITÁRIOS
   ============================================================ */
.mono { font-family: 'Fira Code', 'Courier New', monospace; }
.flex-1 { flex: 1; }
.text-muted { color: #9ca3af; }
.text-sm { font-size: 13px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mb-14 { margin-bottom: 14px; }
.mb-20 { margin-bottom: 20px; }
.text-right { text-align: right; }

/* ============================================================
   REPLICAÇÃO — Formulário
   ============================================================ */
.form-field { margin-bottom: 14px; }
.form-label { font-size: 13px; font-weight: 500; color: #6b7280; display: block; margin-bottom: 6px; }
.form-label .req { color: #c42030; font-size: 15px; }
.form-hint { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.repl-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.repl-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.op-toggle { display: flex; gap: 8px; }
.op-option { cursor: pointer; }
.op-option input[type="radio"] { display: none; }
.op-option span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 14px; font-weight: 500; color: #6b7280; background: #fff; transition: all 0.15s; user-select: none; }
.op-option:hover span { border-color: #c42030; color: #c42030; }
.op-option input:checked + span { background: #c42030; color: #fff; border-color: #c42030; }
.multiselect-box { border: 1px solid #e5e7eb; border-radius: 6px; max-height: 150px; overflow-y: auto; background: #fff; }
.multiselect-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; color: #374151; cursor: pointer; transition: background 0.12s; }
.multiselect-item:hover { background: #f9fafb; }
.multiselect-item + .multiselect-item { border-top: 1px solid #f3f4f6; }
.multiselect-item input[type="checkbox"] { accent-color: #c42030; width: 13px; height: 13px; cursor: pointer; flex-shrink: 0; }
.multiselect-item:has(input:checked) { background: #fef2f2; color: #c42030; font-weight: 500; }
.multiselect-item.is-disabled { opacity: .45; cursor: not-allowed; }
.multiselect-item.is-disabled input { cursor: not-allowed; }
#somente-filtro-wrap { margin-bottom: 8px; }
@media (max-width: 768px) {
  .repl-grid-2 { grid-template-columns: 1fr; }
  .repl-grid-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   LOGIN
   ============================================================ */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 16px; }
.login-page .card { border-radius: 12px; padding: 44px 40px; width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 0; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08); }
.login-page .logo { width: 200px; }
.login-page .card form { width: 100%; margin-top: 28px; }
.login-page .fields { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.login-page .fields .form-input { width: 100%; }
.login-page .btn-primary { width: 100%; justify-content: center; margin-top: 14px; }
@media (max-width: 480px) {
  .login-page .card { padding: 32px 24px; }
  .login-page .logo { width: 160px; }
}

/* ============================================================
   RESPONSIVO
   ============================================================ */

/* Botão de toggle da sidebar FTP — oculto em desktop */
.ftp-sidebar-toggle { display: none; }
@media (max-width: 1024px) {
/* --- FTP Browser: context bar --- */
  .ftp-context-bar { height: auto; min-height: 44px; padding: 8px 16px; flex-wrap: wrap; gap: 6px 8px; }
  .ftp-ctx-info { width: 100%; }
  .ftp-ctx-spacer { display: none; }
  .ftp-exit-btn { flex: 1; justify-content: center; }
}
@media (max-width: 768px) {
/* --- Topbar --- */
  .topbar { padding: 0 16px; }
  .topbar-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 0; }
  .topbar-nav::-webkit-scrollbar { display: none; }
  .topbar-nav-item { padding: 0 12px; font-size: 13px; flex-shrink: 0; }
/* --- Layout --- */
  .page { padding: 20px 16px; }
/* --- Cabeçalho com busca --- */
  .page-header-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-header-row .input-wrapper { width: 100% !important; }
/* --- Filtros --- */
  .flex.items-center.gap-8.mb-14 { flex-wrap: wrap; }
  .flex.items-center.gap-8.mb-14 > .form-select { width: 100%; }
  .flex.items-center.gap-8.mb-14 > .input-wrapper { width: 100% !important; margin-left: 0 !important; }
  .flex.items-center.gap-8.mb-14 > .input-wrapper .form-input { width: 100%; }
/* --- Tabela: scroll horizontal --- */
  .card { overflow-x: auto; }
  .data-table { min-width: 560px; }
/* --- Grids --- */
  .grid-3 { grid-template-columns: 1fr; }
/* --- Footer dos cards com botões --- */
  .flex.items-center.justify-between { flex-wrap: wrap; gap: 12px; }
/* --- Paginação --- */
  .pagination { flex-wrap: wrap; gap: 8px; }
/* --- FTP Browser: wrapper altura dinâmica --- */
  .ftp-wrapper { position: fixed; top: 52px; left: 0; right: 0; bottom: 0; height: auto; }
  .ftp-body { flex: 1; min-height: 0; }
/* --- FTP Browser: sidebar oculta, desliza ao abrir --- */
  .ftp-sidebar { position: fixed; left: 0; top: 52px; bottom: 0; z-index: 150; transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15); }
  .ftp-sidebar.open { transform: translateX(0); }
/* --- FTP Browser: backdrop --- */
  .ftp-sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 140; background: rgba(0, 0, 0, 0.3); }
  .ftp-sidebar-backdrop.open { display: block; }
/* --- FTP Browser: toggle visível em mobile --- */
  .ftp-sidebar-toggle { display: inline-flex; }
/* --- FTP Browser: toolbar --- */
  .ftp-toolbar-nav { flex: 0 0 100%; min-width: 0; flex-wrap: wrap; row-gap: 4px; }
  .ftp-toolbar-spacer { display: none; }
  .ftp-toolbar-nav .ftp-breadcrumb { flex: 1; min-width: 0; overflow: hidden; }
  .ftp-toolbar-nav .ftp-search-wrap { width: 100%; flex: none; }
  .ftp-toolbar-nav .ftp-search-input { width: 100%; }
/* --- Send cards --- */
  .send-card-top { flex-wrap: wrap; }
/* --- Progress section controls --- */
  .flex.items-center.gap-8[style*="flex-wrap"] { row-gap: 8px; }
}
@media (max-width: 480px) {
  .topbar-logo-text { display: none; }
  .page { padding: 16px 12px; }
  .ftp-context-bar { padding: 8px 12px; }
}
