/* Módulo de integrações — tela "Dispositivos e integrações". Usa os tokens de web/css/app.css. */

/* Topo com imagem */
.dev-hero { position: relative; overflow: hidden; min-height: 240px; padding: 0; display: flex; align-items: stretch; background: linear-gradient(120deg, rgba(37, 99, 235, .22), rgba(10, 10, 10, .2) 60%), var(--card-bg); }
.dev-hero-body { position: relative; z-index: 1; padding: 28px; max-width: 560px; display: flex; flex-direction: column; justify-content: center; }
.dev-hero-body h2 { font-size: 24px; letter-spacing: -0.03em; margin-top: 4px; }
.dev-hero-body p { margin-top: 6px; }
/* Diagrama decorativo do fluxo de dados */
.dev-flow { position: absolute; top: 14px; bottom: 22px; right: 22px; width: min(54%, 620px); pointer-events: none; }
.dev-flow > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.flow-line { fill: none; stroke: var(--accent); stroke-opacity: .55; stroke-width: 1.6; stroke-dasharray: 3 9; stroke-linecap: round; vector-effect: non-scaling-stroke; animation: hposFlow 1.4s linear infinite; }
.flow-node { position: absolute; transform: translate(-50%, -32%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.flow-dot { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: var(--text-2); background: var(--surface-pop); border: 1px solid var(--border-2); box-shadow: 0 8px 22px -12px rgba(0, 0, 0, .6); }
.flow-node.hub .flow-dot { width: 50px; height: 50px; border-radius: 15px; color: #fff; border-color: transparent; background: radial-gradient(120% 120% at 20% 10%, #60a5fa 0%, #2563eb 45%, #1e3a8a 100%); box-shadow: 0 10px 32px -10px rgba(37, 99, 235, .7); }
.flow-label { font-size: 10.5px; color: var(--text-3); white-space: nowrap; background: color-mix(in srgb, var(--bg) 70%, transparent); padding: 1px 6px; border-radius: 6px; }
@keyframes hposFlow { to { stroke-dashoffset: -24; } }

/* Cartões de conexão */
.conn-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; color: var(--accent); background: var(--accent-soft); }
.conn-card .kv { margin-top: 4px; }
.connector-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.connector-card { display: flex; flex-direction: column; }
.connector-card h3 { letter-spacing: -0.015em; }
.connector-foot { margin-top: auto; padding-top: 16px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-sm { font-size: 11.5px; padding: 3px 9px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }

.dev-mini summary { cursor: pointer; font-size: 12.5px; color: var(--text-3); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.dev-mini summary::before { content: '›'; display: inline-block; transition: transform .15s var(--ease); font-size: 15px; line-height: 1; }
.dev-mini[open] summary::before { transform: rotate(90deg); }
.dev-mini summary::-webkit-details-marker { display: none; }
.dev-mini ul { margin: 8px 0 0; padding-left: 18px; }
.dev-mini li { margin: 3px 0; }
.dev-details summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 500; }
.dev-details summary span { display: inline-flex; align-items: center; gap: 8px; }
.dev-details summary::-webkit-details-marker { display: none; }
.dev-details[open] summary .icon:last-child { transform: rotate(180deg); }

/* Passo a passo */
.steps { margin: 0; padding-left: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 8px; }
.steps li { counter-increment: step; position: relative; padding-left: 34px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--accent-soft); color: var(--accent-text); }

/* Pareamento */
.pair-box { border-radius: var(--r); border: 1px solid var(--border-2); background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.pair-code { padding: 12px; border-radius: var(--r-sm); background: var(--bg-2); border: 1px dashed var(--border-2); word-break: break-all; font-size: 12px; color: var(--text); user-select: all; }

/* Assistente Relaxmedic */
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.model-option { position: relative; display: flex; flex-direction: column; padding: 13px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.model-option:hover { border-color: var(--border-2); }
.model-option.selected { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--accent-soft); }
.model-option input { position: absolute; opacity: 0; pointer-events: none; }
.model-option:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.model-name { font-weight: 600; font-size: 13.5px; }

/* Importação */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; min-height: 190px; padding: 24px; border-radius: var(--r-lg); border: 1.5px dashed var(--border-2); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, transform .15s var(--ease); }
.dropzone:hover, .dropzone:focus-visible { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--surface-2); }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.005); }
.dropzone-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.csv-preview { max-height: 220px; overflow: auto; }
.csv-preview td, .csv-preview th { white-space: nowrap; font-size: 12px; }
.csv-map { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow: auto; padding-right: 4px; }
.csv-map-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(200px, 1.6fr) 140px; gap: 8px; align-items: center; }

/* Histórico e payloads */
.run-item { border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.run-item summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; flex-wrap: wrap; }
.run-item summary::-webkit-details-marker { display: none; }
.run-item[open] summary { border-bottom: 1px solid var(--border); }
.run-body { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
.run-body ul { margin: 0; padding-left: 18px; }
.raw-json { margin: 0; max-height: 380px; overflow: auto; padding: 14px; border-radius: var(--r-sm); background: var(--bg-2); border: 1px solid var(--border); font-family: var(--font-mono); font-size: 11.5px; line-height: 1.55; color: var(--text-2); white-space: pre; tab-size: 2; }

/* Matriz de compatibilidade */
.matrix-wrap { max-height: 620px; overflow: auto; }
.matrix-table th { position: sticky; top: 0; z-index: 2; background: var(--surface-solid); }
.matrix-table th:first-child, .matrix-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface-solid); min-width: 220px; }
.matrix-table th:first-child { z-index: 3; }
.matrix-table td { vertical-align: top; }
.mx-ind summary { cursor: pointer; font-weight: 500; color: var(--text); list-style: none; }
.mx-ind summary::-webkit-details-marker { display: none; }
.mx-ind summary { text-decoration: underline dotted color-mix(in srgb, var(--text-4) 70%, transparent); text-underline-offset: 4px; }
.mx-ind ul { margin: 6px 0 0; padding-left: 16px; max-width: 360px; }
.mx-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; background: var(--surface-2); color: var(--text-4); }
.mx-pill.disponivel { background: var(--good-soft); color: var(--good-text); }
.mx-pill.condicional { background: var(--accent-soft); color: var(--accent-text); }
.mx-pill.requer_aprovacao { background: var(--warning-soft); color: var(--warning-text); }
.mx-pill.a_verificar { background: var(--serious-soft); color: var(--serious-text); }
.mx-pill.calculado { background: transparent; border-color: var(--border-2); color: var(--text-3); }
.mx-pill.indisponivel { background: transparent; border-color: var(--border); color: var(--text-5); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-5) 60%, transparent); }

@media (max-width: 720px) {
  .dev-hero { min-height: 180px; }
  .dev-flow { display: none; }
  .dev-hero-body { padding: 20px; }
  .dev-hero-body h2 { font-size: 20px; }
  .csv-map-row { grid-template-columns: 1fr; }
  .matrix-table th:first-child, .matrix-table td:first-child { min-width: 160px; }
}
