/* ==========================================================================
   YieldPip · Panel
   ========================================================================== */

:root {
    --bg: #f4f3ef;
    --surface: #ffffff;
    --surface-2: #faf9f6;
    --ink: #15171a;
    --ink-2: #4b5058;
    --ink-3: #868b93;
    --line: #e2e0d9;
    --line-2: #eeece6;
    --pos: #12784a;
    --neg: #c03a2b;
    --warn: #a86a12;
    --pos-bg: #e6f2ec;
    --neg-bg: #f8e9e6;
    --warn-bg: #f7efdf;
    --focus: #2f5fd0;
    --chart-line: #15171a;
    --chart-fill: rgba(21, 23, 26, .06);

    /* Marca: los valores los pone assets/js/brand.js (selector «Marca»); estos son el respaldo. */
    --brand: var(--brand-l, #15171a);
    --on-brand: var(--on-brand-l, #f4f3ef);
    --brand-ink: var(--ink);
    --brand-ink-3: #a9adb3;

    --radius: 10px;
    --header-h: 95px;        /* cabecera: barra superior (56) + cotizaciones (38) + borde */
    --radius-sm: 6px;
    --shadow: 0 1px 0 rgba(21, 23, 26, .04);

    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
    --mono: "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e1012;
        --surface: #15181b;
        --surface-2: #1a1d21;
        --ink: #e9e7e2;
        --ink-2: #a9adb3;
        --ink-3: #6f747b;
        --line: #262a2f;
        --line-2: #1f2327;
        --pos: #45b37e;
        --neg: #ec6a5a;
        --warn: #d9a24a;
        --pos-bg: rgba(69, 179, 126, .12);
        --neg-bg: rgba(236, 106, 90, .12);
        --warn-bg: rgba(217, 162, 74, .12);
        --focus: #7d9ef0;
        --chart-line: #e9e7e2;
        --chart-fill: rgba(233, 231, 226, .06);
        --shadow: none;
        --brand: var(--brand-d, #e9e7e2);
        --on-brand: var(--on-brand-d, #0e1012);
        --brand-ink-3: #4b5058;
    }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.45 var(--font);
    font-feature-settings: "tnum" 1, "cv11" 1;
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }

/* --- marca -------------------------------------------------------------- */

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 22px; height: 22px; flex: none; display: inline-flex; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-name { font-weight: 600; letter-spacing: -.01em; font-size: 15px; }

/* --- controles ---------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
    border: 1px solid transparent; font-weight: 600; font-size: 14px;
    transition: background-color .15s, border-color .15s, opacity .15s;
}
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { opacity: .9; }
.btn-primary:disabled { opacity: .75; cursor: progress; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

.spinner {
    display: none; width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin .7s linear infinite;
}
.btn.is-busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
    background: none; border: 0; padding: 0; color: var(--ink-3);
    font-size: 12.5px; font-weight: 500;
}
.link-btn:hover { color: var(--ink); }

.tag {
    display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
    border-radius: 4px; background: var(--warn-bg); color: var(--warn);
    font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
}

.alert {
    padding: 10px 12px; border-radius: var(--radius-sm);
    background: var(--neg-bg); color: var(--neg); font-size: 13.5px;
    border: 1px solid color-mix(in srgb, var(--neg) 20%, transparent);
}

/* --- formulario --------------------------------------------------------- */

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }

.field input, .input-static {
    height: 42px; width: 100%; padding: 0 12px;
    border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--surface); font-size: 15px;
    transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--ink-3); opacity: .7; }
.field input:hover { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line)); }
.field input:focus {
    outline: none; border-color: var(--ink);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent);
}
.field input[aria-invalid] { border-color: var(--neg); }
.field-error { margin: 0; min-height: 0; font-size: 12.5px; color: var(--neg); }
.field-error:empty { display: none; }

.input-static {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--surface-2); color: var(--ink-2); cursor: default;
}

.form-hint { margin: -6px 0 0; font-size: 12.5px; color: var(--ink-3); text-align: center; }

/* --- pantalla de acceso ------------------------------------------------- */

body.auth { background: var(--bg); }

.auth-grid {
    display: grid; grid-template-columns: minmax(440px, 1fr) minmax(0, 1.15fr);
    min-height: 100vh; min-height: 100dvh;
}

.auth-main { display: flex; flex-direction: column; padding: 28px 40px; }
.auth-form-wrap { width: 100%; max-width: 360px; margin: auto; padding: 56px 0; }
.auth-title {
    margin: 0 0 10px; font: 600 30px/1.12 var(--font-display); letter-spacing: -.03em;
    text-wrap: balance;
}
.auth-title + .form { margin-top: 32px; }
.auth-sub { margin: 0 0 32px; color: var(--ink-3); font-size: 14.5px; text-wrap: pretty; }

body.auth .form { gap: 20px; }
body.auth .field { gap: 7px; }
body.auth .field label { font-size: 13px; font-weight: 500; color: var(--ink); }
body.auth .field input {
    height: 46px; padding: 0 14px; border-radius: 8px;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, .03);
}
body.auth .field input:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}
body.auth .field input[aria-invalid],
body.auth .field input[aria-invalid]:focus {
    border-color: var(--neg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--neg) 14%, transparent);
}
body.auth .btn-primary { height: 46px; margin-top: 6px; border-radius: 8px; font-size: 14.5px; }
body.auth .btn-primary:hover { opacity: .88; }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 46px !important; }
.pass-toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    width: 34px; height: 32px; display: grid; place-items: center;
    border: 0; border-radius: 6px; background: transparent; color: var(--ink-3);
    transition: color .15s, background-color .15s;
}
.pass-toggle:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pass-toggle .i-hide,
.pass-toggle[aria-pressed="true"] .i-show { display: none; }
.pass-toggle[aria-pressed="true"] .i-hide { display: block; }

.auth-foot { color: var(--ink-3); font-size: 12.5px; }

/* panel lateral: el sello del logo a escala gigante, recortado por el borde, con el nombre y una frase */

.auth-side {
    position: sticky; top: 12px; height: calc(100vh - 24px); height: calc(100dvh - 24px);
    margin: 12px 12px 12px 0; border-radius: 20px; overflow: hidden;
    background: #15171a; color: #f4f3ef;
    display: flex; flex-direction: column; justify-content: flex-end; padding: 52px;
}
.side-seal { position: absolute; width: max(100vh, 640px); left: -18vh; bottom: -34vh; pointer-events: none; }
.side-disc { fill: #202327; }
.side-cut { stroke: #15171a; }
.side-pip { fill: #f4f3ef; transform-origin: 33.5px 6.5px; animation: side-pip .9s cubic-bezier(.3, 1.4, .5, 1) .2s both; }
@keyframes side-pip { from { transform: translate(-4px, 6px) scale(.2); opacity: 0; } }
.side-word {
    position: relative; margin: 0;
    font: 600 clamp(56px, 7.4vw, 128px)/.9 var(--font-display); letter-spacing: -.045em;
}
.side-line { position: relative; margin: 20px 0 0; max-width: 26em; color: rgba(244, 243, 239, .64); font-size: 16px; }

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

@media (prefers-color-scheme: dark) {
    .auth-side { background: var(--surface); border: 1px solid var(--line); color: #e9e7e2; }
    .side-disc { fill: #1d2125; }
    .side-cut { stroke: var(--surface); }
    .side-pip { fill: #e9e7e2; }
    .side-line { color: rgba(233, 231, 226, .6); }
    body.auth .field input { box-shadow: none; }
}

@media (max-width: 1100px) {
    .auth-side { padding: 40px; }
}

@media (max-width: 900px) {
    .auth-grid { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .auth-main { padding: 20px; }
    .auth-form-wrap { padding: 40px 0; }
}

/* --- app ---------------------------------------------------------------- */

.topbar {
    position: sticky; top: 0; z-index: 10;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    max-width: 1440px; margin: 0 auto; height: 56px; padding: 0 24px;
    display: flex; align-items: center; gap: 24px;
}
.account-chip {
    display: flex; align-items: center; gap: 10px; min-width: 0;
    color: var(--ink-2); font-size: 13px; white-space: nowrap;
}
.account-name { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.sep { width: 1px; height: 14px; background: var(--line); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }

/* Buscador de instrumentos de la barra superior: botón con aspecto de campo que abre el buscador de símbolos */
.topsearch {
    display: inline-flex; align-items: center; gap: 8px; width: 220px; height: 32px; padding: 0 6px 0 10px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
    color: var(--ink-3); font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s;
}
.topsearch:hover, .topsearch:focus-visible { border-color: var(--ink-3); color: var(--ink-2); }
.topsearch-text { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topsearch-kbd {
    display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
    border: 1px solid var(--line); border-radius: 4px; background: var(--bg);
    font: 600 11px/1 var(--mono, ui-monospace, monospace); color: var(--ink-3);
}
@media (max-width: 1280px) {
    .topsearch { width: 32px; padding: 0; justify-content: center; }
    .topsearch-text, .topsearch-kbd { display: none; }
}

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.status[data-state="live"] .status-dot { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-bg); }
.status[data-state="stale"] .status-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.status[data-state="error"] .status-dot { background: var(--neg); box-shadow: 0 0 0 3px var(--neg-bg); }
.status[data-state="loading"] .status-dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.page { min-width: 0; padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.alert-page { margin: 0; }

.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    padding: 18px 20px 0;
}
.card-title { margin: 0; font-size: 14px; font-weight: 600; }
.card-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }

/* resumen */

.summary { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.summary-main {
    display: grid; grid-template-columns: 1.25fr 1fr; gap: 24px;
    padding: 24px; border-right: 1px solid var(--line);
}
.summary-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); margin: 0;
}
.summary-grid .metric { padding: 18px 20px; border-left: 1px solid var(--line-2); }
.summary-grid .metric:nth-child(3n+1) { border-left: 0; }
.summary-grid .metric:nth-child(-n+3) { border-bottom: 1px solid var(--line-2); }

.metric { display: flex; flex-direction: column; gap: 4px; margin: 0; min-width: 0; }
.metric-label { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.metric dd { margin: 0; }
.metric-value {
    font-size: 17px; font-weight: 600; letter-spacing: -.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border-radius: 3px; transition: background-color .8s;
}
.metric-xl .metric-value { font: 600 34px/1.1 var(--font-display); letter-spacing: -.025em; }
.metric-lg .metric-value { font: 600 24px/1.2 var(--font-display); letter-spacing: -.02em; color: var(--ink-2); }
.metric-xl, .metric-lg { justify-content: flex-end; container-type: inline-size; }
/* Equity y balance: la letra se reduce lo justo para que el importe quepa entero en su columna. */
.metric-xl .metric-value { font-size: min(34px, 13.5cqi); }
.metric-lg .metric-value { font-size: min(24px, 13.5cqi); }
.metric-delta, .metric-foot { font-size: 13px; color: var(--ink-3); }

.is-pos { color: var(--pos) !important; }
.is-neg { color: var(--neg) !important; }
.is-warn { color: var(--warn) !important; }

.flash-up { background-color: var(--pos-bg); transition: none; }
.flash-down { background-color: var(--neg-bg); transition: none; }

.meter {
    position: relative; height: 4px; margin-top: 8px; border-radius: 2px;
    background: var(--line-2); overflow: visible;
}
.meter-fill {
    position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 2px;
    background: var(--pos); transition: width .4s ease, background-color .4s;
}
.meter-mark { position: absolute; top: -3px; width: 1px; height: 10px; background: var(--ink-3); }

/* curva + stats */

.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }

.chart-card { display: flex; flex-direction: column; min-height: 340px; }
.chart { position: relative; flex: 1; min-height: 280px; margin: 8px 8px 8px 0; }
.chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line-2); }
/* Marca de agua de YieldPip en los gráficos SVG (assets/js/watermark.js); la de los canvas usa la misma opacidad */
.yp-wm { color: var(--ink); opacity: .28; }
.chart .axis text { fill: var(--ink-3); font-size: 11px; }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-fill); }
.chart .cross { stroke: var(--ink-3); stroke-dasharray: 2 3; }
.chart .dot { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.chart-empty {
    position: absolute; inset: 0; display: grid; place-items: center;
    color: var(--ink-3); font-size: 13px;
}
.chart-tip {
    position: absolute; top: 8px; pointer-events: none; z-index: 2;
    display: grid; gap: 1px; padding: 7px 10px; border-radius: var(--radius-sm);
    background: var(--ink); color: var(--bg); font-size: 12px; white-space: nowrap;
    transform: translateX(-50%);
}
.tip-date { opacity: .7; }
.tip-value { font-weight: 600; font-size: 13px; }

.segmented {
    display: inline-flex; padding: 2px; border-radius: 7px;
    background: var(--surface-2); border: 1px solid var(--line);
}
.segmented button {
    height: 26px; padding: 0 10px; border: 0; border-radius: 5px;
    background: transparent; color: var(--ink-3); font-size: 12.5px; font-weight: 600;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }

.stats { margin: 0; padding: 8px 20px 12px; display: grid; }
.stats div {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--line-2);
}
.stats div:last-child { border-bottom: 0; }
.stats dt { color: var(--ink-2); font-size: 13px; }
.stats dd { margin: 0; font-weight: 600; }

/* tablas */

.card-head-tabs { padding: 0 20px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 24px; }
.tab {
    position: relative; height: 48px; padding: 0; border: 0; background: none;
    color: var(--ink-3); font-weight: 600; font-size: 13.5px;
    display: inline-flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); }
.tab.is-active::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand);
}
.count {
    min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px;
    background: var(--line-2); color: var(--ink-2); font-size: 11.5px;
    display: inline-grid; place-items: center;
}

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-3);
    padding: 10px 20px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.table td { padding: 11px 20px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; }
.table td.sym { font-weight: 600; }
.table td[data-open-sym] { cursor: pointer; }
.table td[data-open-sym]:hover { text-decoration: underline; text-underline-offset: 3px; }
.table td.muted { color: var(--ink-3); }
.side { font-size: 12px; font-weight: 600; text-transform: lowercase; }
.side-buy { color: var(--pos); }
.side-sell { color: var(--neg); }
.table-empty { margin: 0; padding: 28px 20px; text-align: center; color: var(--ink-3); font-size: 13px; }
.table-wrap.has-rows .table-empty { display: none; }
.table-wrap:not(.has-rows) .table { display: none; }

.page-foot {
    display: flex; justify-content: space-between; padding: 4px 4px 16px;
    color: var(--ink-3); font-size: 12px;
}

