<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}riff-observe{% endblock %}</title>
    <style>
        :root {
            --bg: #0d1117;
            --bg-secondary: #161b22;
            --border: #30363d;
            --text: #c9d1d9;
            --text-muted: #8b949e;
            --link: #58a6ff;
            --green: #3fb950;
            --red: #f85149;
            --orange: #d29922;
            --gray: #6e7681;
        }

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

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

        a {
            color: var(--link);
            text-decoration: none;
        }

        a:hover {
            text-decoration: underline;
        }

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

        header {
            background: var(--bg-secondary);
            border-bottom: 1px solid var(--border);
            padding: 16px 0;
            margin-bottom: 24px;
        }

        header .container {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding-top: 0;
            padding-bottom: 0;
        }

        .logo {
            font-size: 18px;
            font-weight: 600;
            color: var(--text);
        }

        .badge {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 500;
        }

        .badge.green { background: rgba(63, 185, 80, 0.2); color: var(--green); }
        .badge.red { background: rgba(248, 81, 73, 0.2); color: var(--red); }
        .badge.orange { background: rgba(210, 153, 34, 0.2); color: var(--orange); }
        .badge.gray { background: rgba(110, 118, 129, 0.2); color: var(--gray); }

        .risk-score {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 4px;
            font-weight: 600;
            font-size: 12px;
        }

        .risk-score.green { background: rgba(63, 185, 80, 0.2); color: var(--green); }
        .risk-score.red { background: rgba(248, 81, 73, 0.2); color: var(--red); }
        .risk-score.orange { background: rgba(210, 153, 34, 0.2); color: var(--orange); }
        .risk-score.gray { background: rgba(110, 118, 129, 0.2); color: var(--gray); }

        table {
            width: 100%;
            border-collapse: collapse;
            background: var(--bg-secondary);
            border-radius: 6px;
            overflow: hidden;
        }

        th, td {
            text-align: left;
            padding: 12px 16px;
            border-bottom: 1px solid var(--border);
        }

        th {
            background: var(--bg);
            font-weight: 600;
            color: var(--text-muted);
            font-size: 12px;
            text-transform: uppercase;
        }

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

        tr:hover {
            background: rgba(255, 255, 255, 0.02);
        }

        .filters {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 16px;
            margin-bottom: 20px;
            display: flex;
            gap: 16px;
            flex-wrap: wrap;
            align-items: flex-end;
        }

        .filter-group {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .filter-group label {
            font-size: 12px;
            color: var(--text-muted);
        }

        input, select {
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 4px;
            color: var(--text);
            padding: 6px 10px;
            font-size: 14px;
        }

        input:focus, select:focus {
            outline: none;
            border-color: var(--link);
        }

        button {
            background: var(--link);
            color: white;
            border: none;
            border-radius: 4px;
            padding: 8px 16px;
            font-size: 14px;
            cursor: pointer;
        }

        button:hover {
            opacity: 0.9;
        }

        .pagination {
            display: flex;
            gap: 8px;
            margin-top: 20px;
            justify-content: center;
        }

        .pagination a {
            padding: 8px 16px;
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 4px;
        }

        .pagination a.disabled {
            opacity: 0.5;
            pointer-events: none;
        }

        .card {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 20px;
            margin-bottom: 20px;
        }

        .card h2 {
            font-size: 16px;
            margin-bottom: 16px;
            color: var(--text);
        }

        .meta-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 16px;
        }

        .meta-item {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .meta-item label {
            font-size: 12px;
            color: var(--text-muted);
        }

        .meta-item value {
            font-size: 14px;
        }

        .tags {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
        }

        .tag {
            background: rgba(88, 166, 255, 0.1);
            color: var(--link);
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 12px;
        }

        .span-tree {
            font-family: monospace;
            font-size: 13px;
        }

        .span-node {
            padding: 8px 0;
            border-bottom: 1px solid var(--border);
        }

        .span-node:last-child {
            border-bottom: none;
        }

        .span-header {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .span-indent {
            color: var(--text-muted);
        }

        .span-name {
            font-weight: 600;
        }

        .span-kind {
            color: var(--text-muted);
            font-size: 12px;
        }

        .span-duration {
            color: var(--text-muted);
            margin-left: auto;
        }

        .events-list {
            font-family: monospace;
            font-size: 13px;
        }

        .event-item {
            padding: 8px 0;
            border-bottom: 1px solid var(--border);
            display: flex;
            gap: 16px;
        }

        .event-item:last-child {
            border-bottom: none;
        }

        .event-type {
            color: var(--link);
            min-width: 120px;
        }

        .event-payload {
            color: var(--text-muted);
            word-break: break-all;
        }

        pre {
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 4px;
            padding: 12px;
            overflow-x: auto;
            font-size: 12px;
        }

        .empty {
            text-align: center;
            padding: 40px;
            color: var(--text-muted);
        }
    </style>
</head>
<body>
    <header>
        <div class="container">
            <a href="/" class="logo">riff-observe</a>
            <span style="color: var(--text-muted); font-size: 12px;">Observability Viewer</span>
        </div>
    </header>

    <main class="container">
        {% block content %}{% endblock %}
    </main>
</body>
</html>
