* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { color: #1f2937; background: #f3f4f6; min-height: 100vh; }

.sr-only {
    position: absolute !important;
    width: 1px !important; height: 1px !important;
    padding: 0 !important; margin: -1px !important;
    overflow: hidden !important; clip: rect(0,0,0,0) !important;
    white-space: nowrap !important; border: 0 !important;
}

/* ============== LOGIN ============== */
.tela-hub {
    min-height: 100vh;
    background: url('../img/fundo.jpg') center/cover no-repeat, linear-gradient(135deg, #2b3079, #087292);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}

.card-hub {
    background: #fff;
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 100%; max-width: 380px;
    text-align: center;
}

.logo-hub { margin-bottom: 24px; }
.logo-hub img { max-width: 180px; height: auto; }

.titulo-hub { font-size: 22px; color: #1f2937; margin-bottom: 4px; font-weight: 700; }
.subtitulo-hub { font-size: 14px; color: #6b7280; margin-bottom: 24px; }

.alerta-hub {
    background: #fee2e2; color: #991b1b;
    border-radius: 6px; padding: 10px;
    margin-bottom: 16px; font-size: 14px;
}

.form-hub { display: flex; flex-direction: column; gap: 12px; }
.form-hub input {
    height: 44px;
    padding: 0 14px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    font-size: 15px;
}
.form-hub input:focus { outline: 2px solid #0a8ccc; outline-offset: -1px; background: #fff; }

.form-hub button {
    height: 44px;
    background: #4a4a4a;
    color: #fff;
    border: none; border-radius: 6px;
    font-weight: 700; font-size: 15px;
    cursor: pointer;
    margin-top: 8px;
}
.form-hub button:hover { background: #1f1f1f; }

/* ============== CLIENTES ============== */
.tela-clientes { background: #f3f4f6; }

.hub-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 24px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
}
.hub-header-logo img { height: 32px; width: auto; display: block; }
.hub-header-info { display: flex; align-items: center; gap: 16px; font-size: 14px; color: #374151; }
.btn-sair-hub {
    background: #fee2e2; color: #991b1b;
    padding: 6px 14px; border-radius: 6px;
    text-decoration: none; font-weight: 600; font-size: 13px;
}
.btn-sair-hub:hover { background: #fecaca; }

.hub-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}
.hub-main h1 { font-size: 28px; margin-bottom: 4px; color: #111827; }
.hub-subtitle { color: #6b7280; margin-bottom: 24px; font-size: 14px; }
.hub-subtitle strong { color: #374151; }

.hub-empty {
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 32px; text-align: center;
    color: #6b7280;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.cliente-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    border-top: 4px solid #0a8ccc;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow .15s;
}
.cliente-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

.cliente-card h2 { font-size: 18px; color: #111827; margin-bottom: 8px; }
.cliente-card .obs { color: #6b7280; font-size: 13px; margin-bottom: 12px; }

.cliente-row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0;
    border-top: 1px solid #f3f4f6;
    flex-wrap: wrap;
}
.cliente-row:first-of-type { border-top: none; }

.badge {
    font-size: 10px; font-weight: 700;
    padding: 3px 8px; border-radius: 4px;
    letter-spacing: .5px;
}
.badge.dev { background: #dbeafe; color: #1e40af; }
.badge.prod { background: #d1fae5; color: #065f46; }

.cliente-row a {
    color: #1f2937;
    text-decoration: none;
    font-weight: 500;
    flex: 1; min-width: 0;
    word-break: break-all;
}
.cliente-row a:hover { color: #0a8ccc; text-decoration: underline; }

.cliente-row code {
    background: #f3f4f6;
    color: #6b7280;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}

.cliente-row .indisponivel {
    color: #9ca3af; font-style: italic; font-size: 13px;
    flex: 1;
}

/* ============== AÇÕES DO CARD (rodapé) ============== */
.cliente-acoes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.btn-acao {
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s;
}
.btn-acao-icone {
    font-size: 14px; font-weight: 700;
    flex-shrink: 0;
}
.btn-acao-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-atualizar-prod { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.btn-atualizar-prod:hover { background: #bfdbfe; border-color: #93c5fd; }
.btn-atualizar-prod:active { background: #93c5fd; }

.btn-comparar-release { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.btn-comparar-release:hover { background: #ddd6fe; border-color: #c4b5fd; }
.btn-comparar-release:active { background: #c4b5fd; }

.btn-sincronizar-dev { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.btn-sincronizar-dev:hover { background: #fecaca; border-color: #fca5a5; }
.btn-sincronizar-dev:active { background: #fca5a5; }

/* ============== MODAL PERIGO (sincronizar-dev) ============== */
.modal-perigo { border-top: 4px solid #dc2626; }
.modal-perigo header h2 { color: #991b1b; }
.aviso-confirmar.perigo {
    color: #991b1b; font-weight: 600;
    background: #fef2f2; border: 1px solid #fecaca;
    padding: 8px 12px; border-radius: 6px;
    margin-top: 4px;
}
.label-senha { display: block; margin-top: 8px; }
.label-senha input {
    width: 100%; height: 40px;
    padding: 0 12px;
    border: 1px solid #d1d5db; border-radius: 6px;
    background: #f9fafb;
    font-size: 14px;
}
.label-senha input:focus {
    outline: 2px solid #dc2626; outline-offset: -1px; background: #fff;
}
.erro-senha {
    color: #991b1b; font-size: 13px;
    margin-top: 6px;
}
.btn-perigo-confirm {
    background: #dc2626; color: #fff;
    border: none; border-radius: 6px;
    padding: 8px 16px; font-weight: 700; cursor: pointer;
    font-size: 14px;
}
.btn-perigo-confirm:hover:not(:disabled) { background: #b91c1c; }
.btn-perigo-confirm:disabled { background: #9ca3af; cursor: not-allowed; }

/* ============== MODAL COMPARAR (resultado) ============== */
.modal-comparar-card { max-width: 980px; }

.modal-comparar-resultado {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    overflow: auto;
    max-height: 60vh;
    display: flex; flex-direction: column; gap: 14px;
}

.resumo-arquivos {
    display: flex; gap: 8px; flex-wrap: wrap;
}
.resumo-arquivos .badge {
    padding: 4px 10px; border-radius: 4px;
    font-size: 12px; font-weight: 600;
}
.resumo-arquivos .badge.novos { background: #d1fae5; color: #065f46; }
.resumo-arquivos .badge.mod   { background: #dbeafe; color: #1e40af; }
.resumo-arquivos .badge.rem   { background: #fee2e2; color: #991b1b; }

.resumo-acoes { display: flex; gap: 8px; }
.btn-download-release {
    background: #0a8ccc; color: #fff;
    text-decoration: none;
    padding: 8px 16px; border-radius: 6px;
    font-weight: 600; font-size: 14px;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-download-release:hover { background: #0772a8; }
.btn-download-release::before { content: '⬇'; font-weight: 700; }

.btn-enviar-drive {
    background: #16a34a; color: #fff;
    border: none; padding: 8px 16px; border-radius: 6px;
    font-weight: 600; font-size: 14px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-enviar-drive::before { content: '☁'; font-weight: 700; }
.btn-enviar-drive:hover:not(:disabled) { background: #15803d; }
.btn-enviar-drive:disabled { background: #9ca3af; cursor: not-allowed; }

.drive-result {
    align-self: center;
    font-size: 12px; color: #065f46;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    background: #d1fae5; padding: 4px 10px; border-radius: 4px;
}

.detalhes-arquivos summary,
.detalhes-instr summary {
    cursor: pointer; font-weight: 600; color: #1f2937;
    padding: 6px 0;
}
.listas-arquivos {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    gap: 12px; margin-top: 8px;
}
.listas-arquivos > div strong {
    display: block; font-size: 12px; color: #6b7280;
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
}
.listas-arquivos pre {
    background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 4px;
    padding: 8px; font-size: 11px; line-height: 1.4;
    max-height: 200px; overflow: auto;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    white-space: pre-wrap; word-break: break-all;
}

.label-sql { display: flex; flex-direction: column; gap: 6px; }
.label-sql > span {
    font-weight: 600; font-size: 13px; color: #1f2937;
}
.label-sql textarea {
    width: 100%; min-height: 180px;
    padding: 10px;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 12px; line-height: 1.5;
    background: #f9fafb; color: #1f2937;
    resize: vertical;
}

.detalhes-instr pre {
    background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 4px;
    padding: 12px; font-size: 12px; line-height: 1.5;
    max-height: 300px; overflow: auto;
    white-space: pre-wrap; word-break: break-word;
    margin-top: 8px;
}

@media (max-width: 720px) {
    .listas-arquivos { grid-template-columns: 1fr; }
}

/* ============== MODAL ATUALIZAR ============== */
.modal-atualizar {
    position: fixed; inset: 0;
    background: rgba(17, 24, 39, 0.6);
    display: flex; align-items: center; justify-content: center;
    padding: 24px; z-index: 100;
}
.modal-atualizar[hidden] { display: none; }

.modal-atualizar-card {
    background: #fff;
    border-radius: 8px;
    width: 100%; max-width: 820px;
    max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-atualizar-card header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.modal-atualizar-card header h2 {
    font-size: 16px; color: #111827; font-weight: 600;
}

.modal-atualizar-state {
    font-size: 11px; font-weight: 700;
    padding: 4px 10px; border-radius: 4px;
    letter-spacing: .3px; white-space: nowrap;
}
.state-running { background: #dbeafe; color: #1e40af; }
.state-running::before {
    content: '↻';
    display: inline-block;
    margin-right: 4px; font-weight: 700;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.state-done    { background: #d1fae5; color: #065f46; }
.state-failed  { background: #fee2e2; color: #991b1b; }
.state-orphan  { background: #fef3c7; color: #92400e; }
.state-idle    { background: #f3f4f6; color: #6b7280; }

.modal-atualizar-log {
    flex: 1; min-height: 200px;
    margin: 0; padding: 16px 20px;
    background: #0f172a; color: #cbd5e1;
    font-family: 'SFMono-Regular', Menlo, Consolas, 'Courier New', monospace;
    font-size: 12px; line-height: 1.5;
    overflow: auto; white-space: pre-wrap; word-break: break-word;
}

.modal-atualizar-card footer {
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex; justify-content: flex-end;
}
.btn-fechar-modal {
    background: #4a4a4a; color: #fff;
    border: none; border-radius: 6px;
    padding: 8px 20px; font-weight: 600; cursor: pointer;
}
.btn-fechar-modal:hover { background: #1f1f1f; }
.btn-fechar-modal:disabled {
    background: #d1d5db; color: #6b7280; cursor: not-allowed;
}

/* ============== MODAL CONFIRMAR ============== */
.modal-confirmar-card { max-width: 480px; }
.modal-confirmar-card header h2 { font-size: 17px; }

.modal-confirmar-body {
    padding: 20px;
    color: #374151; font-size: 14px; line-height: 1.55;
}
.modal-confirmar-body ul {
    list-style: none; padding: 0; margin: 0 0 16px;
}
.modal-confirmar-body li {
    padding: 8px 0 8px 22px; position: relative;
    border-bottom: 1px solid #f3f4f6;
}
.modal-confirmar-body li:last-child { border-bottom: none; }
.modal-confirmar-body li::before {
    content: '•'; color: #0a8ccc;
    position: absolute; left: 6px; top: 8px;
    font-weight: 700;
}
.modal-confirmar-body code {
    background: #f3f4f6; color: #1f2937;
    padding: 2px 6px; border-radius: 4px;
    font-size: 12px;
}
.aviso-confirmar {
    background: #fef3c7; color: #92400e;
    border-left: 3px solid #f59e0b;
    padding: 10px 12px; border-radius: 4px;
    font-size: 13px; font-weight: 500;
}

.modal-confirmar-card footer {
    gap: 8px;
}
.btn-cancelar-confirm, .btn-ok-confirm {
    border: none; border-radius: 6px;
    padding: 9px 18px; font-weight: 600; font-size: 14px;
    cursor: pointer;
}
.btn-cancelar-confirm {
    background: #fff; color: #374151;
    border: 1px solid #d1d5db;
}
.btn-cancelar-confirm:hover { background: #f3f4f6; }
.btn-ok-confirm {
    background: #0a8ccc; color: #fff;
}
.btn-ok-confirm:hover { background: #0772a8; }
.btn-ok-confirm:focus { outline: 2px solid #67c7ec; outline-offset: 2px; }

/* ============== PERFIL ============== */
.link-perfil-hub { color: #0a8ccc; text-decoration: none; }
.link-perfil-hub:hover { text-decoration: underline; }
.hub-header-logo a { display: block; }

.link-voltar-hub { color: #6b7280; text-decoration: none; font-size: 14px; }
.link-voltar-hub:hover { color: #0a8ccc; }

.alerta-erro {
    background: #fee2e2; color: #991b1b;
    border-radius: 6px; padding: 12px 16px;
    margin-bottom: 16px; font-size: 14px;
}
.alerta-ok {
    background: #d1fae5; color: #065f46;
    border-radius: 6px; padding: 12px 16px;
    margin-bottom: 16px; font-size: 14px;
}

.form-perfil {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    max-width: 520px;
}

.campo-perfil { margin-bottom: 16px; }
.campo-perfil label {
    display: block; font-size: 13px; font-weight: 600;
    color: #374151; margin-bottom: 6px;
}
.campo-perfil label small { font-weight: 400; color: #9ca3af; }
.campo-perfil .obrigatorio { color: #dc2626; }
.campo-perfil input {
    width: 100%; height: 40px;
    padding: 0 12px;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 14px; background: #fafafa;
}
.campo-perfil input:focus { outline: 2px solid #0a8ccc; outline-offset: -1px; background: #fff; }

.sep-perfil { border: none; border-top: 1px solid #e5e7eb; margin: 20px 0; }

.acoes-perfil {
    display: flex; gap: 12px;
    margin-top: 24px;
}
.btn-salvar-perfil {
    flex: 1; height: 44px;
    background: #0a8ccc; color: #fff;
    border: none; border-radius: 6px;
    font-weight: 600; cursor: pointer;
}
.btn-salvar-perfil:hover { background: #0772a8; }

.btn-cancelar-perfil {
    flex: 1; height: 44px;
    background: #fff; color: #374151;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-weight: 600; text-decoration: none;
    display: flex; align-items: center; justify-content: center;
}
.btn-cancelar-perfil:hover { background: #f3f4f6; }

.ultimo-login { color: #9ca3af; font-size: 12px; margin-top: 16px; }

@media (max-width: 600px) {
    .hub-header { padding: 12px 16px; }
    .hub-main { padding: 24px 16px 48px; }
    .hub-main h1 { font-size: 22px; }
    .hub-grid { grid-template-columns: 1fr; }
    .card-hub { padding: 28px 20px; }
    .acoes-perfil { flex-direction: column-reverse; }
    .modal-atualizar { padding: 12px; }
    .modal-atualizar-log { font-size: 11px; padding: 12px; }
}
