:root {
    --primary:   #0f172a;
    --accent:    #3b82f6;
    --bullish:   #10b981;
    --bearish:   #ef4444;
    --pending:   #f59e0b;
    --triggered: #6366f1;
    --bg:        #f1f5f9;
    --card-bg:   #ffffff;
    --text:      #1e293b;
    --muted:     #64748b;
    --border:    #e2e8f0;
}

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

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

/* ── Nav ──────────────────────────────────────────────────────────────────── */

nav {
    background: var(--primary);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 2rem;
}

nav .brand {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    letter-spacing: 0.5px;
    margin-right: 0.5rem;
}

nav a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s;
}

nav a:hover { color: #ffffff; }

/* ── Layout ───────────────────────────────────────────────────────────────── */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* ── Stat cards ───────────────────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
}

.card .label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.card .value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text);
}

.card .sub {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.3rem;
}

/* ── Table container ──────────────────────────────────────────────────────── */

.table-container {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
    overflow-x: auto;
}

.table-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
}

table { width: 100%; border-collapse: collapse; }

th {
    padding: 0.7rem 1.5rem;
    text-align: left;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

tr:last-child td { border-bottom: none; }

tr.clickable { cursor: pointer; transition: background 0.1s; }
tr.clickable:hover { background: #f8fafc; }

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--muted);
}

.empty-state code {
    background: #f1f5f9;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-bullish   { background: #d1fae5; color: #065f46; }
.badge-bearish   { background: #fee2e2; color: #991b1b; }
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-triggered { background: #ede9fe; color: #4c1d95; }
.badge-complete  { background: #d1fae5; color: #065f46; }
.badge-partial   { background: #fef3c7; color: #92400e; }

/* ── Market status ────────────────────────────────────────────────────────── */

.market-open   { color: #10b981; font-weight: 600; }
.market-closed { color: var(--muted); font-weight: 600; }

/* ── Pattern detail ───────────────────────────────────────────────────────── */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.back-link:hover { color: var(--text); }

.pattern-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.pattern-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
}

#chart-container {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ── Pattern point cards ──────────────────────────────────────────────────── */

.points-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 700px) {
    .points-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .container {
        padding: 1rem;
    }

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

.point-card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.point-card .point-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.point-card .point-price {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.point-card .point-time {
    font-size: 0.8rem;
    color: var(--muted);
}

.point-p1      .point-price { color: #ef4444; }
.point-p2      .point-price { color: #3b82f6; }
.point-p3      .point-price { color: #f59e0b; }
.point-trigger .point-price { color: #8b5cf6; }
