/* ════════════════════════════════════════════════════════════════════════
   Paper Trading Cientifico — Estilo Premium Emerald (Sprint 26 Opcao A)
   ════════════════════════════════════════════════════════════════════════
   Painel dedicado ao Sistema B (PnL Cientifico). Identidade emerald
   reservada para a joia (17 sprints).

   Tema: DEFAULT = ESCURO (matches html sem .light-theme).
   Overrides para tema claro via html.light-theme #page-paper-trading.
   ════════════════════════════════════════════════════════════════════════ */

#page-paper-trading {
    /* Emerald palette (constante em ambos os temas) */
    --pt-emerald-50:  #ecfdf5;
    --pt-emerald-100: #d1fae5;
    --pt-emerald-200: #a7f3d0;
    --pt-emerald-400: #34d399;
    --pt-emerald-500: #10b981;
    --pt-emerald-600: #059669;
    --pt-emerald-700: #047857;
    --pt-emerald-900: #064e3b;

    /* Default = ESCURO */
    --pt-bg-page:     transparent;
    --pt-bg-surface:  rgba(16, 185, 129, 0.04);
    --pt-bg-card:     rgba(20, 28, 36, 0.55);
    --pt-bg-card-hover: rgba(52, 211, 153, 0.06);
    --pt-border:      rgba(52, 211, 153, 0.20);
    --pt-border-strong: rgba(52, 211, 153, 0.45);
    --pt-border-row:  rgba(255, 255, 255, 0.06);

    --pt-text-strong: #f3f4f6;        /* títulos */
    --pt-text-body:   #e5e7eb;        /* corpo de tabela */
    --pt-text-muted:  #9ca3af;        /* labels */
    --pt-text-dim:    #6b7280;        /* hints */
    --pt-text-emerald: #6ee7b7;       /* destaques verdes em dark */

    --pt-danger:      #ef4444;
    --pt-warn:        #f59e0b;
    --pt-success:     #10b981;

    --pt-eyebrow-bg: rgba(16, 185, 129, 0.10);
    --pt-alert-bg:   rgba(245, 158, 11, 0.08);
    --pt-clear-bg:   rgba(16, 185, 129, 0.08);

    padding: 24px 32px 64px;
    background: var(--pt-bg-page);
    color: var(--pt-text-body);
}

/* Overrides TEMA CLARO */
html.light-theme #page-paper-trading {
    --pt-bg-surface:  rgba(6, 78, 59, 0.05);
    --pt-bg-card:     #ffffff;
    --pt-bg-card-hover: rgba(52, 211, 153, 0.04);
    --pt-border:      rgba(52, 211, 153, 0.20);
    --pt-border-strong: rgba(52, 211, 153, 0.40);
    --pt-border-row:  rgba(0, 0, 0, 0.06);

    --pt-text-strong: #0f172a;
    --pt-text-body:   #1f2937;
    --pt-text-muted:  #6b7280;
    --pt-text-dim:    #9ca3af;
    --pt-text-emerald: #047857;

    --pt-eyebrow-bg: #ecfdf5;
    --pt-alert-bg:   rgba(245, 158, 11, 0.06);
    --pt-clear-bg:   rgba(16, 185, 129, 0.06);

    background: linear-gradient(180deg, rgba(6, 78, 59, 0.02) 0%, transparent 100%);
}

/* ═══ HEADER EDITORIAL ═══ */
.pt-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--pt-border);
}

.pt-header-left { flex: 1 1 auto; min-width: 0; }

.pt-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--pt-text-emerald);
    background: var(--pt-eyebrow-bg);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--pt-border);
    margin-bottom: 12px;
}

.pt-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
    color: var(--pt-text-strong);
    display: flex;
    align-items: center;
    gap: 12px;
}

.pt-title-icon {
    width: 32px; height: 32px;
    color: var(--pt-emerald-500);
    flex-shrink: 0;
}

.pt-subtitle {
    font-size: 14px;
    color: var(--pt-text-muted);
    max-width: 720px;
    line-height: 1.55;
    margin: 0;
}

.pt-subtitle strong { color: var(--pt-text-emerald); font-weight: 700; }

.pt-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.pt-schedule-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--pt-text-emerald);
    background: var(--pt-eyebrow-bg);
    border: 1px solid var(--pt-border);
    padding: 5px 10px;
    border-radius: 8px;
}

.pt-schedule-badge .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--pt-emerald-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.20);
    animation: pt-pulse 2s ease-in-out infinite;
}