/* skeleton mientras llega el primer snapshot */
.app.is-loading .metric-value, .app.is-loading .stats dd {
    color: transparent !important;
    background: linear-gradient(90deg, var(--line-2), var(--surface-2), var(--line-2));
    background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.app.is-loading .metric-value { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1100px) {
    .summary { grid-template-columns: 1fr; }
    .summary-main { border-right: 0; border-bottom: 1px solid var(--line); }
    .split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .topbar-inner { padding: 0 16px; gap: 12px; }
    .account-chip > :not(.account-name):not(.tag) { display: none; }
    .page { padding: 16px; }
    .summary-main { grid-template-columns: 1fr; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .summary-grid .metric { border-left: 0 !important; border-bottom: 1px solid var(--line-2); }
    .status-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ping del servidor en la pantalla de acceso */
.server-meta { display: inline-flex; align-items: center; gap: 10px; }
.ping { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.ping-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.ping[data-state="ok"] .ping-dot { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-bg); }
.ping[data-state="slow"] .ping-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.ping[data-state="down"] .ping-dot { background: var(--neg); box-shadow: 0 0 0 3px var(--neg-bg); }
.ping[data-state="down"] .ping-text { color: var(--neg); }
.ping[data-state="loading"] .ping-dot { animation: pulse 1.2s ease-in-out infinite; }

/* ==========================================================================
   Multi-cuenta: barra lateral, cabecera de cuenta, diálogos
   ========================================================================== */

.shell {
    max-width: 1440px; margin: 0 auto;
    display: grid; grid-template-columns: 264px minmax(0, 1fr);
    min-height: calc(100vh - var(--header-h));
}

.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.user-avatar {
    width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
    background: var(--brand); color: var(--on-brand); font-weight: 600; font-size: 12px;
}

/* barra lateral */
.sidebar {
    position: sticky; top: var(--header-h); align-self: start;
    height: calc(100vh - var(--header-h)); overflow-y: auto;
    padding: 24px 12px 24px 24px; display: flex; flex-direction: column; gap: 8px;
}
.sidebar-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 6px; }
.sidebar-head h2 { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.sidebar-count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.acc-list { display: grid; gap: 6px; }
.acc-item {
    width: 100%; text-align: left; display: grid; gap: 6px;
    padding: 12px 12px 11px; border-radius: var(--radius);
    background: transparent; border: 1px solid transparent;
    transition: background-color .15s, border-color .15s;
}
.acc-item:hover { background: var(--surface); border-color: var(--line-2); }
.acc-item.is-active { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
.acc-item-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.acc-item-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-item-login { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.acc-item-values { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.acc-item-equity { font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.acc-item-pnl { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.acc-item-state { font-size: 12px; color: var(--ink-3); }
.acc-item-state.is-neg { color: var(--neg); }

.acc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.acc-dot[data-state="live"] { background: var(--pos); }
.acc-dot[data-state="connecting"] { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.acc-dot[data-state="error"] { background: var(--neg); }

.acc-add {
    display: flex; align-items: center; gap: 10px; width: 100%;
    margin-top: 4px; padding: 11px 12px; border-radius: var(--radius);
    background: none; border: 1px dashed var(--line); color: var(--ink-2); font-weight: 600; font-size: 13px;
}
.acc-add:hover:not(:disabled) { border-color: var(--ink-3); color: var(--ink); }
.acc-add:disabled { opacity: .5; cursor: not-allowed; }
.acc-add-icon {
    width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
    background: var(--line-2); font-size: 15px; line-height: 1;
}

/* cabecera de la cuenta */
.account-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.account-data { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.acc-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 2px 2px 0; }
.acc-title { margin: 0; font: 600 22px/1.2 var(--font-display); letter-spacing: -.02em; }
.acc-meta { margin: 6px 0 0; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--ink-3); font-size: 13px; }
.acc-actions { display: flex; gap: 8px; }

.btn-danger { color: var(--neg); }
.btn-danger:hover { border-color: var(--neg); color: var(--neg); }
.btn-danger-solid { background: var(--neg); color: #fff; }
.btn-danger-solid:hover { opacity: .9; }

.connecting { display: flex; align-items: center; gap: 16px; padding: 20px 22px; }
.connecting strong { font-size: 14px; }
.connecting p { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }
.spinner-lg { display: inline-block; width: 20px; height: 20px; border-width: 2px; color: var(--ink-3); flex: none; }

/* estado vacío */
.empty { display: grid; place-items: center; min-height: 420px; text-align: center; }
.empty-inner { max-width: 420px; padding: 40px 24px; }
.empty h1 { margin: 0 0 8px; font: 600 22px/1.25 var(--font-display); letter-spacing: -.02em; }
.empty p { margin: 0 0 22px; color: var(--ink-2); }

/* diálogos */
.modal {
    width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line);
    border-radius: 12px; background: var(--surface); color: var(--ink);
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, .25);
}
.modal-sm { width: min(380px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(14, 16, 18, .45); }
.modal .form { padding: 22px 22px 18px; gap: 16px; }
.modal-head h2 { margin: 0; font: 600 17px/1.3 var(--font-display); letter-spacing: -.01em; }
.modal-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 13px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.field-help { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.optional { font-weight: 400; color: var(--ink-3); margin-left: 4px; }

@media (max-width: 900px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: static; height: auto; padding: 16px 16px 0; min-width: 0;
        flex-direction: row; align-items: stretch; overflow-x: auto; overflow-y: visible;
    }
    .sidebar-head { display: none; }
    .acc-list { display: flex; gap: 8px; }
    .acc-item { min-width: 190px; background: var(--surface); border-color: var(--line-2); }
    .acc-add { width: auto; margin: 0; white-space: nowrap; }
    .acc-header { flex-direction: column; align-items: flex-start; }
}

/* --- bot de la cuenta --------------------------------------------------- */

.field select {
    height: 42px; width: 100%; padding: 0 36px 0 12px;
    border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none; color: var(--ink); font: inherit; font-size: 15px;
    transition: border-color .15s, box-shadow .15s;
}
.field select:hover { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line)); }
.field select:focus {
    outline: none; border-color: var(--ink);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent);
}
.field select:disabled { opacity: .6; cursor: progress; }

/* color del estado del bot: lo usan la tarjeta, la píldora y la barra lateral */
[data-state="running"]  { --bot-c: var(--pos);  --bot-bg: var(--pos-bg); }
[data-state="starting"], [data-state="stopping"], [data-state="no_trading"], [data-state="paused"] { --bot-c: var(--warn); --bot-bg: var(--warn-bg); }
[data-state="error"]    { --bot-c: var(--neg);  --bot-bg: var(--neg-bg); }
[data-state="unknown"]  { --bot-c: var(--ink-3); --bot-bg: var(--line-2); }

/* tarjeta del bot */
.bot-card {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 24px;
    padding: 18px 20px 18px 22px;
}
.bot-card::before {
    content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--bot-c, transparent);
    transition: background-color .3s;
}
.bot-card:not([data-state="none"]) { background: var(--surface); }
.bot-card[data-state="none"] { background: var(--surface-2); border-style: dashed; }

.bot-card-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.bot-avatar {
    position: relative; flex: none; width: 48px; height: 48px; border-radius: 12px;
    display: grid; place-items: center; background: var(--ink); color: var(--bg);
}
.bot-card[data-state="none"] .bot-avatar { background: var(--surface); color: var(--ink-3); border: 1px solid var(--line); }
.bot-card:not([data-state="none"]) .bot-avatar::after {
    content: ""; position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--bot-c); border: 2.5px solid var(--surface);
}
.bot-card-body { min-width: 0; display: grid; gap: 2px; }
.bot-card-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bot-card-eyebrow {
    font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
}
.bot-card-name { margin: 0; font: 600 18px/1.25 var(--font-display); letter-spacing: -.015em; }
.bot-card[data-state="none"] .bot-card-name { color: var(--ink-2); font-size: 16px; }
.bot-card-desc {
    margin: 0; max-width: 620px; font-size: 13px; line-height: 1.45; color: var(--ink-3);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bot-card-msg { margin: 4px 0 0; font-size: 12.5px; font-weight: 600; color: var(--bot-c, var(--warn)); }

.bot-status {
    display: inline-flex; align-items: center; gap: 7px; height: 22px; padding: 0 9px 0 8px;
    border-radius: 11px; background: var(--bot-bg); color: var(--bot-c);
    font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
}
.bot-status-dot { position: relative; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.bot-status[data-state="running"] .bot-status-dot::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor;
    animation: bot-ping 1.8s cubic-bezier(0, 0, .2, 1) infinite;
}
.bot-status[data-state="starting"] .bot-status-dot,
.bot-status[data-state="stopping"] .bot-status-dot,
.bot-status[data-state="unknown"] .bot-status-dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes bot-ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

.bot-card-stats { display: flex; margin: 0; }
.bot-card-stats div { display: grid; gap: 3px; padding: 2px 20px; border-left: 1px solid var(--line-2); min-width: 112px; }
.bot-card-stats dt { font-size: 12px; color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.bot-card-stats dd { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.bot-card-stats dd.mono { font-size: 13.5px; }

.bot-card-actions { display: flex; gap: 8px; }
.bot-card-actions .btn-primary { padding: 0 16px; }

@media (max-width: 1100px) {
    .bot-card { grid-template-columns: minmax(0, 1fr) auto; }
    .bot-card-stats { grid-column: 1 / -1; grid-row: 2; padding-top: 14px; border-top: 1px solid var(--line-2); }
    .bot-card-stats div:first-child { border-left: 0; padding-left: 0; }
}
@media (max-width: 720px) {
    .bot-card { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .bot-card-stats { grid-row: auto; flex-wrap: wrap; row-gap: 12px; }
    .bot-card-stats div { min-width: 0; padding: 0 16px; }
    .bot-card-actions .btn { flex: 1; }
}

/* barra lateral: bot de la cuenta */
.acc-item-bot {
    flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
    background: var(--bot-bg); color: var(--bot-c);
}

/* diálogo: elegir bot */
.bot-options { display: grid; gap: 8px; }
.bot-options-loading { margin: 0; padding: 22px; text-align: center; color: var(--ink-3); font-size: 13px; }
.bot-option {
    position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 14px;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
    cursor: pointer; transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.bot-option:hover { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line)); }
.bot-option input { position: absolute; opacity: 0; pointer-events: none; }
.bot-option:has(input:checked) {
    border-color: var(--ink); background: var(--surface-2);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent);
}
.bot-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.bot-option:has(input:disabled) { cursor: progress; opacity: .7; }
.bot-option-icon {
    flex: none; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
    background: var(--ink); color: var(--bg);
}
.bot-option:has(input[value=""]) .bot-option-icon { background: var(--line-2); color: var(--ink-3); }
.bot-option-body { display: grid; gap: 3px; min-width: 0; flex: 1; }
.bot-option-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 20px; }
.bot-option-name { font-weight: 600; font-size: 14px; }
.bot-option-meta {
    height: 20px; padding: 0 7px; border-radius: 4px; display: inline-flex; align-items: center;
    background: var(--line-2); color: var(--ink-2); font-size: 11.5px;
}
.bot-option-current {
    height: 20px; padding: 0 7px; border-radius: 4px; display: inline-flex; align-items: center;
    background: var(--pos-bg); color: var(--pos); font-size: 11.5px; font-weight: 600;
}
.bot-option-desc { font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }
.bot-option-check {
    flex: none; margin-top: 8px; width: 18px; height: 18px; border-radius: 50%;
    border: 1.5px solid var(--line); transition: border-color .15s;
}
.bot-option:has(input:checked) .bot-option-check { border-color: var(--ink); background: var(--ink); box-shadow: inset 0 0 0 3.5px var(--surface-2); }

.bot-option.is-locked { cursor: not-allowed; }
.bot-option:has(input[data-locked]) { opacity: .6; }
.bot-option-tag {
    height: 20px; padding: 0 7px; border-radius: 4px; display: inline-flex; align-items: center;
    border: 1px solid var(--line); color: var(--ink-2); font-size: 11.5px;
}
.bot-group {
    margin: 8px 0 0; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    color: var(--ink-3);
}
.bot-group:first-child { margin-top: 0; }
.bot-group-count { margin-left: 6px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.bot-group-empty { margin: 0; padding: 10px 2px; font-size: 12.5px; color: var(--ink-3); }
.bot-own-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bot-own-actions .btn { height: 28px; padding: 0 10px; font-size: 12.5px; }
.bot-own-params { font-size: 11.5px; color: var(--ink-3); margin-left: 4px; }
.bot-upload-tile {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left;
    border: 1px dashed var(--line); border-radius: var(--radius); background: transparent; color: inherit;
    cursor: pointer; transition: border-color .15s, background-color .15s;
}
.bot-upload-tile:hover { border-color: var(--ink-3); background: var(--surface-2); }
.bot-upload-tile:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.bot-upload-tile strong { display: block; font-size: 14px; }
.bot-upload-tile small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.bot-upload-plus {
    flex: none; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
    border: 1px dashed var(--ink-3); font-size: 20px; line-height: 1; color: var(--ink-2);
}
.bot-none { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.bot-own-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 0;
    padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
    font-size: 12.5px; color: var(--ink-3);
}
.bot-own-bar .btn { flex: none; }

/* --- pestaña Bots: bot de la cuenta + catálogo en rejilla + barra de aplicar ------- */
body.view-bots #account-view, body.view-bots #empty { display: none !important; }
.bots-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.bots-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.bots-noacc { min-height: 360px; }

/* Tu servidor: consumo del terminal MT5 de la cuenta */
.srv-card { display: grid; gap: 16px; padding: 18px 20px 18px 22px; }
.srv-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.srv-icon {
    flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.srv-head-text { flex: 1; min-width: 0; }
.srv-title { margin: 0; font: 600 16px/1.25 var(--font-display); letter-spacing: -.015em; }
.srv-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.srv-pill {
    --c: var(--ink-3); --b: var(--line-2);
    flex: none; display: inline-flex; align-items: center; gap: 7px; height: 22px; padding: 0 9px 0 8px;
    border-radius: 11px; background: var(--b); color: var(--c); font-size: 11.5px; font-weight: 600;
}
.srv-pill[data-state="ok"] { --c: var(--pos); --b: var(--pos-bg); }
.srv-pill[data-state="off"] { --c: var(--neg); --b: var(--neg-bg); }
.srv-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.srv-pill[data-state="wait"] .srv-pill-dot { animation: pulse 1.2s ease-in-out infinite; }
.srv-meters { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.srv-stats { display: flex; flex-wrap: wrap; margin: 0; padding-top: 14px; border-top: 1px solid var(--line-2); row-gap: 10px; }
.srv-stats div { display: grid; gap: 3px; padding: 0 20px; border-left: 1px solid var(--line-2); min-width: 112px; }
.srv-stats div:first-child { border-left: 0; padding-left: 0; }
.srv-stats dt { font-size: 12px; color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.srv-stats dd { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
    .srv-head { flex-wrap: wrap; }
    .srv-stats div { padding: 0 14px; min-width: 0; }
}
.bots-noacc .choice-icon { margin: 0 auto 14px; }
.bots-noacc h2 { margin: 0 0 8px; font: 600 19px/1.3 var(--font-display); letter-spacing: -.015em; }
.bots-form { display: grid; gap: 16px; }

.bots-catalog { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: stretch; }
.bots-catalog > .bot-group, .bots-catalog > .bot-group-empty,
.bots-catalog > .bot-options-loading, .bots-catalog > .bot-none { grid-column: 1 / -1; }
.bots-catalog > .bot-group { margin: 14px 0 -2px; display: flex; align-items: center; gap: 10px; }
.bots-catalog > .bot-group::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.bots-catalog > .bot-group:first-child { margin-top: 0; }
.bots-catalog > .bot-group .bot-group-count { margin-left: 0; }
.bots-catalog .bot-option { padding: 16px; gap: 14px; min-height: 104px; }
.bots-catalog .bot-option-icon { width: 42px; height: 42px; border-radius: 11px; }
.bots-catalog .bot-option-name { font-size: 15px; }
.bots-catalog .bot-option-desc { font-size: 13px; }
.bots-catalog .bot-option-check { margin-top: 12px; }
.bots-catalog .bot-upload-tile { min-height: 104px; padding: 16px; gap: 14px; }
.bots-catalog .bot-upload-plus { width: 42px; height: 42px; border-radius: 11px; }
.bots-catalog > .bot-none { margin-top: 4px; padding-top: 16px; display: grid; grid-template-columns: subgrid; }
.bots-catalog > .bot-none .bot-option { min-height: 0; }

.bots-apply {
    position: sticky; bottom: 16px; z-index: 5;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 14px 12px 18px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
    animation: bots-apply-in .18s ease-out;
}
@keyframes bots-apply-in { from { transform: translateY(8px); opacity: 0; } }
.bots-apply-text { display: grid; gap: 3px; min-width: 0; }
.bots-apply-text strong { font-size: 14px; }
.bots-apply .bot-warn { margin: 0; font-weight: 500; }
.bots-apply-actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 720px) {
    .bots-catalog { grid-template-columns: minmax(0, 1fr); }
    .bots-apply { flex-direction: column; align-items: stretch; }
    .bots-apply-actions .btn { flex: 1; }
}

/* --- EAs propias ------------------------------------------------------------ */
.ea-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ea-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.ea-item-body { display: grid; gap: 3px; min-width: 0; flex: 1; }
.ea-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.ea-item-meta { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ea-item-desc { font-size: 12.5px; color: var(--ink-3); }
.ea-item-actions { display: flex; gap: 6px; flex: none; }
.ea-badge {
    height: 20px; padding: 0 7px; border-radius: 4px; display: inline-flex; align-items: center;
    background: var(--pos-bg); color: var(--pos); font-size: 11.5px; font-weight: 600;
}
.ea-badge.is-neg { background: var(--neg-bg); color: var(--neg); }
.ea-form { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); gap: 14px; }
.ea-form-title { margin: 0; font-size: 14px; }
.ea-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.ea-form .field { align-content: start; }

.field select option { background: var(--surface); color: var(--ink); }
.sym-pick { position: relative; }
.sym-pick-list {
    position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px;
    list-style: none; max-height: 240px; overflow-y: auto; border: 1px solid var(--line);
    border-radius: var(--radius-sm); background: var(--surface); box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.sym-pick-list li[data-i] {
    display: grid; gap: 1px; padding: 7px 10px; border-radius: 6px; cursor: pointer;
}
.sym-pick-list li[data-i]:hover, .sym-pick-list li.is-active { background: var(--surface-2); }
.sym-pick-name { font-size: 13.5px; font-weight: 600; }
.sym-pick-desc { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sym-pick-empty { padding: 8px 10px; font-size: 12.5px; color: var(--ink-3); }
.ea-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.field textarea {
    width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--surface); font: inherit; color: inherit;
}
.field textarea { padding: 10px 12px; resize: vertical; font-family: var(--mono); font-size: 13px; min-height: 72px; }
.field textarea:focus {
    outline: none; border-color: var(--ink);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent);
}
.field input[type="file"] { height: auto; padding: 9px 12px; font-size: 13.5px; }
.ea-params-links { display: flex; gap: 14px; }
.ea-params-note { line-height: 1.5; }
.ea-params-note .link-btn { margin-left: 4px; }
.ea-params { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.ea-param-group {
    margin: 8px 0 0; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3);
}
.ea-param-group:first-child { margin-top: 0; }
.ea-param { display: grid; grid-template-columns: 150px minmax(0, 1fr) 96px; gap: 10px; align-items: center; }
.ea-param label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.ea-param input[type="text"] {
    height: 34px; width: 100%; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--surface); font-size: 13.5px; font-family: var(--mono);
}
.ea-param input[type="text"]:focus { outline: none; border-color: var(--ink); }
.ea-param input[type="checkbox"] { width: 18px; height: 18px; justify-self: start; accent-color: var(--ink); }
.ea-param-def { font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ea-param.is-changed label { color: var(--ink); font-weight: 600; }
.ea-param.is-changed label::after { content: " •"; color: var(--warn); }
@media (max-width: 560px) { .ea-form-row { grid-template-columns: 1fr; } .ea-item { flex-wrap: wrap; } .ea-param { grid-template-columns: 110px minmax(0, 1fr) 64px; } }

.bot-warn {
    display: flex; gap: 8px; align-items: flex-start; margin: -4px 0 0;
    font-size: 12.5px; font-weight: 600; color: var(--warn);
}
.bot-warn svg { flex: none; margin-top: 2px; }
#bot-submit:disabled:not(.is-busy) { opacity: .35; cursor: not-allowed; }

/* --- gestión automática ------------------------------------------------- */

/* tarjeta (misma base que la del bot) */
.gest-rules, .gest-events { margin: 0; padding: 0; list-style: none; }
.gest-rules { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: -8px; }
.gest-log-btn .count { margin-left: 6px; }
.gest-rules li {
    height: 24px; padding: 0 9px; border-radius: 6px; display: inline-flex; align-items: center;
    background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-2);
    font-size: 12px; font-weight: 500; white-space: nowrap;
}
.gest-events { display: grid; gap: 0; max-height: min(420px, 60vh); overflow-y: auto; border-top: 1px solid var(--line-2); }
.gest-events:empty { display: none; }
.gest-events-empty { margin: 0; padding: 18px 0; text-align: center; color: var(--ink-3); font-size: 13px; }
.gest-events li {
    display: grid; grid-template-columns: 72px minmax(110px, auto) minmax(0, 1fr); gap: 12px; align-items: baseline;
    padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 12.5px;
}
.gest-events li:last-child { border-bottom: 0; padding-bottom: 0; }
.gest-ev-time { color: var(--ink-3); white-space: nowrap; }
.gest-ev-pos { color: var(--ink-2); white-space: nowrap; }
.gest-ev-text { color: var(--ink-2); min-width: 0; }
.gest-events li.is-fail .gest-ev-text { color: var(--warn); }
@media (max-width: 720px) {
    .gest-events li { grid-template-columns: auto minmax(0, 1fr); }
    .gest-ev-text { grid-column: 1 / -1; }
}

/* marca en la tabla de posiciones */
.pos-gest {
    display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 7px; vertical-align: -3px;
    border-radius: 5px; background: var(--pos-bg); color: var(--pos); cursor: help;
}

/* formulario (pestaña Auto manager) */
.gest-scope { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gest-scope-opt {
    position: relative; display: flex; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius);
    cursor: pointer; transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.gest-scope-opt input { position: absolute; opacity: 0; pointer-events: none; }
.gest-scope-opt span { display: grid; gap: 2px; }
.gest-scope-opt strong { font-size: 13.5px; }
.gest-scope-opt small { font-size: 12px; color: var(--ink-3); }
.gest-scope-opt:hover { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line)); }
.gest-scope-opt:has(input:checked) {
    border-color: var(--ink); background: var(--surface-2);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent);
}
.gest-scope-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

.gest-secs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gest-sec {
    display: grid; gap: 8px; align-content: start; padding: 12px 13px 13px;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
    transition: background-color .15s, border-color .15s;
}
.gest-sec-wide { grid-column: 1 / -1; }
.gest-sec.is-off { background: var(--surface-2); border-style: dashed; }
.gest-sec.is-off .gest-fields { opacity: .45; }
.gest-sec-help { margin: -4px 0 0; font-size: 12px; line-height: 1.4; color: var(--ink-3); }
.gest-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gest-fields-3 { grid-template-columns: repeat(3, 1fr); }
.gest-fields .field { gap: 4px; }
.gest-fields .field label { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.gest-fields .field input { height: 36px; font-size: 14px; font-variant-numeric: tabular-nums; }
.gest-units { margin: -4px 0 0; }
.gest-off { margin-right: auto; }

.gest-switch { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.gest-switch input { position: absolute; opacity: 0; pointer-events: none; }
.gest-switch-ui {
    position: relative; flex: none; width: 30px; height: 18px; border-radius: 9px;
    background: var(--line); transition: background-color .15s;
}
.gest-switch-ui::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
    background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s;
}
.gest-switch input:checked + .gest-switch-ui { background: var(--ink); }
.gest-switch input:checked + .gest-switch-ui::after { transform: translateX(12px); }
.gest-switch input:focus-visible + .gest-switch-ui { outline: 2px solid var(--focus); outline-offset: 2px; }
.gest-switch input:disabled + .gest-switch-ui { opacity: .6; }
.gest-sec-title { font-size: 13.5px; font-weight: 600; }
#gest-submit:disabled:not(.is-busy) { opacity: .35; cursor: not-allowed; }

@media (max-width: 600px) {
    .gest-scope, .gest-secs { grid-template-columns: 1fr; }
    .gest-fields-3 { grid-template-columns: 1fr 1fr; }
}

/* --- modo Prop Firm ----------------------------------------------------- */

/* diálogo */
.gest-risk:not(.is-off) { border-color: color-mix(in srgb, var(--focus) 35%, var(--line)); }
.gest-risk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.gest-risk-badge {
    font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--focus);
    background: color-mix(in srgb, var(--focus) 10%, transparent); padding: 3px 8px; border-radius: 999px;
}
.gest-risk-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.gest-risk-preset {
    height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
    color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.gest-risk-preset:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line)); color: var(--ink); }
.gest-risk-preset.is-on { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.gest-risk-preset:disabled { opacity: .45; cursor: default; }
.gest-risk.is-off .gest-risk-presets { opacity: .45; }
.gest-fields .field select { height: 36px; font-size: 13px; }
.gest-risk-reset { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.gest-risk-reset input { margin-top: 2px; }
.gest-risk-reset[hidden] { display: none; }

/* tarjeta: medidores del challenge */
.risk-panel { grid-column: 1 / -1; display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.risk-panel[hidden] { display: none; }
.risk-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 22px; }
.risk-wait { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.risk-meter { display: grid; gap: 6px; min-width: 0; --m: var(--pos); }
.risk-meter[data-tone="neg"][data-level="warn"] { --m: var(--warn); }
.risk-meter[data-tone="neg"][data-level="danger"] { --m: var(--neg); }
.risk-meter[data-tone="pos"] { --m: var(--focus); }
.risk-meter[data-tone="pos"][data-level="done"] { --m: var(--pos); }
.risk-meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.risk-meter-label { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.risk-meter-val { font-size: 13px; font-weight: 600; color: var(--m); }
.risk-bar { height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.risk-bar span { display: block; height: 100%; border-radius: inherit; background: var(--m); transition: width .5s ease, background-color .3s; }
.risk-meter-sub { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; line-height: 1.35; }

.risk-lock {
    display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: var(--radius-sm);
    background: var(--neg-bg); color: var(--neg); border: 1px solid color-mix(in srgb, var(--neg) 22%, transparent);
}
.risk-lock[hidden] { display: none; }
.risk-lock svg { flex: none; }
.risk-lock div { display: grid; gap: 2px; min-width: 0; flex: 1; }
.risk-lock strong { font-size: 13.5px; }
.risk-lock span { font-size: 12.5px; color: var(--ink-2); }
.risk-lock .btn { flex: none; }
.risk-panel[data-lock="target"] .risk-lock {
    background: var(--pos-bg); color: var(--pos); border-color: color-mix(in srgb, var(--pos) 22%, transparent);
}
.risk-panel[data-lock="daily"] .risk-lock {
    background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent);
}

/* --- administración ----------------------------------------------------- */

.tag-admin { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.plan-select {
    height: 28px; padding: 0 8px; font: inherit; font-size: 12.5px;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.plan-select:hover { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line)); }
.plan-select:focus { outline: none; border-color: var(--ink); }
.plan-select:disabled { opacity: .6; cursor: progress; }
.plan-select option { background: var(--surface); color: var(--ink); }
.admin .brand { gap: 10px; }
.admin-page { max-width: 1440px; margin: 0 auto; width: 100%; }
.admin-alerts { display: grid; gap: 8px; }
.admin-alerts:empty { display: none; }
.alert-warn {
    background: var(--warn-bg); color: var(--warn);
    border-color: color-mix(in srgb, var(--warn) 20%, transparent);
}

.kpis { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { padding: 16px 20px; border-right: 1px solid var(--line-2); display: grid; gap: 4px; align-content: start; }
.kpi:last-child { border-right: 0; }
.kpi dt { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.kpi dd { margin: 0; font: 600 22px/1.2 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi dd.is-pos { color: var(--pos); }
.kpi dd.is-neg { color: var(--neg); }
.kpi-foot { font-size: 12px; color: var(--ink-3); }

.admin .table td { vertical-align: top; }
.admin .table td.num, .admin .table th.num { font-variant-numeric: tabular-nums; }
.admin .table .is-pos { color: var(--pos); }
.admin .table .is-neg { color: var(--neg); }
.muted { color: var(--ink-3); }
.is-neg { color: var(--neg); }
.cell-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); }
/* Admin, Bots de YieldPip: visible / oculto para los usuarios */
.bot-visible { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.bot-visible input { width: 16px; height: 16px; margin: 0; accent-color: var(--pos); cursor: pointer; }
.bot-visible input:not(:checked) + span { color: var(--ink-3); }
.who-list .who { display: block; }
/* Admin, YieldPip AI: periodo (enlaces con aspecto de .segmented), resumen y notas */
.segmented a {
    display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 5px;
    color: var(--ink-3); font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.segmented a:hover { color: var(--ink); }
.segmented a.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.ai-admin-kpis { border-bottom: 1px solid var(--line-2); }
.ai-admin-note { margin: 0; padding: 12px 20px; font-size: 13px; line-height: 1.5; }
.ai-admin-sub { margin: 0; padding: 16px 20px 8px; font-size: 13px; font-weight: 600; border-top: 1px solid var(--line-2); }
.admin .table tr.is-selected td { background: var(--surface-2); }

.dot-label { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot-label[data-state="live"] .dot { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-bg); }
.dot-label[data-state="stale"] .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.dot-label[data-state="error"] .dot { background: var(--neg); box-shadow: 0 0 0 3px var(--neg-bg); }
.dot-label[data-state="loading"] .dot { animation: pulse 1.2s ease-in-out infinite; }
.dot-label[data-state="off"] { color: var(--ink-3); }

.admin-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .admin-cols { grid-template-columns: minmax(0, 1fr); } }

.services { margin: 0; padding: 4px 20px 16px; display: grid; gap: 0; }
.services div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.services div:last-child { border-bottom: 0; }
.services dt { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.services dd { margin: 0; font-size: 13px; color: var(--ink-2); }
@media (max-width: 720px) {
    .services div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .kpi { border-right: 0; border-bottom: 1px solid var(--line-2); }
}

a.btn { text-decoration: none; }

/* --- cerrar posiciones -------------------------------------------------- */

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card-head-tabs { align-items: center; }
.btn-xs { height: 26px; padding: 0 10px; font-size: 12px; font-weight: 600; }
.btn-xs:disabled { opacity: .6; cursor: progress; }
.table td.actions { padding-top: 6px; padding-bottom: 6px; width: 1%; }
.close-warn { margin: -6px 0 0; font-size: 12.5px; color: var(--warn); font-weight: 600; }

/* --- estado vacío: conectar / crear ------------------------------------- */

.empty-inner:has(.choice) { max-width: 640px; }
.choice {
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: stretch; gap: 0; margin-top: 6px; text-align: left;
}
.choice-card {
    display: flex; flex-direction: column; gap: 6px; padding: 22px;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
    transition: border-color .15s, background-color .15s;
}
.choice-card:hover { border-color: color-mix(in srgb, var(--ink-3) 50%, var(--line)); background: var(--surface); }
.choice-card h2 { margin: 8px 0 0; font: 600 15.5px/1.3 var(--font-display); letter-spacing: -.01em; }
.empty .choice-card p { margin: 0 0 16px; flex: 1; font-size: 13px; color: var(--ink-3); }
.choice-icon {
    width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    background: var(--surface); border: 1px solid var(--line); color: var(--ink);
}
.choice-or { position: relative; width: 44px; display: grid; place-items: center; }
.choice-or::before {
    content: ""; position: absolute; top: 12px; bottom: 12px; left: 50%; width: 1px; background: var(--line-2);
}
.choice-or span {
    position: relative; padding: 4px 0; background: var(--surface);
    font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em;
}
@media (max-width: 720px) {
    .choice { grid-template-columns: minmax(0, 1fr); }
    .choice-or { width: auto; height: 36px; }
    .choice-or::before { top: 50%; bottom: auto; left: 12px; right: 12px; width: auto; height: 1px; }
    .choice-or span { padding: 0 8px; }
}

/* barra lateral: crear cuenta */
.acc-create { margin-top: 0; border-style: solid; border-color: transparent; color: var(--ink-3); }
.acc-create:hover { border-color: var(--line); }
@media (max-width: 900px) { .acc-create { border-color: var(--line-2); } }

/* --- asistente crear cuenta --------------------------------------------- */

.modal-wide { width: min(500px, calc(100vw - 32px)); }

.steps { list-style: none; margin: 2px 0 0; padding: 0; display: flex; align-items: center; }
.step { display: flex; align-items: center; gap: 8px; flex: 1; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.step:not(:last-child)::after { content: ""; flex: 1; height: 1px; margin: 0 10px; background: var(--line); }
.step:last-child { flex: none; }
.step-num {
    width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none;
    border: 1px solid var(--line); background: var(--surface); font-size: 12px;
    transition: background-color .2s, color .2s, border-color .2s;
}
.step.is-active { color: var(--ink); }
.step.is-active .step-num { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.step.is-done { color: var(--ink-2); }
.step.is-done .step-num { background: var(--pos-bg); border-color: transparent; color: var(--pos); font-size: 0; }
.step.is-done .step-num::before { content: "✓"; font-size: 12px; }
.step.is-done:not(:last-child)::after { background: var(--pos); opacity: .5; }

.step-panel { display: grid; gap: 12px; min-height: 214px; align-content: start; padding-top: 4px; }
.step-title { margin: 0; font: 600 15.5px/1.3 var(--font-display); letter-spacing: -.01em; }
.step-text { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.step-text strong { color: var(--ink); }

.brokers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.broker {
    position: relative; display: flex; align-items: center; gap: 12px; padding: 14px;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
    cursor: pointer; transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.broker:hover { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line)); }
.broker input { position: absolute; opacity: 0; pointer-events: none; }
.broker:has(input:checked) {
    border-color: var(--ink); background: var(--surface-2);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent);
}
.broker:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.broker-logo {
    width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; flex: none;
    font-weight: 700; font-size: 11px; letter-spacing: .02em; color: #fff;
}
.broker-a { background: #334155; font-size: 18px; }
.broker-b { background: #64748b; font-size: 18px; }
.broker-name { font-weight: 600; font-size: 14px; }
.broker-check {
    margin-left: auto; width: 18px; height: 18px; border-radius: 50%; flex: none;
    border: 1.5px solid var(--line); transition: border-color .15s, border-width .15s;
}
.broker:has(input:checked) .broker-check { border-color: var(--ink); background: var(--ink); box-shadow: inset 0 0 0 3.5px var(--surface-2); }
#create-next:disabled { opacity: .35; cursor: not-allowed; }

/* enlace de afiliado */
.affiliate-note {
    display: flex; gap: 8px; align-items: flex-start; margin: 2px 0 0;
    font-size: 12.5px; line-height: 1.45; color: var(--ink-3);
}
.affiliate-note svg { flex: none; margin-top: 2px; }
.broker-reopen { justify-self: start; }

#create-open[aria-disabled="true"] { opacity: .35; cursor: not-allowed; pointer-events: none; }
#create-dialog .modal-foot { align-items: center; }

.deposit {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 16px 18px; border-radius: var(--radius);
    background: var(--pos-bg); border: 1px solid color-mix(in srgb, var(--pos) 18%, transparent);
}
.deposit-label { font-size: 13px; font-weight: 600; color: var(--pos); }
.deposit-value { font: 600 28px/1 var(--font-display); letter-spacing: -.02em; color: var(--pos); }

.creds {
    list-style: none; margin: 0; padding: 0; display: grid;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.creds li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; font-size: 13px; color: var(--ink-3); }
.creds li + li { border-top: 1px solid var(--line-2); }
.creds-key { font-weight: 600; color: var(--ink); }

#create-dialog .modal-foot .btn { white-space: nowrap; }

@media (max-width: 480px) {
    .brokers { grid-template-columns: 1fr; }
    .step-label { display: none; }
    #create-dialog .modal-foot { flex-wrap: wrap; }
    #create-dialog .modal-foot .btn-primary { order: -1; flex: 1 0 100%; }
}

/* --- registro ----------------------------------------------------------- */

.auth-switch {
    margin: 28px 0 0; padding-top: 22px; border-top: 1px solid var(--line);
    text-align: center; font-size: 13.5px; color: var(--ink-3);
}
.auth-switch a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.auth-switch a:hover { text-decoration-color: currentColor; }
.user-chip > span:last-child { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.captcha-field { min-height: 65px; }
/* verificación del email (verify.php) */
.field input.code-input { height: 52px; text-align: center; font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: .4em; }
.alert-ok { background: var(--pos-bg); color: var(--pos); border-color: color-mix(in srgb, var(--pos) 20%, transparent); }
.resend-btn { font-size: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.resend-btn:disabled { text-decoration: none; cursor: default; opacity: .7; }
/* login: «¿Has olvidado tu contraseña?» junto a la etiqueta */
.field-link { font-size: 12.5px; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.field-link:hover { color: var(--ink); text-decoration-color: currentColor; }
/* cambio de email pendiente de confirmar (ajustes) */
.email-pending {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px;
    padding: 8px 10px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn); font-size: 12.5px;
}
.email-pending[hidden] { display: none; }
.email-pending strong { color: var(--ink); font-weight: 600; word-break: break-all; }
.email-pending-actions { display: inline-flex; gap: 12px; }
.email-pending .link-btn { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.email-pending .link-btn:hover { color: var(--ink); }

/* --- ajustes del usuario (app/settings_view.php): vista propia, una tarjeta por ajuste ----------------- */
body.view-settings .shell { grid-template-columns: minmax(0, 1fr); }
body.view-settings .sidebar,
body.view-settings #account-view,
body.view-settings #empty { display: none !important; }
.settings-view { display: grid; gap: 16px; width: 100%; max-width: 760px; margin: 0 auto; align-content: start; }
main.settings-view { max-width: calc(760px + 48px); }
.settings-head { margin-bottom: 4px; align-items: center; }
.settings-head .btn svg { margin-right: 2px; }
.settings-card { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 24px; padding: 22px 24px; }
.settings-card-head { padding-top: 2px; }
.settings-card-head .card-sub { margin-top: 4px; line-height: 1.45; }
.settings-form { gap: 14px; min-width: 0; }
.settings-form .field input { height: 38px; font-size: 14px; }
.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.settings-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.settings-saved { margin-right: auto; font-size: 12.5px; color: var(--pos); }
.settings-note { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.settings-note strong { word-break: break-all; }
.settings-hint { margin: 0; text-align: left; }
.settings-langs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
#settings-submit:disabled:not(.is-busy) { opacity: .35; cursor: not-allowed; }
#settings.is-active { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
@media (max-width: 720px) {
    .settings-card { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 18px; }
    .settings-row { grid-template-columns: minmax(0, 1fr); }
}

/* --- mercado: cotizaciones y sesiones ----------------------------------- */

.marketbar { border-top: 1px solid var(--line-2); }
.marketbar-inner {
    max-width: 1440px; margin: 0 auto; height: 38px; padding: 0 24px;
    display: flex; align-items: center; gap: 20px;
}
.ticker {
    flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 2px; margin-left: -8px;
    overflow-x: auto; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
            mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
}
.ticker::-webkit-scrollbar { display: none; }
.ticker-empty { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

.quote {
    position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px;
    height: 28px; padding: 0 8px; border-radius: var(--radius-sm);
    font-size: 12.5px; white-space: nowrap; cursor: default;
    transition: background-color .15s;
}
.quote:hover { background: var(--surface); }
.quote-sym { font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.quote-px { font-family: var(--mono); font-size: 12.5px; color: var(--ink); border-radius: 3px; padding: 0 2px; margin: 0 -2px; }
.quote-chg { font-size: 11.5px; font-weight: 600; color: var(--ink-3); min-width: 40px; }
.quote-spark { width: 34px; height: 14px; flex: none; overflow: visible; }
.quote-spark path { fill: none; stroke: var(--ink-3); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.quote-spark.is-pos path { stroke: var(--pos); }
.quote-spark.is-neg path { stroke: var(--neg); }
.quote.is-closed .quote-px, .quote.is-closed .quote-spark { opacity: .45; }
.quote.is-closed .quote-chg { color: var(--ink-3) !important; font-weight: 500; }
/* símbolo del bot o con posiciones abiertas en la cuenta que se está viendo */
.quote.is-mine { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.quote.is-mine::before {
    content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--focus); margin-right: -2px;
}

.px-up { animation: px-up 1s ease-out; }
.px-down { animation: px-down 1s ease-out; }
@keyframes px-up { 0%, 25% { background: var(--pos-bg); color: var(--pos); } }
@keyframes px-down { 0%, 25% { background: var(--neg-bg); color: var(--neg); } }

.sessions { flex: none; display: flex; align-items: center; gap: 2px; }
.session {
    display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px;
    border-radius: 13px; font-size: 12px; color: var(--ink-3); white-space: nowrap; cursor: default;
}
.session-dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.session-name { font-weight: 600; }
.session-in { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.session.is-open { color: var(--ink-2); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); }
.session.is-open .session-dot { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-bg); }
.session.is-open .session-name { color: var(--ink); }
.sessions-tag {
    margin-left: 6px; font-size: 11px; font-weight: 600; letter-spacing: .02em;
    color: var(--warn); background: var(--warn-bg); padding: 3px 8px; border-radius: 10px; white-space: nowrap;
}

@media (max-width: 1100px) {
    .session-in, .sessions-tag { display: none; }
}
@media (max-width: 720px) {
    .marketbar-inner { padding: 0 8px 0 12px; gap: 10px; }
    .sessions { display: none; }
}

/* --- calendario económico (barra lateral) ------------------------------- */

.news { margin-top: 20px; display: grid; gap: 4px; }
.news-head { align-items: center; gap: 8px; }
.news-head h2 { white-space: nowrap; }
.news-filter { white-space: nowrap;
    border: 1px solid var(--line); background: none; border-radius: 10px; height: 22px; padding: 0 8px;
    font-size: 11px; font-weight: 600; color: var(--ink-3);
}
.news-filter:hover { color: var(--ink); border-color: var(--ink-3); }
.news-filter[aria-pressed="true"] { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 35%, transparent); background: var(--neg-bg); }
.news-list { list-style: none; margin: 0; padding: 0; display: grid; }
.news-day {
    padding: 10px 4px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
}
.news-day:first-child { padding-top: 2px; }
.news-item {
    position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 2px 8px;
    padding: 7px 8px 7px 4px; border-radius: var(--radius-sm); font-size: 12.5px;
}
.news-item.is-past { opacity: .55; }
.news-item.is-next { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.news-item.is-mine::after {
    content: ""; position: absolute; left: -6px; top: 10px; width: 3px; height: 14px; border-radius: 2px; background: var(--focus);
}
.news-time { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); padding-top: 1px; }
.news-body { min-width: 0; display: grid; gap: 2px; }
.news-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.news-cur {
    flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: 1px 5px; border-radius: 4px;
    background: var(--line-2); color: var(--ink-2);
}
.news-imp { flex: none; display: inline-flex; gap: 2px; margin-left: auto; }
.news-imp i { width: 3px; height: 9px; border-radius: 1px; background: var(--line); }
.news-imp[data-imp="2"] i:nth-child(-n+2) { background: var(--warn); }
.news-imp[data-imp="3"] i { background: var(--neg); }
.news-name { color: var(--ink); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-vals { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: 11.5px; color: var(--ink-3); }
.news-vals b { font-weight: 600; color: var(--ink-2); }
.news-in { font-size: 11.5px; font-weight: 600; color: var(--warn); }
.news-empty, .news-foot { margin: 0; padding: 4px; font-size: 12px; color: var(--ink-3); }
.news-foot { padding-top: 8px; font-size: 11.5px; }

@media (max-width: 900px) {
    .news { display: none; }
}

/* aviso de noticia que afecta a la cuenta */
.news-alert {
    margin: 0; display: flex; align-items: flex-start; gap: 8px;
    padding: 10px 14px; border-radius: var(--radius);
    background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 500;
    border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
}
.news-alert svg { flex: none; margin-top: 2px; }
.news-alert strong { font-weight: 700; }
.news-alert.is-now { background: var(--neg-bg); color: var(--neg); border-color: color-mix(in srgb, var(--neg) 22%, transparent); }
.news-alert-inline { margin-top: 6px; padding: 6px 10px; font-size: 12.5px; border-radius: var(--radius-sm); max-width: 620px; }

/* --- posiciones: recorrido entre S/L y T/P ------------------------------ */

.table th.range-col, .table td.range-col { padding-left: 8px; padding-right: 8px; }
.range {
    position: relative; display: block; width: 84px; height: 6px; border-radius: 3px;
    background: linear-gradient(90deg, var(--neg-bg), var(--line-2) 50%, var(--pos-bg));
    box-shadow: inset 0 0 0 1px var(--line-2);
}
.range-open { position: absolute; top: -2px; width: 1px; height: 10px; background: var(--ink-3); }
.range-now {
    position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%;
    background: var(--ink); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--ink-3);
}
.range.is-pos .range-now { background: var(--pos); box-shadow: 0 0 0 1px var(--pos); }
.range.is-neg .range-now { background: var(--neg); box-shadow: 0 0 0 1px var(--neg); }
.range-none { color: var(--ink-3); }

/* celdas que cambian con el precio */
.table td.tick-up { animation: cell-up 1.1s ease-out; }
.table td.tick-down { animation: cell-down 1.1s ease-out; }
@keyframes cell-up { 0%, 20% { background: var(--pos-bg); } }
@keyframes cell-down { 0%, 20% { background: var(--neg-bg); } }

/* ==========================================================================
   Vistas (Cuentas / Gráfico) y pestaña Gráfico
   ========================================================================== */

/* Navegación principal: pestañas con subrayado, separadas del logo por una línea fina */
.viewtabs { display: flex; align-self: stretch; align-items: stretch; gap: 4px; }
.viewtabs::before {
    content: ""; align-self: center; width: 1px; height: 20px; margin-right: 8px;
    background: var(--line);
}
.viewtab {
    position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px;
    border: 0; background: transparent; color: var(--ink-3);
    font-size: 13px; font-weight: 500;
}
.viewtab svg { opacity: .8; }
.viewtab:hover { color: var(--ink); }
.viewtab.is-active { color: var(--ink); }
.viewtab.is-active::after {
    content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
    border-radius: 2px 2px 0 0; background: var(--brand);
}

body.view-chart .shell { max-width: none; grid-template-columns: minmax(0, 1fr); }
body.view-chart .sidebar,
body.view-chart #account-view,
body.view-chart #empty { display: none !important; }
body.view-chart .page { padding: 12px 16px 16px; gap: 12px; }
body.view-chart .topbar-inner, body.view-chart .marketbar-inner { max-width: none; }
.quote { cursor: pointer; }

.trade-view {
    position: relative;
    display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 10px;
    height: calc(100vh - var(--header-h) - 28px); min-height: 620px;
}

/* pestañas de gráficos */
.tv-tabs { display: flex; align-items: center; gap: 6px; min-width: 0; border-bottom: 1px solid var(--line); }
.tv-tabs-list { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tv-tab {
    position: relative; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px 0 14px;
    border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; margin-bottom: -1px;
    color: var(--ink-3); font-size: 13px; cursor: pointer; white-space: nowrap; user-select: none;
}
.tv-tab:hover { color: var(--ink); background: var(--surface-2); }
.tv-tab.is-active { color: var(--ink); background: var(--surface); border-color: var(--line); }
.tv-tab.is-active::before { content: ""; position: absolute; left: 10px; right: 10px; top: -1px; height: 2px; border-radius: 2px; background: var(--focus); }
.tv-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tv-tab-sym { font-weight: 700; letter-spacing: -.01em; }
.tv-tab-tf { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.tv-tab-close {
    display: grid; place-items: center; width: 18px; height: 18px; margin-left: 2px; padding: 0;
    border: 0; border-radius: 4px; background: transparent; color: var(--ink-3); font-size: 15px; line-height: 1;
}
.tv-tab-close:hover { background: var(--line-2); color: var(--ink); }
.tv-tab:not(.is-active):not(:hover) .tv-tab-close { visibility: hidden; }
.tv-tab-add {
    display: grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0;
    border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink-3);
}
.tv-tab-add:hover:not(:disabled) { border-color: var(--line); color: var(--ink); background: var(--surface); }
.tv-tab-add:disabled { opacity: .35; cursor: not-allowed; }
.tv-tabs-note { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tv-watch-btn { display: inline-flex; align-items: center; gap: 6px; }
.tv-watch-btn.is-active { color: var(--ink); border-color: var(--ink-3); background: var(--surface-2); }

/* YieldPip AI: botón destacado (color de marca) en la barra del gráfico */
.tv-watch-btn.tv-ai-btn {
    background: var(--brand); color: var(--on-brand); border-color: var(--brand);
    box-shadow: 0 1px 2px color-mix(in srgb, var(--brand) 25%, transparent);
}
.tv-watch-btn.tv-ai-btn:hover { opacity: .9; color: var(--on-brand); border-color: var(--brand); }
.tv-watch-btn.tv-ai-btn.is-active {
    color: var(--on-brand); background: var(--brand); border-color: var(--brand);
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--brand);
}
.tv-ai-btn .ai-spark { flex: none; }

/* Insiders: burbujas de compras y ventas de insiders en el gráfico (solo acciones de EE. UU.) */
.tv-ins-btn[aria-pressed="true"] { color: var(--ink); border-color: var(--ink-3); background: var(--surface-2); }
/* Insiders, Fundamentals y News con un símbolo que no es una acción */
.tv-watch-btn:disabled { opacity: .45; cursor: not-allowed; }
.tv-ins-dots { display: inline-flex; gap: 2px; }
.tv-ins-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); }
.tv-ins-dots i + i { background: var(--neg); }
.tv-ins-count {
    min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2);
    font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; font-variant-numeric: tabular-nums;
}
.tv-ins-btn[aria-pressed="true"] .tv-ins-count { background: var(--pos-bg); color: var(--pos); }
.tv-ins-count[hidden] { display: none; }
.tv-symbol .co-logo { width: 20px; height: 20px; border-radius: 5px; font-size: 10px; }
.tv-symbol .co-logo img { padding: 1px; }
.tv-tab .co-logo { width: 16px; height: 16px; margin-right: 1px; border-radius: 4px; font-size: 9px; }
.tv-tab .co-logo img { padding: 1px; }
.tv-ai-new {
    margin-left: 2px; padding: 1px 6px; border-radius: 999px;
    background: color-mix(in srgb, var(--on-brand) 22%, transparent); color: var(--on-brand);
    font-size: 10.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; line-height: 1.4;
}
.tv-ai-new[hidden] { display: none; }

/* barra superior del gráfico */
.tv-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0;
}
/* Barra compacta: temporalidad, tipo de gráfico y disposición enseñan solo la opción activa y se despliegan
   al pasar el ratón (o al enfocarlos). Los botones secundarios van solo con icono; el texto vuelve en pantallas anchas. */
.tv-bar { gap: 8px; }
/* YieldPip AI (y «Limpiar dibujos», que va con él) al final de los botones, justo después de Prediction;
   las estadísticas de la cuenta quedan al extremo derecho */
.tv-bar #tv-ai-clear { order: 98; }
.tv-bar .tv-ai-btn { order: 99; }
.tv-bar .tv-acc-stats { order: 100; }
.tv-collapse { position: relative; height: 32px; flex: none; }
.tv-collapse-tf { width: 52px; }
.tv-collapse-type { width: 44px; }
.tv-collapse-layout { width: 44px; }
.tv-collapse .segmented { width: 100%; height: 100%; box-sizing: border-box; align-items: center; justify-content: center; }
.tv-collapse .segmented button:not(.is-active) { display: none; }
.tv-collapse .segmented button.is-active { flex: 1; display: inline-grid; place-items: center; box-shadow: none; background: none; }
.tv-collapse:hover .segmented, .tv-collapse:focus-within .segmented {
    position: absolute; top: 0; left: 0; z-index: 30; width: auto; background: var(--surface);
    box-shadow: 0 8px 24px rgba(14, 16, 18, .14);
}
.tv-collapse:hover .segmented button, .tv-collapse:focus-within .segmented button { display: inline-grid; place-items: center; }
.tv-collapse:hover .segmented button.is-active, .tv-collapse:focus-within .segmented button.is-active {
    flex: none; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line);
}
.tv-bar .tv-watch-btn:not(.tv-ai-btn) { padding-left: 9px; padding-right: 9px; }
.tv-bar .tv-watch-btn:not(.tv-ai-btn) .tv-lbl { display: none; }
@media (min-width: 1900px) {
    .tv-bar .tv-watch-btn:not(.tv-ai-btn) .tv-lbl { display: inline; }
}
@media (max-width: 1500px) {
    .tv-bar .tv-acc-stats div:nth-child(3) { display: none; }
}
.tv-account select {
    height: 32px; max-width: 220px; padding: 0 28px 0 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600;
}
.tv-account select:disabled { opacity: 1; cursor: default; }
.tv-symbol {
    display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; min-width: 0; max-width: 340px;
    border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-3);
}
.tv-symbol:hover { border-color: var(--ink-3); color: var(--ink); }
.tv-symbol-name { color: var(--ink); font-weight: 700; font-size: 14px; letter-spacing: -.01em; white-space: nowrap; }
.tv-symbol-desc { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-tf button { min-width: 30px; padding: 0 8px; }
.tv-type button { display: inline-grid; place-items: center; padding: 0 8px; }
.tv-ind { position: relative; }
.tv-menu {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 180px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(14, 16, 18, .14); display: grid;
}
.tv-menu label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 5px; font-size: 13px; cursor: pointer; }
.tv-menu label:hover { background: var(--surface-2); }
.tv-menu i { width: 12px; height: 3px; border-radius: 2px; background: var(--c); }
.tv-acc-stats { margin: 0 0 0 auto; display: flex; gap: 18px; }
.tv-acc-stats div { display: grid; gap: 0; text-align: right; }
.tv-acc-stats dt { font-size: 11.5px; color: var(--ink-3); }
.tv-acc-stats dd { margin: 0; font-weight: 600; font-size: 13.5px; white-space: nowrap; }

/* gráfico + ticket */
.tv-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; min-height: 0; }
.tv-main.has-watch { grid-template-columns: minmax(0, 1fr) 300px 272px; }

/* lista de seguimiento */
.watch {
    display: flex; flex-direction: column; min-height: 0; overflow: hidden;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.watch[hidden] { display: none; }
.watch-head { display: flex; align-items: center; gap: 4px; padding: 10px 8px 6px 14px; }
.watch-head h3 { margin: 0 auto 0 0; font-size: 13px; font-weight: 700; }
.watch-icon {
    display: grid; place-items: center; width: 26px; height: 26px; padding: 0;
    border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink-3);
}
.watch-icon:hover { border-color: var(--line); color: var(--ink); }
.watch-filter {
    margin: 0 10px 6px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink); font: inherit; font-size: 12.5px; outline: none;
}
.watch-filter:focus { border-color: var(--ink-3); }
.watch-cols, .watch-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }
.watch-cols { padding: 4px 12px; border-bottom: 1px solid var(--line-2); font-size: 11px; font-weight: 600; color: var(--ink-3); }
.watch-cols span:not(:first-child) { text-align: right; }
.watch-list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow-y: auto; outline: none; }
.watch-list:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--focus) 40%, transparent); }
.watch-row {
    position: relative; height: 32px; padding: 0 12px; cursor: pointer; font-size: 12.5px;
    border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums;
}
.watch-row:hover { background: var(--surface-2); }
.watch-row.is-current { background: color-mix(in srgb, var(--focus) 9%, var(--surface)); box-shadow: inset 3px 0 0 var(--focus); }
.watch-row.is-missing { opacity: .55; }
.watch-sym { display: flex; align-items: center; gap: 5px; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--focus); }
.watch-row .num { text-align: right; white-space: nowrap; overflow: hidden; border-radius: 3px; }
.watch-row .watch-last { font-weight: 600; color: var(--ink); }
.watch-row .muted { color: var(--ink-3); }
.watch-del {
    position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: none; place-items: center;
    width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px;
    background: var(--surface); color: var(--ink-3); font-size: 15px; line-height: 1; box-shadow: 0 0 0 1px var(--line);
}
.watch-row:hover .watch-del { display: grid; }
.watch-del:hover { color: var(--neg); }
.watch-empty { padding: 18px 14px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.watch-foot { margin: 0; padding: 7px 12px; border-top: 1px solid var(--line-2); font-size: 11px; color: var(--ink-3); }
.watch-foot.is-neg { color: var(--neg); }

/* YieldPip AI (comparte la tercera columna con la lista de seguimiento) */
.tv-main.has-ai { grid-template-columns: minmax(0, 1fr) 300px 320px; }
.ai {
    display: flex; flex-direction: column; min-height: 0; overflow: hidden;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.ai[hidden] { display: none; }
.ai { position: relative; border-top: 2px solid var(--brand); }
.ai-title { display: inline-flex; align-items: center; gap: 7px; }
.ai-badge {
    display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px;
    background: var(--brand); color: var(--on-brand);
}
.ai .watch-icon:disabled { opacity: .35; cursor: default; border-color: transparent; color: var(--ink-3); }
.ai-msgs {
    flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
    padding: 12px 12px 14px; border-top: 1px solid var(--line-2);
}
.ai-msg { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-user {
    align-self: flex-end; max-width: 88%; padding: 7px 11px; border-radius: 10px 10px 3px 10px;
    background: var(--surface-2); border: 1px solid var(--line);
}
.ai-bot p { margin: 0 0 6px; }
.ai-bot p:last-child { margin-bottom: 0; }
.ai-bot ul, .ai-bot ol { margin: 0 0 6px; padding-left: 18px; }
.ai-bot li { margin: 3px 0; }
.ai-bot li::marker { color: var(--ink-3); }
.ai-bot strong { font-weight: 650; }
.ai-bot code { font-family: var(--mono); font-size: .92em; }
.ai-bot.is-error { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--neg-bg); color: var(--neg); }
.ai-bot .ai-note {
    display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 7px;
    border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--ink-3);
}
.ai-wait { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12.5px; }
.ai-wait .spinner { display: inline-block; width: 12px; height: 12px; }
.ai-empty { margin: auto 0; color: var(--ink-2); font-size: 12.5px; }
.ai-empty p { margin: 0 0 12px; }
.ai-hero { display: grid; justify-items: start; gap: 2px; margin-bottom: 12px; }
.ai-hero-badge {
    display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 8px; border-radius: 10px;
    background: var(--brand); color: var(--on-brand);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 22%, transparent);
}
.ai-empty .ai-hero p { margin: 0; }
.ai-empty .ai-empty-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.ai-empty .ai-empty-sub { font-size: 12.5px; color: var(--ink-3); }
.ai-caps { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 14px; padding: 0; list-style: none; }
.ai-caps li {
    padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--ink-2);
    background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
}
.ai-empty .ai-suggest-label { margin-bottom: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.ai-suggest { display: grid; gap: 6px; }
.ai-suggest button {
    padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink-2); font-size: 12.5px; text-align: left;
    transition: border-color .15s, color .15s, background-color .15s;
}
.ai-suggest button:hover { border-color: var(--ink-3); color: var(--ink); background: var(--surface-2); }
.ai-form {
    display: flex; align-items: flex-end; gap: 6px; margin: 0 10px; padding: 5px 5px 5px 10px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
.ai-form:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 15%, transparent); }
.ai-form textarea {
    flex: 1; min-width: 0; min-height: 24px; max-height: 140px; padding: 4px 0; resize: none;
    border: 0; outline: none; background: transparent; color: var(--ink); font: inherit; font-size: 13px; line-height: 1.45;
}
.ai-form textarea:focus-visible { outline: none; }
.ai-send {
    flex: none; display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
    border: 0; border-radius: 6px; background: var(--ink); color: var(--bg); transition: opacity .15s;
}
.ai-send:hover { opacity: .85; }
.ai-send:disabled { opacity: .3; cursor: default; }
.ai-foot { display: flex; justify-content: space-between; gap: 8px; margin: 0; padding: 7px 12px 9px; font-size: 11px; color: var(--ink-3); }
.ai-foot span:last-child { white-space: nowrap; }
.tv-chart-wrap {
    position: relative; min-height: 0; overflow: hidden;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.pc { position: absolute; inset: 0; user-select: none; -webkit-user-select: none; }
.pc-canvas { display: block; touch-action: none; }
.pc-canvas.is-grabbing { cursor: grabbing !important; }
.pc-legend {
    position: absolute; top: 8px; left: 10px; right: 90px; pointer-events: none;
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-size: 12px; color: var(--ink-3);
}
.pc-legend-title { color: var(--ink); font-weight: 700; font-size: 13px; }
.pc-legend-title small { font-weight: 500; color: var(--ink-3); font-size: 12px; margin-left: 4px; }
.pc-legend-ohlc { display: inline-flex; gap: 10px; font-variant-numeric: tabular-nums; }
.pc-legend-ohlc b { font-weight: 600; color: var(--c); }
.pc-legend-ind { display: inline-flex; gap: 10px; font-weight: 600; }
.pc-live, .pc-auto {
    position: absolute; display: grid; place-items: center; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink-2); border-radius: 6px; box-shadow: 0 2px 6px rgba(14, 16, 18, .08);
}
.pc-live { width: 30px; height: 26px; }
.pc-live:hover, .pc-auto:hover { color: var(--ink); border-color: var(--ink-3); }
.pc-auto { width: 22px; height: 20px; font-size: 11px; font-weight: 700; color: var(--ink-3); box-shadow: none; }
.pc-auto.is-on { color: var(--focus); border-color: color-mix(in srgb, var(--focus) 40%, var(--line)); }
.pc-cmp { display: inline-flex; align-items: center; gap: 4px; }
.pc-cmp button {
    pointer-events: auto; display: inline-grid; place-items: center; width: 16px; height: 16px; padding: 0;
    border: 0; border-radius: 4px; background: transparent; color: var(--ink-3); font-size: 14px; line-height: 1; cursor: pointer;
}
.pc-cmp button:hover { background: var(--surface-2); color: var(--ink); }

/* Herramientas del gráfico (assets/js/charttools.js): barra de dibujo, estilo del dibujo y varias gráficas */
.tv-chart-wrap.has-dt > #tv-chart { left: 40px; }
.dt-bar {
    position: absolute; top: 0; bottom: 0; left: 0; z-index: 2; width: 40px; padding: 6px 4px;
    display: flex; flex-direction: column; align-items: center; gap: 2px; overflow-y: auto; scrollbar-width: none;
    background: var(--surface); border-right: 1px solid var(--line);
}
.dt-btn {
    flex: none; width: 32px; height: 30px; display: grid; place-items: center; padding: 0;
    border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); cursor: pointer;
}
.dt-btn:hover { background: var(--surface-2); color: var(--ink); }
.dt-btn.is-on { background: color-mix(in srgb, var(--focus) 14%, transparent); color: var(--focus); }
.dt-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.dt-sep { flex: none; width: 22px; height: 1px; margin: 4px 0; background: var(--line); }
.dt-style {
    position: absolute; left: 50%; bottom: 40px; z-index: 5; transform: translateX(-50%);
    display: flex; align-items: center; gap: 10px; padding: 5px 8px; max-width: calc(100% - 24px); flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(14, 16, 18, .14);
}
.dt-style[hidden] { display: none; }
.dt-group { display: flex; align-items: center; gap: 3px; }
.dt-sw {
    width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 2px solid var(--surface);
    background: var(--c); box-shadow: 0 0 0 1px var(--line); cursor: pointer;
}
.dt-sw.is-on { box-shadow: 0 0 0 2px var(--ink); }
.dt-w {
    width: 28px; height: 24px; padding: 0 6px; display: grid; place-items: center; border: 0; border-radius: 5px;
    background: transparent; color: var(--ink-2); cursor: pointer;
}
.dt-w i { display: block; width: 16px; min-height: 1px; border-radius: 2px; background: currentColor; }
.dt-w i.is-dash { height: 2px; background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }
.dt-w:hover { background: var(--surface-2); color: var(--ink); }
.dt-w.is-on { background: color-mix(in srgb, var(--focus) 14%, transparent); color: var(--focus); }
.dt-text, .dt-size {
    height: 26px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px;
}
.dt-text { width: 180px; padding: 0 8px; }
.dt-size { padding: 0 4px; }
.dt-del {
    width: 28px; height: 26px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px;
    background: transparent; color: var(--neg); cursor: pointer;
}
.dt-del:hover { background: var(--neg-bg); }

/* menús de indicadores (periodos y plantillas) y de alertas */
.tv-ind-menu { min-width: 310px; max-height: min(72vh, 620px); overflow-y: auto; }
.tv-menu-h {
    margin: 8px 8px 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
}
.tv-menu-h:first-child { margin-top: 2px; }
.tv-menu-row { display: flex; align-items: center; gap: 6px; padding-right: 6px; border-radius: 5px; }
.tv-menu-row:hover { background: var(--surface-2); }
.tv-menu-row label { flex: 1; min-width: 0; }
.tv-menu-row label:hover { background: transparent; }
.tv-params { display: inline-flex; gap: 4px; }
.tv-params input {
    width: 46px; height: 24px; padding: 0 4px; text-align: center; border: 1px solid var(--line); border-radius: 4px;
    background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums;
}
.tv-tpl-list { display: grid; gap: 2px; }
.tv-tpl-row, .tv-alert-row { display: flex; align-items: center; gap: 6px; padding: 2px 4px 2px 0; border-radius: 5px; }
.tv-tpl-row:hover, .tv-alert-row:hover { background: var(--surface-2); }
.tv-tpl-apply, .tv-alert-sym {
    flex: 1; min-width: 0; text-align: left; padding: 6px 8px; border: 0; background: transparent; color: var(--ink);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tv-alert-sym { flex: none; }
.tv-alert-row .mono { font-size: 12.5px; }
.tv-alert-state { margin-left: auto; font-size: 11.5px; color: var(--pos); white-space: nowrap; }
.tv-alert-row.is-fired .tv-alert-state { color: var(--ink-3); }
.tv-alert-rm {
    flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: transparent;
    color: var(--ink-3); font-size: 16px; line-height: 1; cursor: pointer;
}
.tv-alert-rm:hover { color: var(--neg); background: var(--neg-bg); }
.tv-tpl-form { display: flex; gap: 6px; padding: 4px 8px; }
.tv-tpl-form input {
    flex: 1; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px;
    background: var(--surface); color: var(--ink); font: inherit; font-size: 13px;
}
.tv-menu-reset {
    margin: 4px 0 0; padding: 7px 8px; border: 0; border-top: 1px solid var(--line-2); border-radius: 0; background: transparent;
    color: var(--focus); font: inherit; font-size: 12.5px; font-weight: 600; text-align: left; cursor: pointer;
}
.tv-menu-reset:hover { background: var(--surface-2); }
.tv-menu-note { margin: 4px 8px; font-size: 11.5px; line-height: 1.4; color: var(--ink-3); }
.tv-alert-menu { min-width: 340px; max-height: min(70vh, 520px); overflow-y: auto; }
#tv-alert-count[hidden] { display: none; }
.tv-layout button { display: inline-grid; place-items: center; padding: 0 8px; }

/* varias gráficas: la principal arriba a la izquierda y las otras pestañas en pequeño */
.tv-chart-wrap.is-split-2 > #tv-chart, .tv-chart-wrap.is-split-2 > .tv-overlay { right: 50%; }
.tv-chart-wrap.is-split-4 > #tv-chart, .tv-chart-wrap.is-split-4 > .tv-overlay { right: 50%; bottom: 50%; }
.tv-mini { position: absolute; background: var(--surface); border-left: 1px solid var(--line); }
.is-split-2 > .tv-mini[data-slot="0"] { top: 0; bottom: 0; left: 50%; right: 0; }
.is-split-4 > .tv-mini[data-slot="0"] { top: 0; bottom: 50%; left: 50%; right: 0; }
.is-split-4 > .tv-mini[data-slot="1"] { top: 50%; bottom: 0; left: 40px; right: 50%; border-top: 1px solid var(--line); border-left: 0; }
.is-split-4 > .tv-mini[data-slot="2"] { top: 50%; bottom: 0; left: 50%; right: 0; border-top: 1px solid var(--line); }
.tv-mini-head {
    position: absolute; top: 0; left: 0; right: 0; height: 30px; padding: 0 8px; display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid var(--line-2);
}
.tv-mini-head[hidden] { display: none; }
.tv-mini-sym {
    padding: 3px 7px; border: 0; border-radius: 5px; background: transparent; color: var(--ink);
    font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.tv-mini-sym:hover { background: var(--surface-2); color: var(--focus); }
.tv-mini-px { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.pc.tv-mini-chart { top: 30px; }
.tv-mini .pc-legend { right: 50px; }
.tv-mini-add {
    position: absolute; inset: 0; margin: auto; width: max-content; height: 34px; padding: 0 14px;
    border: 1px dashed var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink-2);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.tv-mini-add:hover { color: var(--ink); border-color: var(--ink-3); }
.tv-mini-add[hidden] { display: none; }
@media (max-width: 900px) {
    .tv-mini, .tv-layout { display: none; }
    .tv-chart-wrap.is-split-2 > #tv-chart, .tv-chart-wrap.is-split-4 > #tv-chart,
    .tv-chart-wrap.is-split-2 > .tv-overlay, .tv-chart-wrap.is-split-4 > .tv-overlay { right: 0; bottom: 0; }
}

.tv-overlay {
    position: absolute; inset: 0; display: grid; place-items: center; padding: 24px;
    background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(2px);
}
.tv-overlay-box { display: grid; justify-items: center; gap: 12px; max-width: 420px; text-align: center; }
.tv-overlay-box p { margin: 0; color: var(--ink-2); font-size: 13.5px; }

/* ticket de órdenes */
.ticket {
    display: flex; flex-direction: column; gap: 14px; padding: 14px; overflow-y: auto; min-height: 0;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.ticket-sides { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ticket-side {
    display: grid; gap: 2px; padding: 9px 10px; border-radius: 8px; text-align: left;
    border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
    transition: background-color .15s, border-color .15s, color .15s;
}
.ticket-buy { text-align: right; }
.ticket-side-label { font-size: 12px; font-weight: 600; }
.ticket-side-px { font-size: 17px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; border-radius: 3px; }
.ticket-sell:hover { border-color: var(--neg); }
.ticket-buy:hover { border-color: var(--pos); }
.ticket-sell.is-active { background: var(--neg); border-color: var(--neg); color: #fff; }
.ticket-buy.is-active { background: var(--pos); border-color: var(--pos); color: #fff; }
.ticket-side.is-active .ticket-side-px.px-up, .ticket-side.is-active .ticket-side-px.px-down { animation: none; }
.ticket-spread {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    min-width: 30px; padding: 1px 6px; border-radius: 9px; text-align: center;
    background: var(--surface); border: 1px solid var(--line); font-size: 11px; font-weight: 600; color: var(--ink-3);
}
.ticket-kind { display: grid; grid-template-columns: 1fr 1fr; }
.ticket-kind button { height: 28px; }
.tk-field { display: grid; gap: 6px; }
.tk-field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-height: 18px; }
.tk-field-head label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tk-unit { font-weight: 400; color: var(--ink-3); }
.tk-hint { font-size: 11.5px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.tk-check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.tk-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--ink); }
.tk-input {
    display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; height: 36px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden;
}
.tk-input:focus-within { border-color: var(--ink-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 14%, transparent); }
.tk-input input {
    min-width: 0; border: 0; background: transparent; text-align: center; outline: none;
    font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.tk-step { border: 0; background: var(--surface-2); color: var(--ink-2); font-size: 16px; line-height: 1; }
.tk-step:hover { color: var(--ink); background: var(--line-2); }
.tk-sub { margin: 0; font-size: 11.5px; color: var(--ink-3); }
.tk-error, .tk-warn { margin: 0; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.4; }
.tk-error { background: var(--neg-bg); color: var(--neg); }
.tk-warn { background: var(--warn-bg); color: var(--warn); }
.ticket-submit {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: auto;
    min-height: 44px; padding: 8px 12px; border: 0; border-radius: 8px; color: #fff;
    font-weight: 700; font-size: 14px; line-height: 1.25; text-align: center;
}
.ticket-submit[data-side="buy"] { background: var(--pos); }
.ticket-submit[data-side="sell"] { background: var(--neg); }
.ticket-submit:hover:not(:disabled) { filter: brightness(1.07); }
.ticket-submit:disabled { opacity: .5; cursor: not-allowed; }
.ticket-submit.is-busy { opacity: .8; cursor: progress; }
.ticket-submit.is-busy .spinner { display: inline-block; }
.tk-foot { margin: -6px 0 0; font-size: 11.5px; color: var(--ink-3); text-align: center; }

/* posiciones y órdenes bajo el gráfico */
.tv-book { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tv-book-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tv-book-head .tab { height: 40px; }
.tv-book-note { font-size: 12px; color: var(--ink-3); }
.tv-book-body { max-height: 190px; overflow: auto; }
.tv-book-body .table-empty { padding: 18px; }
.table-compact th { padding: 7px 14px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.table-compact td { padding: 6px 14px; font-size: 13px; }
.tv-row { cursor: pointer; }
.tv-row.is-current td:first-child { box-shadow: inset 3px 0 0 var(--focus); }
.btn-xs { height: 26px; padding: 0 10px; font-size: 12px; }

/* buscador de símbolos */
.sym-modal { width: min(620px, calc(100vw - 32px)); }
.sym-search {
    height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); font-size: 15px; outline: none;
}
.sym-search:focus { border-color: var(--ink-3); }
.sym-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: -4px; }
.sym-cat {
    height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 600;
}
.sym-cat small { color: var(--ink-3); font-weight: 500; }
.sym-cat:hover { border-color: var(--ink-3); }
.sym-cat.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.sym-cat.is-active small { color: inherit; opacity: .7; }
.sym-list { list-style: none; margin: 0; padding: 0; height: min(52vh, 440px); overflow-y: auto; border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.sym-item {
    display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; column-gap: 12px; padding: 8px 8px 8px 12px; cursor: pointer;
    border-bottom: 1px solid var(--line-2);
}
.sym-acts { grid-column: 3; grid-row: 1 / span 2; align-self: center; display: flex; gap: 2px; }
.sym-act {
    display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 6px;
    background: transparent; color: var(--ink-3); font-size: 15px; line-height: 1; opacity: 0;
}
.sym-item:hover .sym-act, .sym-item.is-active .sym-act, .sym-act.is-on { opacity: 1; }
.sym-act:hover:not(:disabled) { border-color: var(--line); color: var(--ink); background: var(--surface); }
.sym-act.is-on { color: #d18a1c; }
.sym-act:disabled { opacity: .3 !important; cursor: not-allowed; }
.sym-legend { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.sym-item:hover, .sym-item.is-active { background: var(--surface-2); }
.sym-item.is-current .sym-item-name::after { content: " ●"; color: var(--focus); font-size: 10px; }
.sym-item-name { font-weight: 700; font-size: 13.5px; grid-row: span 2; align-self: center; }
.sym-item-desc { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sym-item-cat { font-size: 11.5px; color: var(--ink-3); }
.sym-item-cat b { color: var(--focus); font-weight: 600; }
.sym-empty { padding: 16px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* avisos */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 8px; width: min(380px, calc(100vw - 40px)); pointer-events: none; }
.toast {
    padding: 11px 14px; border-radius: 8px; font-size: 13px; line-height: 1.4; pointer-events: auto;
    background: var(--ink); color: var(--bg); box-shadow: 0 8px 24px rgba(14, 16, 18, .2);
    opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
    border-left: 4px solid var(--pos);
}
.toast-error { border-left-color: var(--neg); }
.toast.is-in { opacity: 1; transform: none; }

@media (max-width: 1400px) {
    .tv-main.has-watch { grid-template-columns: minmax(0, 1fr) 280px 250px; }
    .tv-main.has-ai { grid-template-columns: minmax(0, 1fr) 280px 300px; }
}
@media (max-width: 1100px) {
    .tv-acc-stats { display: none; }
    .tv-symbol-desc { display: none; }
    .tv-main.has-watch { grid-template-columns: minmax(0, 1fr) 280px; }
    .tv-main.has-watch .watch { grid-column: 1 / -1; max-height: 320px; }
    .tv-main.has-ai { grid-template-columns: minmax(0, 1fr) 280px; }
    .tv-main.has-ai .ai { grid-column: 1 / -1; height: 440px; }
}
@media (max-width: 900px) {
    .trade-view { height: auto; grid-template-rows: auto auto auto auto; }
    .tv-main, .tv-main.has-watch, .tv-main.has-ai { grid-template-columns: 1fr; }
    .tv-chart-wrap { height: 62vh; min-height: 380px; }
    .ticket { overflow: visible; }
    .viewtab { padding: 0 10px; }
    .viewtab svg { display: none; }
}

/* --- ajustes e idioma ------------------------------------------------------ */

/* Rueda de ajustes (junto a «Salir»): botón cuadrado del alto de btn-sm. */
.btn-icon { width: 32px; padding: 0; }
.btn-icon svg { transition: transform .3s; }
.btn-icon:hover svg { transform: rotate(45deg); }
.topbar-right .btn-icon + .btn { margin-left: -8px; }

/* Selector de idioma (globo) de las pantallas de acceso y registro. */
.auth-main > .brand .lang-menu { margin-left: auto; }
.lang-menu { position: relative; }
.lang-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: transparent;
    color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer;
    transition: border-color .15s, color .15s;
}
.lang-btn:hover, .lang-btn[aria-expanded="true"] { border-color: var(--ink-3); color: var(--ink); }
.lang-caret { transition: transform .15s; }
.lang-btn[aria-expanded="true"] .lang-caret { transform: rotate(180deg); }
.lang-list {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 150px;
    margin: 0; padding: 6px; list-style: none;
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(14, 16, 18, .14);
}
.lang-list[hidden] { display: none; }
.lang-list button {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
    padding: 8px 10px; border: 0; border-radius: 5px; background: transparent;
    color: var(--ink); font-size: 13.5px; text-align: left; cursor: pointer;
}
.lang-list button:hover, .lang-list button:focus-visible { background: var(--surface-2); outline: none; }
.lang-list button[aria-checked="true"]::after {
    content: ""; width: 8px; height: 4px; margin-top: -3px;
    border: solid currentColor; border-width: 0 0 1.6px 1.6px; transform: rotate(-45deg);
}

/* --- admin: EAs de usuarios y worker sandbox --- */
.sandbox-state { padding: 0 20px 14px; font-size: 13px; display: grid; gap: 6px; }
.sandbox-state p { margin: 0; }
.sandbox-head { font-size: 14px; font-weight: 600; }
.sandbox-text { color: var(--ink-2); line-height: 1.5; max-width: 820px; }
.sandbox-pens { margin: 2px 0 0; padding-left: 18px; color: var(--warn, #d9a24a); font-size: 12.5px; display: grid; gap: 3px; }
.sandbox-details { color: var(--ink-3); font-size: 12.5px; }
.sandbox-details summary { cursor: pointer; width: max-content; }
.sandbox-details summary:hover { color: var(--ink-2); }
.sandbox-details p { margin: 6px 0 0; }
.sandbox-problems { margin: 6px 0 0; padding-left: 18px; color: var(--ink-3); font-size: 12px; display: grid; gap: 3px; }
.tag.is-neg { background: var(--neg-bg); border-color: transparent; }

/* --- admin: historial de velas --- */
.history-state { padding: 0 20px 12px; font-size: 13px; display: grid; gap: 6px; }
.history-state p { margin: 0; }
.history-form {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
    padding: 0 20px 16px; border-bottom: 1px solid var(--line-2);
}
.history-form .field { min-width: 180px; }
.history-form .field:first-child { min-width: 260px; }
.history-form .field input, .history-form .field select { height: 36px; font-size: 13px; }
.history-form .btn { height: 36px; }
.history-hint { flex-basis: 100%; margin: 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.history-hint:empty { display: none; }
.history-hint.is-neg { color: var(--neg); }
.tag.is-pos { background: var(--pos-bg); color: var(--pos); }
.tag.is-off { background: var(--surface-2); color: var(--ink-3); }

/* --- Pattern (comparte la tercera columna con la lista de seguimiento y YieldPip AI) --- */
.tv-main.has-pattern { grid-template-columns: minmax(0, 1fr) 300px 330px; }
.pattern {
    display: flex; flex-direction: column; min-height: 0; overflow: hidden;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.pattern[hidden] { display: none; }
.pattern-body { flex: 1; min-height: 0; overflow-y: auto; border-top: 1px solid var(--line-2); padding: 10px 12px 12px; display: grid; align-content: start; gap: 10px; }
.pt-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pt-horizon button { padding: 0 10px; }
.pt-show { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.pt-msg { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.pt-msg p { margin: 0 0 8px; }
.pt-wait { display: flex; align-items: flex-start; gap: 8px; }
.pt-wait .spinner { flex: none; display: inline-block; width: 12px; height: 12px; margin-top: 3px; }
.pt-tf { display: flex; gap: 6px; }
.pt-summary { display: grid; gap: 8px; }
.pt-title { margin: 0; font-size: 13px; font-weight: 700; }
.pt-prob { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-2); }
.pt-prob-up { background: var(--pos); }
.pt-prob-down { background: var(--neg); }
.pt-prob-labels { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 650; margin-top: -2px; }
.pt-facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.pt-facts div { display: grid; gap: 1px; }
.pt-facts dt { font-size: 11px; color: var(--ink-3); }
.pt-facts dd { margin: 0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pt-stars { color: var(--warn); letter-spacing: 1px; }
.pt-stars span { color: var(--line); }
.pt-best { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.pt-table { font-size: 12px; }
.pt-table th, .pt-table td { padding: 5px 4px; }
.pt-table td { vertical-align: middle; }
.pt-when { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-spark { display: block; }
.pt-spark polyline { fill: none; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.pt-spark-past { stroke: var(--ink-3); }
.pt-spark-up { stroke: var(--pos); }
.pt-spark-down { stroke: var(--neg); }
.pt-spark-cut { stroke: var(--line); stroke-dasharray: 2 2; }
.pt-foot { margin: 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
@media (max-width: 1400px) {
    .tv-main.has-pattern { grid-template-columns: minmax(0, 1fr) 280px 300px; }
}
@media (max-width: 1100px) {
    .tv-main.has-pattern { grid-template-columns: minmax(0, 1fr) 280px; }
    .tv-main.has-pattern .pattern { grid-column: 1 / -1; height: 460px; }
}
@media (max-width: 900px) {
    .tv-main.has-pattern { grid-template-columns: 1fr; }
}
.pt-updating { display: inline-flex; align-items: center; gap: 5px; margin-left: 4px; }
.pt-updating .spinner { display: inline-block; width: 10px; height: 10px; }
.history-years { padding-top: 14px; }
/* admin: email (SMTP) */
.mail-form .field, .mail-form .field:first-child { min-width: 200px; flex: 1 1 200px; }
.mail-form .mail-port { min-width: 90px; max-width: 110px; flex: 0 0 100px; }
.mail-form .mail-secure { min-width: 150px; flex: 0 1 170px; }
#mail-test-form .field { min-width: 260px; max-width: 360px; flex: 1; }
.mail-state-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.mail-state-line .mono { color: var(--ink-2); }
/* admin: límite de bots por usuario (tarjeta Usuarios); en ámbar quien está en el límite */
.limits-form { padding-top: 4px; }
#users .is-full { color: var(--warn); font-weight: 600; }
.history-years .field, .history-years .field:first-child { min-width: 120px; max-width: 150px; }
.history-bars { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; font-variant-numeric: tabular-nums; }
.history-bars:empty { display: none; }
.history-bars strong { color: var(--ink); font-weight: 650; }
.history-add { padding-top: 14px; }
.history-search { position: relative; flex: 1; min-width: 260px; max-width: 460px; }
.history-suggest {
    position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px 0; list-style: none;
    max-height: 300px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}
.history-suggest[hidden] { display: none; }
.history-suggest li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 6px 10px; cursor: pointer; font-size: 12.5px; }
.history-suggest li:hover, .history-suggest li.is-active { background: var(--surface-2); }
.history-suggest .hs-name { font-weight: 700; font-family: var(--mono); }
.history-suggest .hs-desc { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-suggest .hs-path { grid-column: 1 / -1; color: var(--ink-3); font-size: 11.5px; }
.history-suggest .hs-in { color: var(--ink-3); font-style: italic; }
.history-excluded { margin: 0; padding: 10px 20px 14px; font-size: 12.5px; color: var(--ink-3); }
.history-excluded .link-btn { margin-left: 4px; }

/* --- diario de trading (assets/js/journal.js) ---------------------------- */

.journal { position: relative; }
.jr-nav { display: flex; align-items: center; gap: 6px; }
.jr-nav .btn-icon:hover svg { transform: none; }
.jr-nav .btn:disabled { opacity: .4; cursor: default; border-color: var(--line); color: var(--ink-3); }
.jr-month { min-width: 132px; text-align: center; font-weight: 600; font-size: 13.5px; }

.jr-kpis {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 16px 0 0;
    border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
}
.jr-kpi { display: flex; flex-direction: column; gap: 3px; padding: 14px 20px; min-width: 0; border-left: 1px solid var(--line-2); }
.jr-kpi:first-child { border-left: 0; }
.jr-kpi dt { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.jr-kpi dd { margin: 0; font: 600 18px/1.2 var(--font-display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-kpi-foot { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-sep { color: var(--ink-3); margin: 0 4px; font-weight: 400; }

.jr-cal {
    display: grid; gap: 6px; padding: 16px 20px 20px;
    grid-template-columns: repeat(var(--cols, 7), minmax(0, 1fr)) minmax(0, 1.05fr);
}
.jr-wd { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 0 2px 2px; }
.jr-wd-week { text-align: right; }
.jr-day, .jr-week {
    position: relative; min-height: 76px; padding: 7px 9px; border-radius: 8px; min-width: 0;
    display: flex; flex-direction: column; justify-content: space-between;
    border: 1px solid var(--line-2); background: var(--surface-2);
}
.jr-day.is-out { background: none; border-color: transparent; }
.jr-day.is-none { background: none; }
.jr-day.is-future { opacity: .45; }
.jr-day.is-green {
    border-color: color-mix(in srgb, var(--pos) calc(var(--a) * 40%), var(--line-2));
    background: color-mix(in srgb, var(--pos) calc(var(--a) * 22%), var(--surface));
}
.jr-day.is-red {
    border-color: color-mix(in srgb, var(--neg) calc(var(--a) * 40%), var(--line-2));
    background: color-mix(in srgb, var(--neg) calc(var(--a) * 20%), var(--surface));
}
.jr-day.is-today { box-shadow: inset 0 0 0 1.5px var(--ink-2); }
.jr-day[tabindex], .jr-week[tabindex] { cursor: default; transition: transform .12s, box-shadow .12s; }
.jr-day[tabindex]:hover, .jr-week[tabindex]:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.jr-day.is-today[tabindex]:hover { box-shadow: inset 0 0 0 1.5px var(--ink-2), 0 4px 12px rgba(0, 0, 0, .08); }
.jr-day:focus-visible, .jr-week:focus-visible, .jr-bar:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.jr-dnum { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.jr-day.is-green .jr-dnum, .jr-day.is-red .jr-dnum { color: var(--ink-2); }
.jr-pnl { font-weight: 700; font-size: 14px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-day.is-green .jr-pnl, .jr-week.jr-up .jr-pnl { color: var(--pos); }
.jr-day.is-red .jr-pnl, .jr-week.jr-down .jr-pnl { color: var(--neg); }
.jr-n { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-week { align-items: flex-end; text-align: right; background: var(--bg); border-style: dashed; }
.jr-week.is-empty { opacity: .6; }
.jr-week-no { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }

.jr-analytics {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.35fr) minmax(0, .85fr);
    border-top: 1px solid var(--line);
}
.jr-block { padding: 18px 20px 20px; min-width: 0; border-left: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 14px; }
.jr-block:first-child { border-left: 0; }
.jr-block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.jr-h { margin: 0; font-size: 13px; font-weight: 600; }
.jr-tz { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.jr-tz[title]:not([title=""]) { text-decoration: underline dotted; cursor: help; }

.jr-insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.jr-ins {
    position: relative; padding: 9px 12px 9px 30px; border-radius: 8px; font-size: 13px; line-height: 1.45;
    background: var(--surface-2); color: var(--ink-2);
}
.jr-ins::before {
    content: ""; position: absolute; left: 12px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3);
}
.jr-ins-pos { background: var(--pos-bg); }
.jr-ins-pos::before { background: var(--pos); }
.jr-ins-neg { background: var(--neg-bg); }
.jr-ins-neg::before { background: var(--neg); }
.jr-ins strong { color: var(--ink); font-weight: 600; }

.jr-bars {
    position: relative; flex: 1; min-height: 140px; display: grid; gap: 3px; padding-bottom: 18px;
    grid-template-columns: repeat(var(--cols, 24), minmax(0, 1fr));
}
.jr-bars::after {   /* línea del cero */
    content: ""; position: absolute; left: 0; right: 0; bottom: calc(18px + (100% - 18px) * var(--z-n, 0));
    height: 1px; background: var(--line);
}
.jr-bar { position: relative; min-width: 0; border-radius: 3px; }
.jr-bar[tabindex="0"]:hover { background: var(--surface-2); }
.jr-bar-fill { position: absolute; left: 12%; right: 12%; border-radius: 2px; transition: height .3s ease; }
.jr-bar-fill.up { background: var(--pos); }
.jr-bar-fill.down { background: var(--neg); }
.jr-bar-label {
    position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%);
    font-size: 10.5px; color: var(--ink-3); white-space: nowrap;
}
.jr-bar.is-empty::before {
    content: ""; position: absolute; left: 35%; right: 35%; bottom: var(--z, 0); height: 2px; border-radius: 1px; background: var(--line);
}

.jr-tip {
    position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, -100%);
    display: grid; gap: 2px; padding: 8px 11px; border-radius: var(--radius-sm);
    background: var(--ink); color: var(--bg); font-size: 12px; white-space: nowrap;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.jr-tip-title { opacity: .7; }
.jr-tip-pnl { font-weight: 700; font-size: 14px; }
.jr-tip-pnl.up { color: color-mix(in srgb, var(--pos) 55%, var(--bg)); }
.jr-tip-pnl.down { color: color-mix(in srgb, var(--neg) 55%, var(--bg)); }
.jr-tip-sub { opacity: .7; }

@media (max-width: 1100px) {
    .jr-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .jr-kpi:nth-child(3n+1) { border-left: 0; }
    .jr-kpi:nth-child(-n+3) { border-bottom: 1px solid var(--line-2); }
    .jr-analytics { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .jr-block:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line-2); }
    .jr-block:nth-child(2) { border-left: 0; }
}
@media (max-width: 720px) {
    .journal .card-head { flex-wrap: wrap; }
    .jr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .jr-kpi { border-left: 0 !important; border-bottom: 1px solid var(--line-2); }
    .jr-cal { gap: 4px; padding: 12px; }
    .jr-day, .jr-week { min-height: 58px; padding: 5px 6px; }
    .jr-n { display: none; }
    .jr-pnl { font-size: 12px; }
    .jr-analytics { grid-template-columns: minmax(0, 1fr); }
    .jr-block { border-left: 0 !important; border-bottom: 1px solid var(--line-2); }
}

/* --- pestaña Análisis (assets/js/analysis.js) ------------------------------ */

body.view-analysis #account-view, body.view-analysis #empty { display: none !important; }
.analysis-view { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
/* mientras llega el análisis con los filtros nuevos (api/analysis.php) */
#an-body { transition: opacity .15s; }
.analysis-view.is-updating #an-body { opacity: .6; }
.an-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.an-title { margin: 0; font: 600 22px/1.2 var(--font-display); letter-spacing: -.02em; }
.an-sub { margin: 3px 0 0; color: var(--ink-3); font-size: 13px; }
.an-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.an-select {
    height: 32px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 7px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%23868b93' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center;
    color: var(--ink); font-size: 13px; appearance: none; -webkit-appearance: none; max-width: 190px;
}
.an-select:hover { border-color: var(--ink-3); }
.an-select:disabled { opacity: .5; cursor: help; }
.an-select option { background: var(--surface); color: var(--ink); }
.an-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.an-loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 32px; color: var(--ink-3); }

/* YieldPip AI: analizar la cuenta (cabeza de la pestaña Análisis) */
.an-ai {
    position: relative; overflow: hidden; padding: 18px 20px;
    border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line)); border-top: 3px solid var(--brand);
    background:
        radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--brand) 10%, transparent) 0%, transparent 55%),
        var(--surface);
}
.an-ai[hidden] { display: none; }
.an-ai-intro { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.an-ai-badge {
    flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
    background: var(--brand); color: var(--on-brand);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 28%, transparent);
}
.an-ai.is-busy .an-ai-badge svg { animation: an-ai-pulse 1.4s ease-in-out infinite; }
@keyframes an-ai-pulse { 50% { transform: scale(.82) rotate(20deg); opacity: .75; } }
.an-ai-text { flex: 1 1 320px; min-width: 0; }
.an-ai-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; font: 700 17px/1.25 var(--font-display); letter-spacing: -.01em; }
.an-ai-tag {
    padding: 2px 8px; border-radius: 999px; font: 600 11px/1.5 var(--font, inherit); letter-spacing: .02em; text-transform: uppercase;
    color: var(--ink-2); background: color-mix(in srgb, var(--brand) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--line));
}
.an-ai-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; line-height: 1.45; max-width: 640px; }
.an-ai-btn {
    flex: none; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 20px;
    border: 1px solid var(--brand); border-radius: 10px; background: var(--brand); color: var(--on-brand);
    font-size: 14px; font-weight: 650; box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 30%, transparent);
    transition: transform .12s, box-shadow .12s, opacity .12s;
}
.an-ai-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 20px color-mix(in srgb, var(--brand) 36%, transparent); color: var(--on-brand); }
.an-ai-btn:active:not(:disabled) { transform: none; }
.an-ai-btn:disabled { opacity: .6; cursor: default; }
.an-ai-btn.is-busy .ai-spark { animation: an-ai-pulse 1.4s ease-in-out infinite; }
.an-ai-out { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.an-ai-wait { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; }
.an-ai-wait .spinner { display: inline-block; flex: none; width: 14px; height: 14px; }
.an-ai-error { margin: 0 0 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--neg-bg); color: var(--neg); font-size: 13px; }
.an-ai-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--ink-3); font-size: 12px; }
.an-ai-body { margin-top: 10px; font-size: 13.5px; line-height: 1.6; color: var(--ink); max-width: 860px; overflow-wrap: anywhere; }
.an-ai-body p { margin: 0 0 8px; }
.an-ai-body ul, .an-ai-body ol { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; }
.an-ai-body li::marker { color: var(--ink-3); }
.an-ai-body strong { font-weight: 650; }
.an-ai-body .an-ai-h { margin: 16px 0 6px; font: 650 14px/1.3 var(--font-display); color: var(--ink); }
.an-ai-body .an-ai-h:first-child { margin-top: 0; }
.an-ai-foot { margin: 12px 0 0; font-size: 11px; color: var(--ink-3); }
@media (max-width: 640px) { .an-ai-btn { width: 100%; justify-content: center; } }
@media (prefers-reduced-motion: reduce) { .an-ai-btn, .an-ai-badge svg, .an-ai-btn .ai-spark { animation: none !important; transition: none; } }
.an-empty { margin: 0; display: grid; place-items: center; height: 100%; color: var(--ink-3); font-size: 13px; }
.an-note { margin: 0; color: var(--ink-3); font-size: 12.5px; }
.an-foot { margin: 0; padding: 0 4px 16px; color: var(--ink-3); font-size: 12px; }
.an-link { padding: 0; border: 0; background: none; color: var(--focus); font: inherit; text-decoration: underline; text-underline-offset: 2px; }

.an-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.an-kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; min-width: 0; border-left: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.an-kpi:nth-child(4n+1) { border-left: 0; }
.an-kpi:nth-last-child(-n+4) { border-bottom: 0; }
.an-kpi[title] { cursor: help; }
.an-kpi dt { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.an-kpi dd { margin: 0; font: 600 22px/1.2 var(--font-display); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-kpi-foot { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-split-bar { display: flex; height: 5px; border-radius: 3px; overflow: hidden; gap: 2px; margin: 2px 0; }
.an-split-bar i { display: block; height: 100%; border-radius: 3px; }
.an-split-bar .up { background: var(--pos); }
.an-split-bar .down { background: var(--neg); }

.an-cum-card { display: flex; flex-direction: column; }
.an-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); }
.an-legend span { display: inline-flex; align-items: center; gap: 6px; }
.an-key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--chart-line); }
.an-key-bar { width: 8px; height: 10px; background: linear-gradient(var(--pos) 50%, var(--neg) 50%); }
.an-cum { position: relative; height: 260px; margin: 8px 8px 8px 0; }
.an-cum svg, .an-td-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.an-grid { stroke: var(--line-2); }
.an-zero { stroke: var(--line); stroke-width: 1.2; }
.an-axis { fill: var(--ink-3); font-size: 11px; }
.an-dbar.up { fill: color-mix(in srgb, var(--pos) 55%, transparent); }
.an-dbar.down { fill: color-mix(in srgb, var(--neg) 55%, transparent); }
.an-cum-line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.an-cum-area { fill: var(--chart-fill); }
.an-hit { fill: transparent; }
.an-hit:hover { fill: color-mix(in srgb, var(--ink) 5%, transparent); }

.analysis-view .journal { position: static; }
button.jr-day { font: inherit; color: inherit; text-align: left; cursor: pointer; }

.an-split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; }
.an-table td, .an-table th { padding-left: 16px; padding-right: 16px; }
.an-row { cursor: pointer; }
.an-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.an-row.is-selected td { background: var(--surface-2); }
.an-row.is-selected td.sym { box-shadow: inset 3px 0 0 var(--brand); }
.an-compare { display: grid; gap: 18px; padding: 14px 20px 20px; }
.an-cmp { display: grid; gap: 8px; }
.an-cmp-row { display: grid; grid-template-columns: 96px minmax(40px, 1fr) auto 44px 84px; gap: 10px; align-items: center; font-size: 13px; }
.an-cmp-label { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-cmp-bar { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.an-cmp-bar i { display: block; height: 100%; border-radius: 3px; }
.an-cmp-bar i.up { background: var(--pos); }
.an-cmp-bar i.down { background: var(--neg); }
.an-cmp-n, .an-cmp-p { color: var(--ink-3); font-size: 12px; text-align: right; white-space: nowrap; }
.an-cmp-net { text-align: right; font-weight: 600; white-space: nowrap; }

.an-pager { display: flex; align-items: center; gap: 6px; }
.an-pager-txt { font-size: 12.5px; color: var(--ink-3); margin-right: 4px; white-space: nowrap; }
.an-pager .btn-icon:hover svg { transform: none; }
.an-pager .btn:disabled { opacity: .4; cursor: default; }
.an-log-wrap { margin-top: 10px; border-top: 1px solid var(--line-2); }
.an-log th[data-sort] { cursor: pointer; user-select: none; }
.an-log th[data-sort]:hover { color: var(--ink); }
.an-log th.is-sorted { color: var(--ink); }
.an-log th.is-sorted::after { content: " ↑"; }
.an-log th.is-sorted.is-desc::after { content: " ↓"; }
.an-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.an-badge-tp { background: var(--pos-bg); color: var(--pos); }
.an-badge-sl, .an-badge-so { background: var(--neg-bg); color: var(--neg); }
.an-badge-expert { background: color-mix(in srgb, var(--focus) 14%, transparent); color: var(--focus); }
.an-replay { gap: 5px; white-space: nowrap; }
.an-replay svg { flex: none; color: var(--ink); }   /* blanco en tema oscuro, casi negro en claro */
.an-replay:hover { border-color: var(--focus); color: var(--ink); }
/* El botón queda siempre a la vista aunque la tabla se desplace en horizontal. */
.an-log th:last-child, .an-log td.actions { position: sticky; right: 0; background: var(--surface); box-shadow: -8px 0 8px -8px rgba(0, 0, 0, .25); }
.an-log tbody tr:hover td.actions { background: var(--surface-2); }
/* Bot / Manual junto a la fecha de apertura (registro de Análisis y Cuentas → Historial) */
.an-origin {
    display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; vertical-align: 1px;
    font-size: 10.5px; font-weight: 600; line-height: 16px; letter-spacing: .02em;
    background: var(--line-2); color: var(--ink-3);
}
.an-origin.is-bot { background: color-mix(in srgb, var(--focus) 16%, transparent); color: var(--focus); }
/* motivo de cierre junto a la fecha de cierre */
.an-origin.an-why-tp { background: var(--pos-bg); color: var(--pos); }
.an-origin.an-why-sl, .an-origin.an-why-so { background: var(--neg-bg); color: var(--neg); }
.an-origin.an-why-expert { background: color-mix(in srgb, var(--focus) 16%, transparent); color: var(--focus); }
/* Cuentas → History: pie con el enlace a Análisis cuando hay más operaciones de las que se enseñan */
.an-hist-more { margin: 0; padding: 12px 20px 16px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); text-align: center; }
.table-wrap:not(.has-rows) .an-hist-more { display: none; }

/* detalle de una operación */
.an-trade-modal { width: min(760px, calc(100vw - 32px)); }
.an-td-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.an-td-head h2 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.an-td-vol { font-size: 14px; color: var(--ink-3); font-weight: 500; }
.an-td-net { font: 600 22px/1.2 var(--font-display); letter-spacing: -.02em; white-space: nowrap; }
.an-td-chart-wrap { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface-2); }
.an-td-chart { position: relative; height: 250px; }
.an-td-msg { position: absolute; inset: 0; margin: 0; display: flex; gap: 10px; align-items: center; justify-content: center; color: var(--ink-3); font-size: 13px; text-align: center; padding: 0 24px; }
.an-td-msg[hidden] { display: none; }
.an-run-line { fill: none; stroke: var(--chart-line); stroke-width: 1.8; stroke-linejoin: round; }
.an-run-area.up { fill: color-mix(in srgb, var(--pos) 22%, transparent); }
.an-run-area.down { fill: color-mix(in srgb, var(--neg) 22%, transparent); }
.an-mark line { stroke-dasharray: 2 3; stroke-width: 1.2; }
.an-mark text { font-size: 10.5px; font-weight: 700; }
.an-mark.up line, .an-mark.up circle { stroke: var(--pos); }
.an-mark.up circle, .an-mark.up text { fill: var(--pos); }
.an-mark.down line, .an-mark.down circle { stroke: var(--neg); }
.an-mark.down circle, .an-mark.down text { fill: var(--neg); }
.an-end { fill: var(--chart-line); stroke: var(--surface-2); stroke-width: 2; }
.an-end.is-pos { fill: var(--pos); }
.an-end.is-neg { fill: var(--neg); }
.an-td-mfe { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.an-td-mfe:empty { display: none; }
.an-td-mfe div { display: grid; gap: 1px; }
.an-td-mfe dt { font-size: 12px; color: var(--ink-3); }
.an-td-mfe dd { margin: 0; font-weight: 700; font-size: 15px; }
.an-td-mfe span { font-size: 11.5px; color: var(--ink-3); }
.an-td-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
.an-td-facts div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.an-td-facts dt { color: var(--ink-3); }
.an-td-facts dd { margin: 0; text-align: right; font-weight: 600; }
.an-td-facts .muted { color: var(--ink-3); font-weight: 400; margin-left: 4px; }
.an-td-note { margin: 0; font-size: 12px; color: var(--ink-3); }
.an-td-note:empty { display: none; }

@media (max-width: 1100px) {
    .an-split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
    .an-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .an-kpi { border-left: 0 !important; border-bottom: 1px solid var(--line-2) !important; }
    .an-kpi:nth-child(2n) { border-left: 1px solid var(--line-2) !important; }
}
@media (max-width: 600px) {
    .an-td-facts, .an-td-mfe { grid-template-columns: minmax(0, 1fr); }
    .an-cmp-row { grid-template-columns: 80px minmax(30px, 1fr) 40px 70px; }
    .an-cmp-n { display: none; }
}

/* --- replay de una operación: PnL replay y Price replay (assets/js/analysis.js) --- */
#td-tabs button { padding: 0 12px; }
.an-td-chart { height: 270px; }
.an-rp { display: grid; grid-template-columns: auto minmax(120px, 1fr) auto; align-items: center; gap: 6px 12px; }
.an-rp[hidden] { display: none; }
.an-rp-btns { display: flex; gap: 4px; align-items: center; }
.an-rp-btns .btn-icon:hover svg { transform: none; }
.an-rp-btns .btn:disabled { opacity: .4; cursor: default; }
.an-rp-play { width: 36px; }
.an-rp-pos { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-rp-speed button { padding: 0 8px; }
.an-rp-seek {
    -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; cursor: pointer;
    background: linear-gradient(to right, var(--focus) var(--p, 100%), var(--line) var(--p, 100%));
}
.an-rp-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 2px solid var(--surface-2); }
.an-rp-seek::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 2px solid var(--surface-2); }
.an-rp-seek:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* cabezal del PnL replay y etiqueta del P&L de ese momento */
.an-head { stroke: var(--ink-3); stroke-dasharray: 3 3; }
.an-now rect { fill: var(--ink-3); }
.an-now.is-pos rect { fill: var(--pos); }
.an-now.is-neg rect { fill: var(--neg); }
.an-now text { fill: #fff; font-size: 11.5px; font-weight: 700; }

/* Price replay */
.an-candle line { stroke-width: 1; }
.an-candle.up line, .an-candle.up rect { stroke: var(--pos); fill: var(--pos); }
.an-candle.down line, .an-candle.down rect { stroke: var(--neg); fill: var(--neg); }
.an-candle.is-out { opacity: .38; }
.an-px-span { fill: color-mix(in srgb, var(--focus) 7%, transparent); }
.an-px-entry { stroke-width: 1.3; stroke-dasharray: 5 3; }
.an-px-entry.buy, .an-px-tri.buy { stroke: #2f7ee0; }
.an-px-entry.sell, .an-px-tri.sell { stroke: #e0702f; }
.an-px-tri { stroke-width: 1; }
.an-px-tri.buy { fill: #2f7ee0; }
.an-px-tri.sell { fill: #e0702f; }
.an-px-tag.buy { fill: #2f7ee0; font-weight: 700; }
.an-px-tag.sell { fill: #e0702f; font-weight: 700; }
.an-px-link { stroke-width: 1.4; stroke-dasharray: 4 3; stroke: var(--ink-3); }
.an-px-link.is-pos { stroke: var(--pos); }
.an-px-link.is-neg { stroke: var(--neg); }
.an-px-now { stroke: var(--ink-2); stroke-dasharray: 2 3; }

@media (max-width: 600px) {
    .an-rp { grid-template-columns: minmax(0, 1fr); }
    .an-rp-speed { justify-self: start; }
}

/* --- pestaña Copy Insiders (assets/js/insiders.js) ------------------------- */

body.view-insiders #account-view, body.view-insiders #empty { display: none !important; }
.insiders-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.insiders-view .in-card { transition: opacity .15s; }
.insiders-view.is-updating .in-card { opacity: .6; }
.in-search { width: 210px; padding-right: 10px; background-image: none; cursor: text; }
.in-avail-toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.in-avail-toggle:has(input:disabled) { opacity: .5; cursor: help; }
.in-status { display: flex; align-items: center; gap: 7px; margin: -4px 0 0; font-size: 12.5px; color: var(--ink-3); }
.in-status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--pos); }
.in-status.is-busy::before { background: var(--warn); }
.in-status.is-warn { color: var(--warn); }
.in-status.is-warn::before { background: var(--neg); }
.in-status:empty { display: none; }

.in-table td { vertical-align: middle; }
.in-table.an-table td, .in-table.an-table th { padding-left: 10px; padding-right: 10px; }
.in-table.an-table td:first-child, .in-table.an-table th:first-child { padding-left: 16px; }
.in-table .muted { color: var(--ink-3); }
.in-row { cursor: pointer; }
.in-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.in-row.is-open td { background: var(--surface-2); }
.in-table .in-exp { width: 28px; padding-right: 0; color: var(--ink-3); }
.in-chev { display: block; transition: transform .15s; }
.in-row.is-open .in-chev { transform: rotate(90deg); }
.in-tk { margin-right: 8px; font-weight: 700; letter-spacing: .01em; }
.in-co { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; color: var(--ink-2); }
.in-sec {
    display: inline-block; margin-left: 8px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px;
    background: var(--surface-2); color: var(--ink-3); font-size: 11px; vertical-align: 1px;
}
.in-owner { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.in-title { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; color: var(--ink-3); }
.in-role {
    display: inline-block; padding: 1px 6px; border-radius: 4px; background: var(--surface-2);
    color: var(--ink-2); font-size: 11.5px; font-weight: 600;
}
.in-lead .in-role { margin-left: 8px; }
.in-strong { font-weight: 600; }
.in-score {
    display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 22px; padding: 0 6px;
    border-radius: 11px; font-size: 12px; font-weight: 700; cursor: help;
}
.in-score.is-high { background: var(--pos-bg); color: var(--pos); }
.in-score.is-mid { background: var(--warn-bg); color: var(--warn); }
.in-score.is-low { background: var(--surface-2); color: var(--ink-3); }
.in-side { margin-right: 6px; font-weight: 600; }
.in-side-buy { color: var(--pos); }
.in-side-sell { color: var(--neg); }
.in-table .tag { margin-left: 4px; }

.in-copy { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.in-go-buy { background: var(--pos-bg); color: var(--pos); border-color: color-mix(in srgb, var(--pos) 30%, transparent); }
.in-go-buy:hover { background: var(--pos); color: #fff; }
.in-go-sell { background: var(--neg-bg); color: var(--neg); border-color: color-mix(in srgb, var(--neg) 30%, transparent); }
.in-go-sell:hover { background: var(--neg); color: #fff; }
.in-clip:hover svg { transform: none; }
.in-na { font-size: 12px; color: var(--ink-3); }

.in-table tr.in-detail > td { padding: 0; background: var(--surface-2); white-space: normal; }
.in-table tbody tr.in-detail:hover > td { background: var(--surface-2); }
.in-detail-wrap { padding: 4px 16px 14px 44px; }
.in-subtable { border: 1px solid var(--line); border-radius: 8px; border-collapse: separate; border-spacing: 0; background: var(--surface); font-size: 12.5px; }
.in-subtable th, .in-subtable td { padding: 7px 12px; }
.in-subtable tbody tr:hover td { background: var(--surface-2); }
/* logotipos de empresas (App.logoHtml): la inicial de color debajo, el PNG encima (si lo hay) */
.co-logo {
    position: relative; flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; overflow: hidden;
    border-radius: 7px; background: hsl(var(--h, 210) 55% 92%); color: hsl(var(--h, 210) 45% 30%);
    font-size: 12px; font-weight: 700; line-height: 1; vertical-align: middle;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent);
}
.co-logo img { position: absolute; inset: 0; width: 100%; height: 100%; padding: 2px; object-fit: contain; background: #fff; }
.co-logo.is-lg { width: 38px; height: 38px; border-radius: 10px; font-size: 16px; }
.co-logo.is-lg img { padding: 3px; }
@media (prefers-color-scheme: dark) {
    .co-logo { background: hsl(var(--h, 210) 30% 24%); color: hsl(var(--h, 210) 60% 82%); }
}
.in-co-wrap { display: inline-flex; align-items: center; gap: 9px; min-width: 0; vertical-align: middle; }
.in-co-txt { min-width: 0; white-space: nowrap; }

/* gráfico de la empresa en la fila desplegada */
/* Del ancho de lo que se ve de la tabla (--in-vis, lo pone insiders.js) y quieto al desplazarla de lado. */
.in-chart {
    position: sticky; left: 44px; width: calc(var(--in-vis, 100%) - 60px); margin: 8px 0 12px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden;
}
.in-chart-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.in-chart-name { display: grid; min-width: 0; line-height: 1.3; }
.in-chart-name b { font-size: 14.5px; letter-spacing: -.01em; }
.in-chart-name span { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ink-3); }
.in-chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-left: auto; font-size: 12px; color: var(--ink-2); }
.in-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.in-chart-legend .muted { color: var(--ink-3); }
.in-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
.in-dot.is-buy { background: var(--pos); }
.in-dot.is-sell { background: var(--neg); }
.in-chart-box { position: relative; height: 300px; }
.in-chart-msg {
    position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 20px;
    background: var(--surface); color: var(--ink-3); font-size: 13px; text-align: center;
}
.in-chart-msg[hidden] { display: none; }
.in-chart-foot {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px;
    padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2);
}
.in-chart-stats .in-sep { margin: 0 8px; color: var(--ink-3); }
.in-chart-stats .is-pos, .in-chart-stats .is-neg { font-weight: 600; }
.in-chart-src { font-size: 12px; color: var(--ink-3); }

.in-sec-link { color: var(--ink-2); text-decoration: none; }
.in-sec-link:hover { color: var(--ink); text-decoration: underline; }
.in-foot { max-width: 920px; }

@media (max-width: 720px) {
    .in-search { width: 100%; }
    .in-co, .in-owner { max-width: 130px; }
}

/* --- Fundamentals y News (assets/js/stocks.js; tercera columna, como Prediction) --- */
.tv-main.has-stk { grid-template-columns: minmax(0, 1fr) 300px 340px; }
.stk-body { gap: 12px; }
.stk-empty { display: grid; gap: 8px; justify-items: start; }
.stk-co { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stk-co > div { display: grid; min-width: 0; }
.stk-co strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stk-co small { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stk-kpis { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; }
.stk-kpis div { display: grid; gap: 1px; min-width: 0; }
.stk-kpis dt { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.stk-kpis dd { margin: 0; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stk-body .neg { color: var(--neg); }
.stk-body .pos { color: var(--pos); }
.stk-body .is-pos { color: var(--pos); }
.stk-body .is-neg { color: var(--neg); }
.stk-body .is-mid { color: var(--warn); }
.stk-warn { margin: 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--ink-2); font-size: 12px; line-height: 1.45; }
.stk-note { margin: 0; font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.stk-sec { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.stk-sec h4 { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.stk-sec h4 small { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-3); }
.stk-link { justify-self: start; }

.fv { display: grid; gap: 4px; padding: 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line-2); }
.fv-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.fv-top > div:first-child { display: grid; }
.fv-label { font-size: 11.5px; color: var(--ink-3); }
.fv-val { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.15; }
.fv-badge { display: grid; justify-items: end; padding: 5px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 600; line-height: 1.25; }
.fv-badge strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.stk-body .fv-badge.is-pos { background: var(--pos-bg); color: var(--pos); }
.stk-body .fv-badge.is-neg { background: var(--neg-bg); color: var(--neg); }
.stk-body .fv-badge.is-mid { background: var(--warn-bg); color: var(--warn); }
.fv-gauge { display: block; overflow: visible; }
.fv-zone-under { fill: var(--pos); opacity: .35; }
.fv-zone-over { fill: var(--neg); opacity: .3; }
.fv-track { fill: var(--line); }
.fv-dot { stroke: var(--surface-2); stroke-width: 1.5; }
.fv-dot.is-off { opacity: .3; }
.fv-fair-line { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.fv-price-mark { fill: var(--ink); }
.fv-g-lbl { font-size: 10.5px; font-weight: 650; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.fv-g-lbl.is-price { fill: var(--ink); }
.fv-sub { margin: 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
.fv-methods { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.fv-methods li { display: grid; grid-template-columns: 1fr auto 52px; align-items: center; gap: 2px 8px; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.fv-methods li:last-child { border-bottom: 0; }
.fv-methods label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; cursor: pointer; min-width: 0; }
.fv-methods label i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.fv-methods input:disabled + i { opacity: .35; }
.fv-m-val { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.fv-m-diff { font-size: 12px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.fv-m-note { grid-column: 1 / -1; margin: 0; padding-left: 21px; font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }
.fv-methods li.is-off .fv-m-val, .fv-methods li.is-off .fv-m-diff { opacity: .45; }

.stk-card { display: grid; gap: 6px; padding: 9px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.stk-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 650; }
.stk-card-head small { font-weight: 500; color: var(--ink-3); }
.stk-card-head strong { font-size: 12.5px; text-align: right; }
.az-bar { position: relative; display: flex; height: 8px; border-radius: 4px; }
.az-bar span { height: 100%; }
.az-d { background: var(--neg); opacity: .55; border-radius: 4px 0 0 4px; }
.az-g { background: var(--warn); opacity: .55; }
.az-s { flex: 1; background: var(--pos); opacity: .55; border-radius: 0 4px 4px 0; }
.az-bar i { position: absolute; top: -3px; width: 4px; height: 14px; margin-left: -2px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--surface); }
.az-ticks { position: relative; height: 12px; font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.az-ticks span { position: absolute; transform: translateX(-50%); }
.pf-cells { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; }
.pf-cells i { height: 8px; border-radius: 2px; background: var(--line); }
.pf-cells i.ok { background: var(--pos); }
.pf-cells i.ko { background: var(--neg); opacity: .55; }
.stk-details summary { font-size: 11.5px; color: var(--ink-3); cursor: pointer; }
.stk-checks { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; font-size: 12px; color: var(--ink-2); }
.stk-checks li { position: relative; padding-left: 18px; line-height: 1.4; }
.stk-checks li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.stk-checks li.ok::before { content: "\2713"; color: var(--pos); }
.stk-checks li.ko::before { content: "\2717"; color: var(--neg); }
.stk-checks li.na::before { content: "\2013"; color: var(--ink-3); }
.stk-checks small { color: var(--ink-3); }

.sr-chart { display: block; overflow: visible; }
.sr-zero { stroke: var(--line); stroke-width: 1; }
.sr-year { font-size: 10px; fill: var(--ink-3); }
.sr-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 11.5px; color: var(--ink-2); }
.sr-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sr-legend i { width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.sr-legend .sr-growth { margin-left: auto; color: var(--ink-3); }

.rt-groups { display: grid; gap: 10px; }
.rt-group h5 { margin: 0 0 4px; font-size: 11.5px; font-weight: 650; color: var(--ink-3); }
.rt-group dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.rt-group dl div { display: flex; justify-content: space-between; gap: 6px; padding: 3px 0; border-bottom: 1px dashed var(--line-2); font-size: 12px; }
.rt-group dt { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-group dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.stk-body .fi-split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12px; }
.stk-body .fi-split > div { display: grid; padding: 7px 9px; border-radius: var(--radius-sm); color: var(--ink); }
.stk-body .fi-split > .pos { background: var(--pos-bg); }
.stk-body .fi-split > .neg { background: var(--neg-bg); }
.stk-body .fi-split strong { font-size: 16px; }
.stk-body .fi-split small { color: var(--ink-3); }
.stk-body .fi-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; }
.stk-body .fi-bar .pos { background: var(--pos); }
.stk-body .fi-bar .neg { flex: 1; background: var(--neg); }
.fi-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.fi-recent li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line-2); font-size: 12px; }
.fi-side { font-size: 10.5px; font-weight: 700; text-transform: uppercase; }
.fi-who { display: grid; min-width: 0; font-weight: 600; }
.fi-who, .fi-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fi-who small { font-weight: 400; color: var(--ink-3); font-size: 11px; }
.fi-val { font-weight: 650; font-variant-numeric: tabular-nums; }

.nw-ai { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--surface-2); }
.nw-ai.is-idle p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.nw-ai-btn { justify-self: start; display: inline-flex; align-items: center; gap: 6px; background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.nw-ai-btn:hover { opacity: .9; }
.nw-ai-head { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.nw-ai-head small { color: var(--ink-3); font-size: 11.5px; }
.nw-ai-head .watch-icon { margin-left: auto; }
.nw-ai-body { font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.nw-ai-body p { margin: 0 0 6px; }
.nw-ai-body ul { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 3px; }
.nw-tabs { justify-self: start; }
.nw-list { list-style: none; margin: 0; padding: 0; display: grid; }
.nw-item { display: grid; gap: 3px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.nw-item:last-child { border-bottom: 0; }
.nw-item a { color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.35; text-decoration: none; }
.nw-item a:hover { color: var(--brand); text-decoration: underline; }
.nw-item p { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nw-item small { font-size: 11px; color: var(--ink-3); }
.nw-item.is-sec { grid-template-columns: auto 1fr; column-gap: 8px; align-items: start; }
.nw-item.is-sec small { grid-column: 2; }
.nw-sec-tag { padding: 1px 6px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); font-size: 10.5px; font-weight: 700; color: var(--ink-2); }
@media (max-width: 1400px) {
    .tv-main.has-stk { grid-template-columns: minmax(0, 1fr) 280px 310px; }
}
@media (max-width: 1100px) {
    .tv-main.has-stk { grid-template-columns: minmax(0, 1fr) 280px; }
    .tv-main.has-stk .stk { grid-column: 1 / -1; height: 520px; }
}
@media (max-width: 900px) {
    .tv-main.has-stk { grid-template-columns: 1fr; }
}

/* --- pestaña Auto manager: estado + reglas + acciones de la gestión automática -------- */
body.view-automanager #account-view, body.view-automanager #empty { display: none !important; }
.gm-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.gm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 16px; align-items: start; }
.gm-form { gap: 16px; }
.gm-card { padding: 20px; display: grid; gap: 18px; }
/* Prop Firm: tarjeta propia y destacada; la sección interior pierde su caja para no duplicar el borde */
.gm-card-risk { border-color: color-mix(in srgb, var(--focus) 35%, var(--line)); box-shadow: var(--shadow), inset 0 3px 0 var(--focus); }
.gm-card .gest-risk, .gm-card .gest-risk.is-off, .gm-card .gest-risk:not(.is-off) { border: 0; background: none; padding: 0; gap: 14px; }
.gm-card .gest-risk .gest-sec-title { font-size: 16px; }
.gm-form > .gm-actions { margin: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.gm-form-head { display: grid; gap: 3px; }
.gm-form-head h2 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.gm-form-head p { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.gm-actions {
    position: sticky; bottom: 12px; z-index: 4;
    display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
    margin: 0 -8px -8px; padding: 10px 8px 8px; border-top: 1px solid var(--line-2);
    background: var(--surface); border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.gm-actions .gest-off { margin-right: auto; }
.gm-dirty, .gm-saved { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.gm-dirty { color: var(--warn); }
.gm-dirty::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.gm-saved { color: var(--pos); }
.gm-saved::before { content: "✓"; }
#gest-submit:disabled:not(.is-busy) { opacity: .35; cursor: not-allowed; }
.gm-log { padding: 20px; display: grid; gap: 12px; position: sticky; top: 16px; }
.gm-log .gest-events { max-height: calc(100vh - 220px); }
@media (max-width: 1100px) {
    .gm-grid { grid-template-columns: minmax(0, 1fr); }
    .gm-log { position: static; }
    .gm-log .gest-events { max-height: 420px; }
}
@media (max-width: 720px) {
    .gm-card, .gm-log { padding: 16px; }
    .gm-actions { justify-content: stretch; }
    .gm-actions .btn { flex: 1; }
}

/* --- planes Free / Pro (assets/js/billing.js) ------------------------------ */

.plan-pill {
    display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
    border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
    color: var(--ink-2); font-size: 11.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.plan-pill.is-pro { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
button.plan-upgrade { cursor: pointer; height: 28px; padding: 0 11px; font-size: 12.5px; color: var(--ink); }
button.plan-upgrade:hover { border-color: var(--ink-3); background: var(--surface); }
.plan-upgrade-short { display: none; }
/* Barra superior estrecha: «Pro» en vez de «Mejorar a Pro» y solo la inicial del usuario. */
@media (max-width: 1280px) {
    .plan-upgrade-long { display: none; }
    .plan-upgrade-short { display: inline; }
    body.app .user-chip > span:last-child { display: none; }
}
.save-tag {
    display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 999px;
    background: var(--pos-bg); color: var(--pos); font-size: 10.5px; font-weight: 600; vertical-align: 1px;
}

/* Diálogo «Mejorar a Pro» */
.upgrade-modal { width: min(560px, calc(100vw - 32px)); }
.upgrade-modal .modal-head .plan-pill { margin-bottom: 10px; }
.upgrade-modal .modal-head p { font-size: 13.5px; color: var(--ink-2); text-wrap: pretty; }
.upgrade-price-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.upgrade-price-row .segmented button { height: 28px; }
.upgrade-price { margin: 0; color: var(--ink-3); font-size: 13px; }
.upgrade-price strong { font: 600 22px/1 var(--font-display); color: var(--ink); letter-spacing: -.02em; margin-right: 2px; }
.upgrade-price small { display: block; text-align: right; font-size: 11.5px; margin-top: 2px; }
.plan-compare { width: 100%; border-collapse: collapse; font-size: 13px; }
.plan-compare th, .plan-compare td { padding: 9px 8px; border-bottom: 1px solid var(--line-2); text-align: center; vertical-align: middle; }
.plan-compare tbody th { text-align: left; font-weight: 500; color: var(--ink-2); padding-left: 0; }
.plan-compare thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; padding-top: 0; }
.plan-compare td:last-child, .plan-compare thead th:last-child { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.plan-compare td svg { color: var(--pos); vertical-align: middle; }
.plan-compare tr.is-focus th { color: var(--ink); font-weight: 600; }
.plan-compare tr.is-focus td:last-child { background: var(--pos-bg); }
.plan-compare tr:last-child th, .plan-compare tr:last-child td { border-bottom: 0; }
.upgrade-note { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.modal-foot a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* Bots en Free */
.pro-banner { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 16px; }
.pro-banner-icon {
    flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.pro-banner-text { flex: 1; min-width: 0; }
.pro-banner-text h2 { margin: 0; font-size: 14px; font-weight: 600; }
.pro-banner-text p { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); text-wrap: pretty; }
@media (max-width: 720px) {
    .pro-banner { flex-wrap: wrap; }
    .pro-banner .btn { width: 100%; }
}

/* Cuenta bloqueada por el plan (barra lateral) */
.acc-item.is-locked { cursor: default; opacity: .8; border-style: dashed; border-color: var(--line); }
.acc-item.is-locked:hover { background: transparent; }
.acc-item.is-locked .acc-lock { flex: none; color: var(--ink-3); }
.acc-item.is-locked .link-btn { font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }

/* Replay de una operación antigua en Free */
.an-td-msg .btn { flex: none; }

/* Ajustes → Plan */
.plan-card-main { display: grid; gap: 14px; min-width: 0; }
.plan-card-body { display: grid; gap: 16px; min-width: 0; }
.plan-card-now { display: flex; align-items: flex-start; gap: 12px; }
.plan-card-now .plan-pill { margin-top: 1px; }
.plan-card-name { font-size: 14.5px; }
.plan-card-status { margin: 3px 0 0; font-size: 13px; color: var(--ink-3); }
.plan-card-limits { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.plan-card-limits div { background: var(--surface); padding: 10px 12px; min-width: 0; }
.plan-card-limits dt { font-size: 11.5px; color: var(--ink-3); }
.plan-card-limits dd { margin: 2px 0 0; font-size: 13px; font-weight: 600; }
@media (max-width: 720px) {
    .plan-card-limits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Aviso flotante (vuelta de Stripe) */
.plan-toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000;
    max-width: min(520px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 10px;
    background: var(--ink); color: var(--bg); font-size: 13.5px; box-shadow: 0 12px 32px -8px rgba(0, 0, 0, .35);
}
.plan-toast[data-tone="neg"] { background: var(--neg); color: #fff; }
.plan-toast[hidden] { display: none; }

/* Registro: elegir plan */
.plan-pick { margin: 0; padding: 0; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-width: 0; }
.plan-pick legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.plan-opt {
    position: relative; display: grid; gap: 2px; padding: 12px 12px 11px; cursor: pointer;
    border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.plan-opt:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.plan-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.plan-opt input { position: absolute; opacity: 0; pointer-events: none; }
.plan-opt-name { font-size: 13px; font-weight: 600; }
.plan-opt-price { font: 600 18px/1.2 var(--font-display); letter-spacing: -.01em; }
.plan-opt-price small { font: 500 12px var(--font); color: var(--ink-3); margin-left: 1px; }
.plan-opt-desc { font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }
.plan-cycle { grid-column: 1 / -1; display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); }
.plan-cycle label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.plan-cycle input { accent-color: var(--ink); margin: 0; }
.plan-pick .field-help { grid-column: 1 / -1; }
.plan-pick [hidden] { display: none !important; }

/* ==========================================================================
   Administración: menú de secciones, usuarios y ficha de usuario (admin.php)
   ========================================================================== */

.adm {
    display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 32px;
    max-width: 1440px; margin: 0 auto; padding: 24px; align-items: start;
}
.adm-main { min-width: 0; }
.adm-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }

/* Menú: texto plano, la sección activa en blanco con borde; contadores alineados a la derecha */
.adm-nav { position: sticky; top: 80px; display: grid; gap: 20px; }
.adm-nav-group { display: grid; gap: 1px; }
.adm-nav-label {
    margin: 0 0 6px; padding: 0 10px; font-size: 11px; font-weight: 600;
    color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em;
}
.adm-nav a {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    height: 32px; padding: 0 10px; border-radius: var(--radius-sm);
    color: var(--ink-2); font-size: 13.5px; font-weight: 500; text-decoration: none;
    transition: background-color .12s, color .12s;
}
.adm-nav a:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); color: var(--ink); }
.adm-nav a.is-active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.adm-nav-count { font-size: 11.5px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.adm-nav-count.is-alert {
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center;
    background: var(--neg-bg); color: var(--neg); font-weight: 600;
}
.adm-nav-count.is-alert.is-warn { background: var(--warn-bg); color: var(--warn); }

.adm-head { padding: 2px 0 4px; }
.adm-head h1 { margin: 0; font: 600 22px/1.2 var(--font-display); letter-spacing: -.02em; }
.adm-head p { margin: 4px 0 0; max-width: 760px; font-size: 13.5px; line-height: 1.5; color: var(--ink-3); }

/* Resumen: avisos dentro de su tarjeta */
.adm .admin-alerts { padding: 14px 20px 18px; }
.adm-ok { margin: 0; padding: 14px 20px 18px; }
.kpi dd.is-warn { color: var(--warn); }

@media (max-width: 960px) {
    .adm { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 0 16px 24px; }
    .adm-nav {
        top: 56px; z-index: 5; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
        margin: 0 -16px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
    }
    .adm-nav-group { display: contents; }
    .adm-nav-label { display: none; }
    .adm-nav a { flex: none; white-space: nowrap; }
}

/* Usuarios: barra de búsqueda y filtro, tabla */
.adm-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
    padding: 14px 20px; border-bottom: 1px solid var(--line-2);
}
.adm-search {
    display: flex; align-items: center; gap: 8px; width: min(340px, 100%); height: 32px; padding: 0 10px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-3);
    transition: border-color .15s;
}
.adm-search:hover { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line)); }
.adm-search:focus-within { border-color: var(--ink); }
.adm-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; outline: none; font-size: 13px; color: var(--ink); }
.adm-search input::placeholder { color: var(--ink-3); }
.adm-toolbar-count { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.admin .users-table td { vertical-align: middle; }
/* position: relative: el título oculto «Acciones» (.visually-hidden, absoluto) no se escapa del scroll y no ensancha la página en móvil */
#users-wrap { position: relative; }
.users-table tr.is-clickable { cursor: pointer; }
.users-table .user-cell-name { font-weight: 500; }
.users-table .plan-pill { height: 20px; padding: 0 8px; font-size: 11px; }
.users-table td.actions { text-align: right; }
.users-table tr:not(:hover) td.actions .btn { border-color: transparent; }

/* Ficha de usuario: panel lateral derecho (dialog modal) */
.drawer {
    position: fixed; inset: 0 0 0 auto; margin: 0; width: min(460px, 100vw); height: 100dvh; max-height: none; max-width: none;
    padding: 0; border: 0; border-left: 1px solid var(--line);
    background: var(--surface); color: var(--ink); box-shadow: -24px 0 48px -28px rgba(0, 0, 0, .3);
}
.drawer::backdrop { background: rgba(14, 16, 18, .35); }
.drawer[open] { animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(14px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .drawer[open] { animation: none; } }
.drawer-inner { display: flex; flex-direction: column; height: 100%; }
.drawer-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 18px 20px; border-bottom: 1px solid var(--line-2);
}
.drawer-head .btn-icon:hover svg { transform: none; }
.drawer-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.drawer-avatar {
    width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; color: var(--ink-2);
}
.drawer-who h2 { margin: 0; font: 600 16px/1.3 var(--font-display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.drawer-who p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 20px 8px; }
.drawer-foot {
    display: flex; align-items: center; gap: 8px; padding: 14px 20px;
    border-top: 1px solid var(--line-2); background: var(--surface);
}
.drawer-msg { margin: 0 auto 0 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.drawer-msg.is-neg { color: var(--neg); }
#ud-save:disabled { opacity: .4; cursor: not-allowed; }
#ud-save.is-busy { opacity: .75; cursor: progress; }

.ud-block { display: grid; gap: 10px; padding: 18px 0; border-bottom: 1px solid var(--line-2); }
.ud-block:last-child { border-bottom: 0; }
.ud-block h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }

.ud-plan { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ud-plan-opt {
    position: relative; display: grid; gap: 3px; align-content: start; padding: 12px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.ud-plan-opt:hover { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line)); }
.ud-plan-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ud-plan-opt:has(input:checked), .ud-plan-opt.is-checked { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.ud-plan-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.ud-plan-name { font-size: 14px; font-weight: 600; }
.ud-plan-desc { font-size: 12px; line-height: 1.45; color: var(--ink-3); }

.ud-until-mode { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.ud-radio { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; }
.ud-radio input { width: 15px; height: 15px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.ud-date { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.ud-date .field { gap: 5px; }
.ud-date .field label { font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.ud-date .field input { width: 170px; height: 34px; font-size: 13.5px; color-scheme: light dark; font-variant-numeric: tabular-nums; }
.ud-quick { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 4px; }
.ud-quick .btn { font-variant-numeric: tabular-nums; }
.ud-preview { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.ud-preview:empty { display: none; }

.ud-note {
    margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.5;
    background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-2);
}
.ud-note-warn {
    margin-top: 16px; background: var(--warn-bg); color: var(--warn);
    border-color: color-mix(in srgb, var(--warn) 20%, transparent);
}

.ud-facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.ud-facts div { display: grid; gap: 2px; }
.ud-facts dt { font-size: 12px; color: var(--ink-3); }
.ud-facts dd { margin: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ud-ban { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ud-ban p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.ud-ban .btn { flex: none; }

.adm-toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 60; max-width: calc(100vw - 32px);
    padding: 10px 14px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 13px;
    opacity: 0; transform: translate(-50%, 6px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.adm-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Límites y recursos */
.adm .limits-form { padding-top: 14px; border-bottom: 0; }
.adm .limits-form .field, .adm .limits-form .field:first-child { min-width: 140px; max-width: 180px; }
.tlimits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 14px 20px 18px; }
.tlimits-group {
    margin: 0; min-width: 0; padding: 10px 14px 14px; border: 1px solid var(--line-2); border-radius: 8px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.tlimits-group legend { padding: 0 6px; margin-left: -6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tlimits .field input { height: 36px; font-size: 13px; }
.tlimits-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.tlimits-foot .history-hint { flex: 1 1 260px; }
@media (max-width: 720px) {
    .tlimits { grid-template-columns: minmax(0, 1fr); }
    .ud-plan { grid-template-columns: minmax(0, 1fr); }
}
/* Estado (puente, SMTP, sandbox) bajo la cabecera de su tarjeta: un poco de aire */
.adm .history-state, .adm .sandbox-state { padding-top: 12px; }
/* Admin en móvil: barra superior compacta (sin el texto de estado ni el nombre; el punto de estado sigue) */
@media (max-width: 640px) {
    .admin .topbar-inner { gap: 12px; padding: 0 16px; }
    .admin .topbar-right { gap: 8px; }
    .admin .topbar-right .btn { white-space: nowrap; }
    .admin .status-text, .admin [data-user-name], .admin .topbar .tag-admin { display: none; }
}
