/* Kraken Grid Bot — UI premium, tema oscuro */
:root {
    --bg-0: #0a0a0a;
    --bg-1: #111111;
    --bg-2: #161616;
    --bg-3: #1f1f1f;
    --border: #262626;
    --text: #e5e5e5;
    --text-muted: #888888;
    --accent: #5fffd7;
    --accent-dim: #3fbfa3;
    --green: #4ade80;
    --red: #f87171;
    --yellow: #facc15;
    --blue: #60a5fa;
    --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 16px; }
.brand h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.brand .accent { color: var(--accent); }
.pair {
    padding: 4px 10px;
    background: var(--bg-3);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
}
.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
}
.badge-paper { background: rgba(250, 204, 21, 0.15); color: var(--yellow); }
.badge-real { background: rgba(74, 222, 128, 0.15); color: var(--green); }

.header-actions { display: flex; align-items: center; gap: 24px; }
.status-indicator {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-muted); font-size: 13px;
}
.dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted);
}
.dot-idle { background: var(--text-muted); }
.dot-running { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.dot-error { background: var(--red); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.btn-stop {
    padding: 8px 16px;
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn-stop:hover { opacity: 0.85; }

main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 20px;
}
.card-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}
.card-value {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.card-sub {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}
.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--text-muted); }

.charts {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}
@media (max-width: 1100px) {
    .charts { grid-template-columns: 1fr; }
}

.chart-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    min-height: 320px;
}
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}
.chart-header h2 { font-size: 14px; font-weight: 600; }
.chart-card canvas { max-height: 280px; }

.tables {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}
@media (max-width: 1100px) {
    .tables { grid-template-columns: 1fr; }
}

.table-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    overflow: hidden;
}
.table-card h2 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 12px;
}
th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 10px;
    padding: 8px 12px 8px 0;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 10px 12px 10px 0;
    border-bottom: 1px solid var(--bg-2);
}
tbody tr:last-child td { border-bottom: none; }

.events { list-style: none; max-height: 280px; overflow-y: auto; }
.events li {
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-2);
    font-size: 12px;
}
.events li:last-child { border-bottom: none; }
.events .event-ts { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }

footer {
    padding: 16px 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* Scrollbar dark */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* === Control buttons (start/stop/cancel) === */
.control-buttons { display: flex; gap: 6px; }
.btn-ctrl {
    width: 34px; height: 34px;
    border-radius: 6px;
    background: var(--bg-3);
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s, opacity 0.15s;
}
.btn-ctrl:hover { background: var(--border); }
.btn-ctrl:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ctrl-go { color: var(--green); }
.btn-ctrl-warn { color: var(--yellow); }
.btn-link {
    background: transparent; color: var(--text-muted);
    padding: 6px 10px; border-radius: 6px;
    text-decoration: none; font-size: 13px;
    border: 1px solid transparent;
    transition: color 0.15s, background 0.15s;
}
.btn-link:hover { color: var(--text); background: var(--bg-2); }

/* === Hero card narrativa + eventos === */
.hero-card {
    background: linear-gradient(135deg, var(--bg-1) 0%, #0e1410 100%);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 24px 28px;
    margin-bottom: 8px;
}
.hero-narrative {
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    margin-bottom: 18px;
}
.hero-events {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}
.hero-event {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 16px;
}
.hero-event-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.hero-event-icon { font-size: 16px; }
.hero-event-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.hero-event-value { font-family: var(--font-mono); font-size: 16px; color: var(--accent); font-weight: 600; }
.hero-event-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