@keyframes pt-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pt-refresh-btn {
    margin-top: 4px;
    font-size: 11px;
    padding: 5px 10px;
    border: 1px solid var(--pt-border);
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--pt-text-emerald);
    font-weight: 600;
    transition: background 0.15s ease;
}

.pt-refresh-btn:hover { background: var(--pt-bg-card-hover); }

/* ═══ HERO METRICS ═══ */
.pt-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.pt-hero-card {
    background: var(--pt-bg-card);
    border: 1px solid var(--pt-border);
    border-radius: 14px;
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    backdrop-filter: blur(10px);
}

.pt-hero-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--pt-emerald-400), var(--pt-emerald-600));
    opacity: 0.85;
}

.pt-hero-card:hover {
    transform: translateY(-2px);
    border-color: var(--pt-border-strong);
    box-shadow: 0 8px 24px rgba(6, 78, 59, 0.18);
}

.pt-hero-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pt-text-muted);
    margin-bottom: 8px;
}

.pt-hero-value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--pt-text-strong);
    line-height: 1.1;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.pt-hero-value.positive { color: var(--pt-success); }
.pt-hero-value.negative { color: var(--pt-danger); }
.pt-hero-value.neutral  { color: var(--pt-text-strong); }

.pt-hero-hint {
    font-size: 11px;
    color: var(--pt-text-dim);
}

/* ═══ SECTIONS ═══ */
.pt-section {
    background: var(--pt-bg-card);
    border: 1px solid var(--pt-border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
}

.pt-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.pt-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--pt-text-strong);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.pt-section-title .icon {
    width: 18px; height: 18px;
    color: var(--pt-emerald-500);
    flex-shrink: 0;
}

.pt-section-meta {
    font-size: 12px;
    color: var(--pt-text-muted);
    font-variant-numeric: tabular-nums;
}

#pt-equity-chart-wrap {
    position: relative;
    height: 280px;
    width: 100%;
}

#pt-equity-chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pt-text-dim);
    font-size: 13px;
    pointer-events: none;
}

/* ═══ TABLES ═══ */
.pt-table-wrap {
    overflow-x: auto;
    margin: 0 -4px;
}

.pt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--pt-text-body);
}

.pt-table thead th {
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--pt-text-muted);
    padding: 8px 12px;
    border-bottom: 2px solid var(--pt-border);
    background: var(--pt-bg-surface);
    position: sticky;
    top: 0;
    z-index: 1;
}

.pt-table tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--pt-border-row);
    color: var(--pt-text-body);
}

.pt-table tbody tr:last-child td { border-bottom: none; }
.pt-table tbody tr:hover { background: var(--pt-bg-card-hover); }

.pt-ticker-cell {
    font-weight: 700;
    color: var(--pt-text-emerald);
    letter-spacing: 0.02em;
}

/* ═══ BADGES ═══ */
.pt-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pt-badge.long {
    background: rgba(16, 185, 129, 0.16);
    color: var(--pt-text-emerald);
    border: 1px solid var(--pt-border-strong);
}

.pt-badge.short {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.32);
}

.pt-badge.cash {
    background: rgba(107, 114, 128, 0.16);
    color: var(--pt-text-muted);
    border: 1px solid rgba(107, 114, 128, 0.32);
}

.pt-badge.hit  { background: rgba(16, 185, 129, 0.18); color: var(--pt-text-emerald); border: 1px solid var(--pt-border-strong); }
.pt-badge.miss { background: rgba(239, 68, 68, 0.16);  color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.32); }

/* Light-theme override para badges (cores mais escuras em fundo claro) */
html.light-theme #page-paper-trading .pt-badge.long { color: var(--pt-emerald-700); }
html.light-theme #page-paper-trading .pt-badge.short { color: #b91c1c; }
html.light-theme #page-paper-trading .pt-badge.cash { color: var(--pt-text-muted); }
html.light-theme #page-paper-trading .pt-badge.hit  { color: var(--pt-emerald-700); }
html.light-theme #page-paper-trading .pt-badge.miss { color: #b91c1c; }
html.light-theme #page-paper-trading .pt-ticker-cell { color: var(--pt-emerald-700); }

.pt-veto {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(245, 158, 11, 0.16);
    color: #fcd34d;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-left: 6px;
}

html.light-theme #page-paper-trading .pt-veto { color: #92400e; }

