/* ==========================================================================
   Nexo Integration Center — Grupo Nexo (empresa fictícia)
   Identidade: ferramenta técnica de integração. Trilho escuro de "console",
   área de trabalho clara com grade pontilhada, dados em fonte monoespaçada,
   acento verde-limão para fluxo de dados e status sempre com ícone + texto.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --font-ui: 'Space Grotesk', 'Segoe UI', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;

    /* Trilho e painéis escuros */
    --chrome: #111317;
    --chrome-2: #191c22;
    --chrome-3: #22262e;
    --chrome-line: #2c313a;
    --chrome-text: #b3b9c4;
    --chrome-muted: #7d8491;

    /* Área de trabalho */
    --canvas: #ecede8;
    --panel: #ffffff;
    --line: #d6d8d0;
    --line-soft: #e8e9e3;
    --text: #1b1e24;
    --muted: #5b616c;
    --faint: #858b95;

    /* Acento */
    --accent: #c4f03a;
    --accent-strong: #a9d61b;
    --accent-ink: #3f5a00;
    --accent-wash: #f1fbd2;

    /* Status (reservados: sempre acompanhados de ícone e texto) */
    --ok: #1d9a5f;
    --ok-wash: #e3f5eb;
    --warn: #b87300;
    --warn-wash: #fdf1dc;
    --fail: #cc3d33;
    --fail-wash: #fce6e4;
    --off: #7d838d;
    --off-wash: #eceef1;

    --radius: 4px;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--text);
    font: 14px/1.45 var(--font-ui);
}

a {
    color: inherit;
}

h1, h2, h3, p {
    margin: 0;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent-strong);
    outline-offset: 3px;
}

code, .mono {
    font-family: var(--font-mono);
    font-size: 0.86em;
}

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

.muted {
    color: var(--faint);
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.is-warn {
    color: var(--warn);
}

.eyebrow {
    display: block;
    font: 500 11px var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--faint);
}

/* --------------------------------------------------------------------------
   Estrutura: trilho lateral + área principal
   -------------------------------------------------------------------------- */

.app {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
    /* mantém o trilho escuro até o fim em páginas longas */
    background: linear-gradient(to right, var(--chrome) 248px, transparent 248px);
}

.rail {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 16px;
    background: var(--chrome);
    color: var(--chrome-text);
    border-right: 1px solid #000;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}

.brand svg {
    width: 34px;
    height: 34px;
    fill: var(--accent);
    stroke: var(--accent);
}

.brand strong {
    display: block;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
}

.brand small {
    display: block;
    margin-top: 3px;
    font: 11px var(--font-mono);
    color: var(--chrome-muted);
}

.tenant {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--chrome-line);
    border-radius: var(--radius);
    background: var(--chrome-2);
    font-family: var(--font-mono);
}

.tenant span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--chrome-muted);
}

.tenant b {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}

.tenant em {
    font-style: normal;
    font-size: 11px;
    color: var(--accent);
}

.rail-nav {
    display: grid;
    gap: 2px;
}

.rail-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 14px;
    color: var(--chrome-text);
}

.rail-nav a span {
    font: 11px var(--font-mono);
    color: var(--chrome-muted);
}

.rail-nav a:hover {
    background: var(--chrome-2);
    color: #fff;
}

.rail-nav a.active {
    background: var(--chrome-3);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.rail-nav a.active span {
    color: var(--accent);
}

.rail-sources h2 {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font: 500 11px var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--chrome-muted);
}

.rail-sources ul {
    display: grid;
    gap: 1px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rail-sources li {
    display: grid;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    font-size: 13px;
}

.rail-sources li code {
    padding: 2px 0;
    text-align: center;
    border: 1px solid var(--chrome-line);
    border-radius: 3px;
    font-size: 10px;
    color: var(--chrome-text);
}

.rail-sources p {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.7;
    color: var(--chrome-muted);
}

.mode {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font: 500 10px var(--font-mono);
    font-style: normal;
}

.mode-local {
    background: var(--accent);
    color: #1a2300;
}

.mode-sim {
    border: 1px dashed currentColor;
    color: var(--chrome-muted);
}

.main .mode-sim {
    color: var(--muted);
}

.rail-foot {
    display: grid;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--chrome-line);
    font-size: 12px;
}

.rail-foot a {
    text-decoration: none;
    color: var(--chrome-muted);
}

.rail-foot a:hover {
    color: #fff;
}

