
        :root {
            --crimson: #DC143C;
            --burgundy: #800020;
            --ink: #2b2b33;
            --muted: #6b6b78;
            --line: #ecdfe3;
            --panel: #fbf6f7;
            --up: #c0183c;
            --down: #2563eb;
            --hold: #c9c3c7;
            --base: #6b7280;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--crimson);
            color: var(--ink);
            min-height: 100vh;
            overflow-x: hidden;
        }

        .app-container {
            max-width: 800px;
            margin: 0 auto;
            background: #fff;
            min-height: 100vh;
            box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
        }

        header {
            padding: 14px 24px 10px;
            text-align: center;
            color: var(--burgundy);
            border-bottom: 1px solid var(--line);
        }

        header h1 { font-size: 1.5rem; font-weight: 300; }

        .subtitle { font-size: 0.8rem; opacity: 0.85; margin-top: 2px; }

        .subtitle a, .back-link { color: var(--burgundy); }

        .back-link {
            display: inline-block;
            font-size: 0.75rem;
            margin-bottom: 6px;
            text-decoration: none;
            opacity: 0.8;
        }

        .back-link:hover { opacity: 1; text-decoration: underline; }

        .status {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            margin-top: 8px;
            padding: 3px 12px;
            border: 1px solid var(--burgundy);
            border-radius: 20px;
            font-size: 0.72rem;
            font-weight: 600;
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #f59e0b;
        }

        .status.live .status-dot { background: #16a34a; }
        .status.error .status-dot { background: var(--crimson); }
        .status.paused .status-dot { background: #9ca3af; }

        main { padding: 18px 20px 40px; }

        section { margin-bottom: 22px; }

        h2 {
            font-size: 0.8rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: var(--burgundy);
            margin-bottom: 8px;
        }

        .hero {
            text-align: center;
            padding: 18px 12px 16px;
            background: var(--panel);
            border: 1px solid var(--line);
            border-radius: 12px;
        }

        .hero-label { font-size: 0.8rem; color: var(--muted); }

        .hero-value {
            font-size: 3rem;
            font-weight: 300;
            color: var(--burgundy);
            line-height: 1.15;
            font-variant-numeric: tabular-nums;
        }

        .hero-unit { font-size: 1.1rem; color: var(--muted); }

        .hero-sub {
            font-size: 0.78rem;
            color: var(--muted);
            margin-top: 4px;
            font-variant-numeric: tabular-nums;
        }

        .pill {
            display: inline-block;
            margin-top: 10px;
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 0.75rem;
            font-weight: 600;
            background: #eee;
            color: var(--muted);
        }

        .pill.binding { background: #fde2e7; color: var(--up); }
        .pill.above { background: #e0e7ff; color: var(--down); }

        .metrics {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 8px;
        }

        .metric {
            border: 1px solid var(--line);
            border-radius: 10px;
            padding: 10px;
            text-align: center;
        }

        .metric-label { font-size: 0.7rem; color: var(--muted); }

        .metric-value {
            font-size: 1.05rem;
            font-weight: 600;
            color: var(--burgundy);
            margin-top: 2px;
            font-variant-numeric: tabular-nums;
        }

        .metric-note { font-size: 0.68rem; color: var(--muted); margin-top: 2px; }

        .chart-card {
            border: 1px solid var(--line);
            border-radius: 10px;
            padding: 10px 10px 6px;
        }

        .chart-card svg { width: 100%; height: auto; display: block; }

        .chart-legend {
            display: flex;
            flex-wrap: wrap;
            gap: 14px;
            font-size: 0.72rem;
            color: var(--muted);
            margin: 0 4px 6px;
        }

        .swatch {
            display: inline-block;
            width: 12px;
            height: 3px;
            vertical-align: middle;
            margin-right: 4px;
            border-radius: 2px;
        }

        .swatch.dot { width: 7px; height: 7px; border-radius: 50%; }

        .chart-plot {
            position: relative;
            touch-action: pan-y;
        }

        .chart-tooltip {
            position: absolute;
            top: 6px;
            left: 0;
            min-width: 170px;
            padding: 7px 10px;
            background: #fff;
            border: 1px solid var(--line);
            border-radius: 8px;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
            font-size: 0.72rem;
            pointer-events: none;
            z-index: 2;
        }

        .chart-tooltip[hidden] { display: none; }

        .tooltip-title {
            font-weight: 600;
            color: var(--burgundy);
            margin-bottom: 3px;
        }

        .tooltip-row {
            display: flex;
            justify-content: space-between;
            gap: 14px;
            color: var(--muted);
            line-height: 1.5;
        }

        .tooltip-row strong {
            color: var(--ink);
            font-weight: 600;
            font-variant-numeric: tabular-nums;
        }

        .chart-empty {
            padding: 40px 0;
            text-align: center;
            font-size: 0.8rem;
            color: var(--muted);
        }

        .votes-strip {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(9px, 1fr));
            gap: 2px;
            margin-bottom: 8px;
        }

        .vote {
            aspect-ratio: 1;
            border-radius: 2px;
            background: var(--hold);
        }

        .vote.up { background: var(--up); }
        .vote.down { background: var(--down); }
        .vote.partial { opacity: 0.45; }

        .vote-summary {
            display: flex;
            flex-wrap: wrap;
            gap: 6px 16px;
            font-size: 0.78rem;
            color: var(--muted);
        }

        .vote-summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }

        .targets {
            font-size: 0.78rem;
            color: var(--muted);
            margin-top: 8px;
        }

        .targets a { color: var(--burgundy); }

        .explainer {
            font-size: 0.85rem;
            line-height: 1.55;
            color: var(--ink);
        }

        .explainer p { margin-bottom: 8px; }

        .explainer a { color: var(--burgundy); }

        .formula {
            font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
            background: var(--panel);
            border: 1px solid var(--line);
            border-radius: 8px;
            padding: 8px 12px;
            margin: 8px 0 10px;
            font-size: 0.8rem;
            overflow-x: auto;
            white-space: nowrap;
        }

        .constants {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.78rem;
            margin: 6px 0 10px;
        }

        .constants td {
            padding: 5px 6px;
            border-bottom: 1px solid var(--line);
            vertical-align: top;
        }

        .constants td:last-child {
            text-align: right;
            font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
            word-break: break-all;
        }

        .caveat { font-size: 0.78rem; color: var(--muted); }

        @media (max-width: 600px) {
            main { padding: 14px 16px 32px; }
            .hero-value { font-size: 2.4rem; }
            .metrics { grid-template-columns: repeat(2, 1fr); }
        }
    
