:root {
    --bg: #0f1117;
    --surface: #171a22;
    --surface-2: #1e2230;
    --border: #2a3042;
    --text: #e8ecf4;
    --muted: #8b95a8;
    --accent: #5b8def;
    --accent-hover: #7aa3f5;
    --danger: #e85d6c;
    --danger-hover: #f07a87;
    --success: #4ec9a0;
    --radius: 10px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

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

.layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.875rem; }

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

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

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    align-items: end;
}

.filters-grid label span {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input, select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
}

input:focus, select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 0;
}

.filters-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    background: var(--surface-2);
    border-color: var(--border);
}

.btn:hover { filter: brightness(1.1); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 0.8125rem; }
.btn.disabled { pointer-events: none; opacity: 0.4; }

.inline-form { display: inline; }

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

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

th {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tbody tr:hover { background: var(--surface-2); }

.message-cell a { color: var(--text); }
.message-cell a:hover { color: var(--accent); }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(91, 141, 239, 0.15);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 500;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.875rem;
}

.page-num:hover { background: var(--surface-2); color: var(--text); }
.page-num.active { background: var(--accent); color: #fff; }
.dots { color: var(--muted); padding: 0 4px; }

.empty {
    text-align: center;
    color: var(--muted);
    padding: 32px;
    margin: 0;
}

.footer {
    text-align: center;
    font-size: 0.8125rem;
    margin-top: 24px;
}

.footer code {
    background: var(--surface);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--mono);
}

.section-title {
    margin: 24px 0 10px;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
}

.section-title:first-child { margin-top: 0; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.meta-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    margin: 0;
    font-size: 0.875rem;
}

.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; }

.code-block {
    margin: 0;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-block { border-left: 3px solid var(--danger); }
.stack-block { color: #c5cdd8; max-height: 480px; overflow-y: auto; }
.ua-block { color: var(--muted); font-size: 0.75rem; }

.source-cell { max-width: 140px; }
.source-link { font-size: 0.8125rem; word-break: break-all; }

@media (max-width: 640px) {
    .header { flex-direction: column; }
    th:nth-child(5), td:nth-child(5),
    th:nth-child(6), td:nth-child(6) { display: none; }
}