.main {
    min-width: 0;
    padding: 0 28px 20px;
    background-image: radial-gradient(#c9ccc2 1px, transparent 1px);
    background-size: 18px 18px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 58px;
    border-bottom: 1px solid var(--line);
}

.crumbs {
    font: 12px var(--font-mono);
    color: var(--faint);
}

.crumbs b {
    font-weight: 500;
    color: var(--text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.demo-flag {
    font: 11px var(--font-mono);
    color: var(--faint);
}

.page-head {
    padding: 26px 0 20px;
}

h1 {
    max-width: 900px;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.12;
}

.lede {
    max-width: 780px;
    margin-top: 10px;
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   Componentes
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.btn:hover {
    border-color: var(--text);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--chrome);
    border-color: var(--chrome);
    color: var(--accent);
}

.btn-primary:hover {
    background: #000;
}

.btn-ghost {
    background: transparent;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

.notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--ok);
    border-radius: var(--radius);
    background: var(--panel);
}

.notice-error {
    border-left-color: var(--fail);
    background: var(--fail-wash);
}

.kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--line);
    overflow: hidden;
}

.kpis article {
    min-width: 0;
    padding: 14px 16px;
    background: var(--panel);
}

.kpis span {
    font: 500 11px var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--faint);
}

.kpis strong {
    display: block;
    margin: 6px 0 2px;
    font: 600 28px var(--font-mono);
    letter-spacing: -0.03em;
}

.kpis strong small {
    font-size: 14px;
    font-weight: 400;
    color: var(--faint);
}

.kpis p {
    font-size: 12px;
    color: var(--muted);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

input, select, textarea {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    font-size: 13px;
}

.filters input {
    width: 300px;
}

.filters > a {
    font-size: 13px;
    color: var(--muted);
}

.panel {
    position: relative;
    min-width: 0;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px 24px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--line-soft);
}

.panel-head.compact {
    padding: 12px 16px;
}

.panel-head h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.panel-note {
    max-width: 520px;
    font-size: 12px;
    color: var(--muted);
}

.count {
    margin-left: 6px;
    font: 12px var(--font-mono);
    color: var(--faint);
}

.empty {
    padding: 18px;
    color: var(--muted);
}

.help {
    margin: 8px 0 12px;
    font-size: 13px;
    color: var(--muted);
}

.help code, .tab-body code {
    padding: 1px 4px;
    border-radius: 3px;
    background: var(--off-wash);
}

.tag {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--line);
    border-radius: 3px;
    font: 12px var(--font-mono);
}

.kv {
    display: inline-block;
    margin: 1px 6px 1px 0;
    font: 12px var(--font-mono);
    color: var(--muted);
}

.kv b {
    font-weight: 500;
    color: var(--text);
}

/* Status: ícone + texto + cor */
.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px 2px 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status i {
    font-style: normal;
    font-size: 10px;
}