/* ═══ INTERVAL_95 VISUAL ═══ */
.pt-interval {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--pt-text-muted);
    font-variant-numeric: tabular-nums;
}

.pt-interval-bar {
    display: inline-block;
    width: 60px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.45) 0%, rgba(107, 114, 128, 0.35) 50%, rgba(16, 185, 129, 0.45) 100%);
    position: relative;
}

.pt-interval-marker {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 10px;
    background: var(--pt-text-emerald);
    border-radius: 1px;
}

/* ═══ ALERTS BANNER ═══ */
.pt-alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pt-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--pt-alert-bg);
    border: 1px solid rgba(245, 158, 11, 0.22);
    border-left: 3px solid var(--pt-warn);
}

.pt-alert-icon {
    flex-shrink: 0;
    width: 16px; height: 16px;
    color: var(--pt-warn);
    margin-top: 2px;
}

.pt-alert-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--pt-text-body);
}

.pt-alerts-clear {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--pt-clear-bg);
    border: 1px solid var(--pt-border);
    border-left: 3px solid var(--pt-success);
    color: var(--pt-text-emerald);
    font-size: 13px;
    font-weight: 600;
}

/* ═══ SCHEDULE PANEL ═══ */
.pt-schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.pt-schedule-item {
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--pt-bg-surface);
    border: 1px solid var(--pt-border);
}

.pt-schedule-item-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pt-text-muted);
    margin-bottom: 6px;
}

.pt-schedule-item-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--pt-text-strong);
    font-variant-numeric: tabular-nums;
}

.pt-schedule-item-hint {
    font-size: 11px;
    color: var(--pt-text-dim);
    margin-top: 4px;
}

.pt-schedule-footer {
    margin-top: 10px;
    font-size: 11px;
    color: var(--pt-text-dim);
    line-height: 1.6;
}

.pt-schedule-footer code {
    background: var(--pt-bg-surface);
    color: var(--pt-text-emerald);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10.5px;
    border: 1px solid var(--pt-border);
}

.pt-lock-active { color: var(--pt-warn); font-weight: 600; }
.pt-lock-free   { color: var(--pt-text-emerald); font-weight: 600; }

/* ═══ CITATIONS + REFERENCES ═══ */
.pt-cite {
    color: var(--pt-text-emerald);
    font-weight: 700;
    font-size: 0.75em;
    cursor: help;
    padding: 0 1px;
    transition: opacity 0.15s ease;
    text-decoration: none;
    vertical-align: super;
}

.pt-cite:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.pt-references {
    background: var(--pt-bg-card);
    border: 1px solid var(--pt-border);
    border-radius: 14px;
    padding: 22px 26px 18px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
}

.pt-references-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--pt-text-emerald);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--pt-border);
}

.pt-references-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    counter-reset: pt-ref-counter;
}

.pt-references-list li {
    counter-increment: pt-ref-counter;
    position: relative;
    padding: 10px 0 10px 32px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--pt-text-body);
    border-bottom: 1px dashed var(--pt-border-row);
}

.pt-references-list li:last-child { border-bottom: none; }

.pt-references-list li::before {
    content: "[" counter(pt-ref-counter) "]";
    position: absolute;
    left: 0;
    top: 10px;
    color: var(--pt-text-emerald);
    font-weight: 700;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.pt-references-list li strong {
    color: var(--pt-text-strong);
    font-weight: 700;
}

.pt-references-list li em {
    color: var(--pt-text-body);
    font-style: italic;
}

.pt-ref-note {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--pt-text-muted);
    font-style: italic;
    line-height: 1.5;
}

.pt-disclaimer {
    font-size: 11px;
    color: var(--pt-text-dim);
    line-height: 1.6;
    padding: 12px 14px;
    background: var(--pt-bg-surface);
    border-radius: 8px;
    border-left: 3px solid var(--pt-emerald-500);
}

.pt-disclaimer strong {
    color: var(--pt-text-emerald);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 10px;
}

/* ═══ EMPTY/LOADING ═══ */
.pt-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--pt-text-dim);
    font-size: 13px;
}

.pt-skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%);
    background-size: 200% 100%;
    animation: pt-shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes pt-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    #page-paper-trading { padding: 16px; }
    .pt-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .pt-header-right { align-items: flex-start; }
    .pt-title { font-size: 22px; }
    .pt-hero-value { font-size: 22px; }
    #pt-equity-chart-wrap { height: 220px; }
}
