:root {
    --bg: #0a0b0f;
    --surface: #14151c;
    --border: #262832;
    --text: #e8e9ed;
    --text-muted: #8b8d98;
    --accent: #22c55e;
    --accent-hover: #16a34a;
    --danger: #ef4444;
    /* Variante más clara de --danger, usada solo como texto sobre el fondo
       teñido de .status-pill-error: con --danger (#ef4444) el contraste ahí
       cae a ~4.32:1 (falla el 4.5:1 exigido para texto de 12px, WCAG 1.4.3). */
    --danger-on-tint: #f87171;
    --warning: #f59e0b;
}

* { box-sizing: border-box; }

/* Utilidad para contenido solo-lector-de-pantalla (visualmente oculto). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Enlace "saltar al contenido" — oculto hasta recibir foco de teclado. */
.skip-link {
    position: absolute;
    top: -40px;
    left: 8px;
    z-index: 100;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 8px 14px;
    text-decoration: none;
}
.skip-link:focus {
    top: 8px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    font-size: 14px;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-wrap: wrap;
}
.topnav-side { flex: 1 1 0; display: flex; align-items: center; min-width: 0; }
.topnav-side.topnav-right { justify-content: flex-end; gap: 16px; }
.topnav-brand {
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
}
.topnav-links a { color: var(--text-muted); text-decoration: none; margin-right: 4px; padding: 6px 12px; border-radius: 6px; transition: background 0.15s ease, color 0.15s ease; }
.topnav-links a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.topnav-links a.active { color: var(--text); background: rgba(255,255,255,0.07); }

.content { max-width: 960px; margin: 0 auto; padding: 32px 24px; }

.centered-card { display: flex; justify-content: center; margin-top: 80px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; width: 360px; }

h1 { font-size: 20px; margin: 0 0 16px; letter-spacing: -0.01em; }
.muted { color: var(--text-muted); }
.hint { color: var(--text-muted); font-size: 13px; margin: 4px 0 12px; }
.hint-inline { color: var(--text-muted); font-weight: normal; font-size: 12px; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

label { display: block; margin: 14px 0 4px; font-size: 13px; color: var(--text-muted); }
input, select {
    width: 100%;
    background: #1b1c24;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 9px 10px;
    color: var(--text);
    font-size: 14px;
}
input:focus, select:focus { border-color: var(--accent); }

/* Indicador de foco visible para navegación por teclado (WCAG 2.4.7 / 2.4.11).
   Se usa :focus-visible para no mostrar el anillo en clics de mouse, pero sí
   siempre que se navegue con Tab. Contraste de --accent sobre --bg y --surface
   es amplio (>8:1), cumpliendo el 3:1 mínimo para indicadores no textuales. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}
.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; }

fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; margin-bottom: 16px; }
legend { padding: 0 8px; color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }

.form-columns { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.form-columns fieldset { flex: 1; min-width: 260px; margin-bottom: 0; }
.form-columns + fieldset { margin-top: 16px; }
details { margin-top: 8px; }
details summary { cursor: pointer; color: var(--text-muted); font-size: 13px; }

.form-actions { display: flex; gap: 12px; margin-top: 20px; }

.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn-primary { background: var(--accent); color: #06110a; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--text-muted); }

.link-button {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 14px; text-decoration: underline; transition: color 0.15s ease;
    /* Padding + margen negativo: agranda el área de toque a >=24px de alto
       (WCAG 2.5.8 Target Size) sin desplazar el layout visual (el margen
       negativo compensa el padding agregado). */
    display: inline-block;
    padding: 6px 2px;
    margin: -6px -2px;
}
.link-button:hover { color: var(--text); }
.link-button.danger { color: var(--danger); }
.topnav-logout { margin: 0; }

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-button:hover { color: var(--text); background: rgba(255,255,255,0.06); border-color: var(--border); }

.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; margin-bottom: 20px; }
.detail-card p { margin: 0 0 10px; }
.detail-card p:last-child { margin-bottom: 0; }
.data-table { width: 100%; border-collapse: collapse; }
.table-card .data-table { margin: 0; }
.data-table th, .data-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; background: rgba(255,255,255,0.02); }
.data-table tbody tr { transition: background 0.1s ease; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.data-table tbody tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions a {
    color: var(--text-muted); text-decoration: none; transition: color 0.15s ease;
    display: inline-block;
    padding: 6px 2px;
    margin: -6px -2px;
}
.row-actions a:hover { color: var(--text); }
.row-actions form { display: inline; }

.row-actions .btn-action {
    display: inline-block;
    box-sizing: border-box;
    min-width: 80px;
    text-align: center;
    padding: 6px 12px;
    margin: 0;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.row-actions .btn-action:hover { background: rgba(255,255,255,0.05); border-color: var(--text-muted); color: var(--text); }
.row-actions .btn-action.danger { color: var(--danger-on-tint); border-color: rgba(239,68,68,0.35); }
.row-actions .btn-action.danger:hover { background: rgba(239,68,68,0.08); border-color: var(--danger); }
.row-actions .btn-action.btn-danger-solid { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.row-actions .btn-action.btn-danger-solid:hover { background: #991b1b; border-color: #991b1b; }

.centered-table th, .centered-table td { text-align: center; }
.centered-table .row-actions { justify-content: center; }

.badge { background: #1b1c24; border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; font-size: 12px; }
.badge-muted { color: var(--text-muted); margin-left: 6px; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-running { background: var(--accent); }
.status-stopped { background: var(--text-muted); }
.status-error { background: var(--danger); }

.status-pill { display: inline-flex; align-items: center; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.status-pill .status-dot { margin-right: 6px; }
.status-pill-running { background: rgba(34,197,94,0.12); color: var(--accent); }
.status-pill-stopped { background: rgba(139,141,152,0.12); color: var(--text-muted); }
.status-pill-error { background: rgba(239,68,68,0.12); color: var(--danger-on-tint); }
.status-pill-info { background: rgba(139,141,152,0.12); color: var(--text-muted); }
.status-pill-warning { background: rgba(245,158,11,0.14); color: var(--warning); }

.exchange-logo { width: 15px; height: 15px; border-radius: 50%; object-fit: contain; background: #fff; padding: 1px; }

.direction-long { color: var(--accent); font-weight: 700; }
.direction-short { color: var(--danger); font-weight: 700; }
.direction-neutral { color: var(--text-muted); }

.error { color: var(--danger); font-size: 13px; }
.error-row { color: var(--danger); font-size: 12px; background: #1a0f0f; }