.status-ok { background: var(--ok-wash); color: #11683f; }
.status-warn { background: var(--warn-wash); color: #8a5500; }
.status-fail { background: var(--fail-wash); color: #a52a22; }
.status-off { background: var(--off-wash); color: #545a63; }

.dot {
    display: inline-block;
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-fail { background: var(--fail); }
.dot-off { background: var(--off); }

.origin {
    display: block;
    margin-top: 2px;
    font: 11px var(--font-mono);
    color: var(--faint);
}

.origin-local {
    color: var(--accent-ink);
}

/* Tabelas */
.table-wrap {
    position: relative; /* recorta também elementos .sr-only posicionados */
    overflow-x: auto;
}

.grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.grid-table th {
    padding: 9px 12px;
    background: #f5f6f2;
    border-bottom: 1px solid var(--line);
    font: 500 11px var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    white-space: nowrap;
    color: var(--muted);
}

.grid-table th small {
    display: block;
    text-transform: none;
    color: var(--accent-ink);
}

.grid-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
}

.grid-table td small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--faint);
}

.grid-table tbody tr:hover,
.grid-table tbody tr.is-linked {
    background: #f7faec;
}

.data-table td {
    white-space: nowrap;
}

.flow-name {
    display: inline-flex;
    gap: 6px;
    text-decoration: none;
    font-weight: 600;
}

.flow-name span {
    color: var(--accent-ink);
}

.flow-name:hover b {
    text-decoration: underline;
}

.integrations td {
    white-space: nowrap;
}

.integrations td small {
    white-space: normal;
    min-width: 170px;
    max-width: 240px;
}

.spark {
    width: 96px;
    height: 26px;
    overflow: visible;
}

.spark polyline {
    fill: none;
    stroke: var(--text);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

/* --------------------------------------------------------------------------
   Mapa de conexões (SVG)
   -------------------------------------------------------------------------- */

.panel-dark {
    background: var(--chrome);
    border-color: #000;
    color: var(--chrome-text);
}

.panel-dark .panel-head {
    border-bottom-color: var(--chrome-line);
}

.panel-dark h2 {
    color: #fff;
}

.panel-dark .eyebrow {
    color: var(--chrome-muted);
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
}

.legend li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.graph-scroll {
    position: relative;
    overflow-x: auto;
    padding: 10px 14px 4px;
    background-image: radial-gradient(#262a32 1px, transparent 1px);
    background-size: 16px 16px;
}

.graph {
    display: block;
    width: 100%;
    min-width: 760px;
    height: auto;
}

.graph .wire {
    fill: none;
    stroke-width: 2;
    stroke: #4a505b;
}

.graph .pulse {
    fill: none;
    stroke-width: 2;
    stroke-dasharray: 4 14;
    animation: nexo-flow 1.6s linear infinite;
}

.edge-ok .wire { stroke: #2f6b4d; }
.edge-ok .pulse { stroke: var(--accent); }
.edge-warn .wire { stroke: #7a5a1c; }
.edge-warn .pulse { stroke: #f2b441; }
.edge-fail .wire { stroke: var(--fail); stroke-dasharray: 6 5; }
.edge-off .wire { stroke: #3a3f48; stroke-dasharray: 2 6; }

.graph .port {
    fill: var(--chrome);
    stroke: #6b7280;
    stroke-width: 1.5;
}

.edge:hover .wire,
.edge.is-linked .wire {
    stroke-width: 3.5;
}

.edge:hover .port,
.edge.is-linked .port {
    fill: var(--accent);
}

.hub rect {
    fill: #0b0d10;
    stroke: var(--accent);
    stroke-width: 1.5;
}

.hub-title {
    fill: var(--accent);
    font: 600 15px var(--font-mono);
    letter-spacing: 0.08em;
}

.hub-sub {
    fill: var(--chrome-muted);
    font: 11px var(--font-mono);
}

.hub-step rect {
    fill: var(--chrome-3);
    stroke: var(--chrome-line);
    stroke-width: 1;
}

.hub-step text {
    fill: #e5e8ec;
    font: 12px var(--font-mono);
    white-space: pre;
}

.node-box {
    fill: var(--chrome-2);
    stroke: var(--chrome-line);
    stroke-width: 1;
}

.node:hover .node-box,
.node.is-linked .node-box {
    stroke: var(--accent);
}

.node-badge {
    fill: var(--chrome-3);
}

.node-abbr {
    fill: var(--accent);
    font: 600 11px var(--font-mono);
}

.node-label {
    fill: #fff;
    font: 600 14px var(--font-ui);
}

.node-sub {
    fill: var(--chrome-muted);
    font: 11px var(--font-mono);
}

.target .node-box {
    fill: #15181d;
}

.led { fill: var(--off); }
.node-ok .led { fill: #39c07f; }
.node-warn .led { fill: #f2b441; }
.node-fail .led { fill: #ff6b5e; }

.graph-hint {
    padding: 8px 18px 14px;
    font-size: 12px;
    color: var(--chrome-muted);
}

@keyframes nexo-flow {
    to {
        stroke-dashoffset: -36;
    }
}

/* --------------------------------------------------------------------------
   Métricas do pipeline ETL (visão geral)
   -------------------------------------------------------------------------- */

.etl-flow {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 22px;
    margin: 0;
    padding: 18px;
    list-style: none;
}

.etl-stage {
    position: relative;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--chrome);
    border-radius: var(--radius);
    background: #fbfbf8;
}

.etl-stage:not(:last-child)::after {
    content: '→';
    position: absolute;
    top: 40%;
    right: -18px;
    font: 16px var(--font-mono);
    color: var(--faint);
}

.etl-stage header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.etl-stage header span {
    font: 12px var(--font-mono);
    color: var(--accent-ink);
}

.etl-stage h3 {
    font-size: 16px;
    font-weight: 600;
}

.etl-stage dl,
.flow-node dl {
    display: grid;
    gap: 4px;
    margin: 0;
}

.etl-stage dl div,
.flow-node dl div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
}

.etl-stage dt,
.flow-node dt {
    color: var(--muted);
}

.etl-stage dd,
.flow-node dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    text-align: right;
}

.meter {
    height: 6px;
    margin-top: 12px;
    border-radius: 3px;
    background: var(--off-wash);
    overflow: hidden;
}

.meter span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--chrome);
}

/* --------------------------------------------------------------------------
   Pipelines (lista + detalhe)
   -------------------------------------------------------------------------- */

.workbench {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.conn-list ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.conn-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line-soft);
    text-decoration: none;
}

.conn-item:hover {
    background: #f7f8f4;
}

.conn-item.is-selected {
    background: #f4f9e4;
    box-shadow: inset 3px 0 0 var(--accent-strong);
}

.abbr {
    flex-shrink: 0;
    width: 40px;
    padding: 5px 0;
    border-radius: 3px;
    background: var(--chrome);
    color: var(--accent);
    font-size: 11px;
    text-align: center;
}

.conn-text {
    min-width: 0;
    flex: 1;
}

.conn-text b {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.conn-text small {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.pipeline {
    margin-bottom: 18px;
}

.pipeline-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
}

.pipeline-head h2 {
    margin: 4px 0 8px;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.pipeline-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
}

.pipeline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
}

.tabs {
    display: flex;
    gap: 2px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}

.tabs a {
    padding: 10px 12px;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    color: var(--muted);
}

.tabs a span {
    margin-left: 4px;
    font: 11px var(--font-mono);
    color: var(--faint);
}

.tabs a.active {
    border-bottom-color: var(--text);
    color: var(--text);
}

.run-result {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 18px;
    padding: 12px 18px;
    background: var(--accent-wash);
    border-bottom: 1px solid #dcebb0;
    font-size: 13px;
}

.run-result strong {
    font-family: var(--font-mono);
    font-size: 14px;
}

.run-result.is-sim {
    background: #f5f6f2;
    border-bottom-color: var(--line-soft);
}

.flow-canvas {
    padding: 18px;
    background-image: radial-gradient(#dcded6 1px, transparent 1px);
    background-size: 14px 14px;
    container-type: inline-size;
}

/* Espaço limitado: grade que quebra linha, sem conectores. */
.flow {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.flow-node {
    position: relative;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

/* Espaço suficiente: linha única origem → 5 etapas → destino, com conectores. */
@container (min-width: 1060px) {
    .flow {
        grid-template-columns: 0.8fr repeat(5, minmax(0, 1fr)) 0.8fr;
        gap: 16px;
    }

    .flow-node:not(:last-child)::after {
        content: '';
        position: absolute;
        top: 26px;
        right: -17px;
        width: 16px;
        border-top: 2px solid var(--chrome);
    }
}

.flow-node b {
    display: block;
    margin: 3px 0 2px;
    font-size: 15px;
}

.flow-node small {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.flow-node .flow-counts {
    margin-bottom: 8px;
    font-family: var(--font-mono);
    color: var(--text);
}

.flow-node em {
    font-style: normal;
    color: var(--warn);
}

.flow-node dl div {
    font-size: 12px;
}

.flow-endpoint {
    background: var(--chrome);
    border-color: var(--chrome);
    color: #fff;
}

.flow-endpoint .eyebrow,
.flow-endpoint small {
    color: var(--chrome-muted);
}

.flow-node.has-warn {
    border-top: 3px solid var(--warn);
}

.flow-node.has-fail {
    border-top: 3px solid var(--fail);
}

.flow-node.is-sim,
.flow-node.is-idle {
    border-style: dashed;
}

.mapping-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 18px;
    border-top: 1px solid var(--line-soft);
}

.mapping-strip code {
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--off-wash);
}

.mapping-strip a {
    margin-left: auto;
    font-size: 13px;
}

.tab-body {
    padding: 16px 18px;
}

.tab-body + .tab-body {
    border-top: 1px solid var(--line-soft);
}

.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.card {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.card h3,
.section-title h3 {
    font-size: 16px;
    font-weight: 600;
}

.section-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 16px;
    margin-bottom: 10px;
}

.section-title .muted {
    font-size: 12px;
}

.stack {
    display: grid;
    gap: 10px;
}

.stack label {
    display: grid;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
}

.stack .check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stack button {
    justify-self: start;
}

.inline-form {
    margin-top: 6px;
}

textarea {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    resize: vertical;
}

.endpoint-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-bottom: 12px;
    font-size: 13px;
}

.verb {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--ok-wash);
    color: #11683f;
    font: 600 11px var(--font-mono);
}

/* Console */
.console {
    background: #0c0e11;
    color: #c9ced6;
    font: 12px/1.7 var(--font-mono);
}

.pipeline .console {
    border-radius: 0 0 var(--radius) var(--radius);
}

.console-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #1f232a;
    color: #8a919d;
}

.console-bar b {
    font-weight: 500;
    color: #e6e9ee;
}

.console-bar > span:last-child {
    margin-left: auto;
}

.console-body {
    max-height: 420px;
    padding: 10px 16px 14px;
    overflow: auto;
}

.console p {
    margin: 2px 0;
    overflow-wrap: anywhere;
}

.console time {
    color: #6f7784;
}

.console .stage {
    color: #9fb4d8;
}

.console .conn {
    text-decoration: none;
    color: #e6e9ee;
}

.lvl {
    display: inline-block;
    min-width: 46px;
    font-weight: 600;
}

.lvl-INFO { color: #7fd1a8; }
.lvl-WARN { color: #f2b441; }
.lvl-ERROR { color: #ff7d71; }

.console-full {
    min-width: 0;
    border-radius: var(--radius);
}

.console-full .console-body {
    max-height: 640px;
}

.log-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
}

.trail {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 640px;
    overflow: auto;
}

.trail li {
    display: grid;
    gap: 2px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
}

.trail time,
.trail small {
    font-size: 12px;
    color: var(--faint);
}

/* Execuções */
.stage-chips {
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.stage-chips li {
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 3px;
    font: 11px var(--font-mono);
    white-space: nowrap;
}

.stage-chips li b {
    font-weight: 600;
}

.stage-chips li i {
    font-style: normal;
    color: var(--faint);
}

.stage-chips .has-warn {
    border-color: var(--warn);
}

.stage-chips .has-fail {
    border-color: var(--fail);
    color: var(--fail);
}

.runs-table td {
    white-space: nowrap;
}

/* APIs & eventos */
.api-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 18px;
    align-items: start;
}

.api-layout .panel > .help,
.api-layout .panel > form {
    margin-left: 18px;
    margin-right: 18px;
}

.api-layout .panel > form {
    margin-bottom: 18px;
}

.api-list {
    padding: 4px 18px 10px;
}

.api-row {
    display: grid;
    grid-template-columns: 220px repeat(3, minmax(0, 1fr));
    gap: 6px 14px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
}

.api-row a {
    min-width: 0;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.api-row a:hover code {
    text-decoration: underline;
}

.foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 20px;
    padding: 18px 0 6px;
    border-top: 1px solid var(--line);
    font: 12px var(--font-mono);
    color: var(--faint);
}

.foot a {
    text-decoration: none;
}

.foot a:hover {
    color: var(--text);
}

/* --------------------------------------------------------------------------
   Responsivo
   -------------------------------------------------------------------------- */

@media (max-width: 1280px) {
    .etl-flow {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .etl-stage::after {
        display: none;
    }

    .api-layout,
    .log-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .api-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .app {
        grid-template-columns: minmax(0, 1fr);
        background: none;
    }

    .rail {
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px 20px;
        padding: 14px 16px;
    }

    .tenant,
    .rail-sources,
    .rail-foot {
        display: none;
    }

    .rail-nav {
        display: flex;
        flex: 1 1 100%;
        overflow-x: auto;
    }

    .rail-nav a {
        white-space: nowrap;
    }

    .workbench {
        grid-template-columns: minmax(0, 1fr);
    }

    .conn-list ul {
        display: flex;
        overflow-x: auto;
    }

    .conn-list li {
        flex: 0 0 250px;
        border-right: 1px solid var(--line-soft);
    }

    .kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .main {
        padding: 0 16px 16px;
    }

    .topbar {
        flex-wrap: wrap;
        padding: 10px 0;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }

    h1 {
        font-size: 25px;
    }

    .kpis strong {
        font-size: 22px;
    }

    .filters input,
    .filters select {
        flex: 1 1 100%;
        width: 100%;
    }

    .etl-flow,
    .two-col {
        grid-template-columns: minmax(0, 1fr);
    }

    .pipeline-head h2 {
        font-size: 19px;
    }

    .mapping-strip a {
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .graph .pulse {
        animation: none;
    }
}

/* Durações nos rótulos das etapas mantêm a caixa original (ms, s). */
.flow-node .eyebrow {
    text-transform: none;
}
