/* ─── Reset & Variables ─────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f4f5f7;
    --bg2: #ffffff;
    --bg3: #f0f1f3;
    --border: #e2e4e9;
    --border2: #d0d3db;
    --text: #101010;
    --text-dim: #8a91a0;
    --text-bright: #1a1d24;
    --accent: #3D64CE;
    --accent-bg: #fff2ee;
    --accent2: #c47f00;
    --green: #1a9e60;
    --blue: #2563eb;
    --purple: #7c3aed;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
    --font-ui: sans-serif;
    --font-mono: 'Droid Sans Mono', 'JetBrains Mono', monospace;
    --radius: 5px;
    --radius-lg: 8px;
}

html {
    font-size: 15px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    min-height: 100vh;
    line-height: 1.6;
}

/* ─── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 52px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-family: var(--font-ui);
    font-weight: 800;
}

.brand-icon {
    color: var(--accent);
    font-size: 1.3rem;
    line-height: 1;
}

    .brand-icon.large {
        font-size: 2.5rem;
    }

.brand-name {
    color: var(--text-bright);
    font-size: 1rem;
    letter-spacing: .04em;
}

.brand-domain {
    color: var(--text-dim);
    font-size: .75rem;
    font-family: var(--font-mono);
}

.topbar-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: .78rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    transition: color .15s;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-mono);
}

    .nav-link:hover {
        color: var(--accent);
    }

/* ─── Main ──────────────────────────────────────────────────────────────── */
.main-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ─── Page header ───────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-family: var(--font-ui);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-bright);
    letter-spacing: -.01em;
}

.page-sub {
    color: var(--text-dim);
    font-size: .8rem;
    margin-top: .25rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.back-link {
    display: inline-block;
    color: var(--text-dim);
    text-decoration: none;
    font-size: .75rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-bottom: .5rem;
    transition: color .15s;
}

    .back-link:hover {
        color: var(--accent);
    }

/* ─── Badges & Tags ─────────────────────────────────────────────────────── */
.unread-badge {
    background: var(--accent);
    color: #fff;
    padding: .1rem .5rem;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    vertical-align: middle;
}

.tag-app {
    display: inline-block;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: .1rem .5rem;
    border-radius: var(--radius);
    font-size: .75rem;
}

.tag-component {
    display: inline-block;
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text-dim);
    padding: .1rem .5rem;
    border-radius: var(--radius);
    font-size: .75rem;
    margin-left: .25rem;
}

.tag-platform {
    display: inline-block;
    padding: .1rem .4rem;
    border-radius: var(--radius);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.tag-winui {
    background: #eff6ff;
    color: var(--blue);
    border: 1px solid #bfdbfe;
}

.tag-wpf {
    background: #f5f3ff;
    color: var(--purple);
    border: 1px solid #ddd6fe;
}

.tag-android {
    background: #f0fdf4;
    color: var(--green);
    border: 1px solid #bbf7d0;
}

.ver {
    color: var(--text-dim);
    font-size: .7rem;
}

/* ─── Filter bar ────────────────────────────────────────────────────────── */
.filter-bar {
    margin-bottom: 1rem;
    padding: .75rem 1rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-select {
    background: var(--bg);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: .35rem .6rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: .8rem;
    cursor: pointer;
}

    .filter-select:focus {
        outline: 2px solid var(--accent);
        outline-offset: 1px;
    }

.filter-check {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    color: var(--text-dim);
    cursor: pointer;
}

    .filter-check input[type=checkbox] {
        accent-color: var(--accent);
    }

/* ─── Table ─────────────────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background: var(--bg2);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}

    .report-table thead tr {
        background: var(--bg3);
        border-bottom: 2px solid var(--border);
    }

    .report-table th {
        padding: .65rem 1rem;
        text-align: left;
        color: var(--text-dim);
        font-size: .7rem;
        font-weight: 600;
        letter-spacing: .08em;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .report-table td {
        padding: .7rem 1rem;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
        background: var(--bg2);
    }

    .report-table tbody tr {
        transition: background .1s;
    }

        .report-table tbody tr:hover td {
            background: #fafbfc;
        }

        .report-table tbody tr:last-child td {
            border-bottom: none;
        }

.row-unread td {
    background: var(--accent-bg) !important;
}

    .row-unread td:first-child {
        border-left: 3px solid var(--accent);
    }

.row-unread:hover td {
    background: #fde8e0 !important;
}

.ex-type {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: .88rem;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.msg-cell {
    color: var(--text);
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.time-cell {
    color: var(--text-dim);
    white-space: nowrap;
    font-size: .78rem;
}
.occ-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    padding: .1rem .45rem;
    border-radius: 99px;
    letter-spacing: .03em;
}

.empty-row {
    text-align: center;
    padding: 3rem;
    color: var(--text-dim);
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn-detail {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    font-size: .75rem;
    letter-spacing: .04em;
    padding: .25rem .7rem;
    border: 1px solid rgba(208,74,31,.3);
    border-radius: var(--radius);
    background: var(--accent-bg);
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}

    .btn-detail:hover {
        background: #fdddd5;
        border-color: var(--accent);
    }

.btn-secondary {
    background: var(--bg2);
    border: 1px solid var(--border2);
    color: var(--text-dim);
    padding: .4rem .9rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: .78rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: color .15s, border-color .15s, box-shadow .15s;
}

    .btn-secondary:hover {
        color: var(--text-bright);
        border-color: var(--text-dim);
        box-shadow: var(--shadow-md);
    }

.btn-danger {
    background: var(--accent-bg);
    border: 1px solid rgba(208,74,31,.35);
    color: var(--accent);
    padding: .4rem .9rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: .78rem;
    cursor: pointer;
    transition: background .15s;
}

    .btn-danger:hover {
        background: #fdddd5;
    }

/* ─── Table actions ─────────────────────────────────────────────────────── */
.table-actions {
    display: flex;
    gap: .6rem;
    margin-bottom: .6rem;
}

/* ─── Pagination ────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: .4rem;
    margin-top: 1rem;
    justify-content: center;
}

.page-btn {
    display: inline-block;
    padding: .3rem .7rem;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text-dim);
    text-decoration: none;
    font-size: .78rem;
    box-shadow: var(--shadow);
    transition: all .15s;
}

    .page-btn:hover {
        color: var(--text-bright);
        border-color: var(--text-dim);
    }

    .page-btn.active {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
        box-shadow: none;
    }

/* ─── Detail page ───────────────────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.detail-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

    .detail-card.full-width {
        grid-column: 1 / -1;
    }

/* ─── Home page ─────────────────────────────────────────────────────────── */
.home-stat {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: .5rem 0 .25rem;
    font-family: var(--font-mono);
}

.home-stat-sub {
    font-size: .85rem;
    font-weight: 400;
    color: var(--text-dim);
}

.home-unread {
    margin-bottom: .6rem;
}

.btn-nav {
    display: inline-block;
    margin-top: .75rem;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text-bright);
    padding: .45rem 1rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: .8rem;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}

    .btn-nav:hover {
        border-color: var(--text-dim);
        box-shadow: var(--shadow-md);
    }

.card-title {
    font-family: var(--font-ui);
    font-size: .7rem;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: .75rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}

.detail-message {
    color: var(--text-bright);
    font-size: .9rem;
    line-height: 1.7;
}

.code-block {
    background: #f8f9fb;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: .75rem;
    color: var(--text);
    overflow-x: auto;
    white-space: pre;
    max-height: 480px;
    overflow-y: auto;
    line-height: 1.7;
}

.stack-trace {
    color: #202020;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
}

    .info-table th {
        text-align: left;
        color: var(--text-dim);
        font-weight: 500;
        padding: .4rem .6rem .4rem 0;
        width: 38%;
        vertical-align: top;
    }

    .info-table td {
        color: var(--text-bright);
        padding: .4rem 0;
        font-family: var(--font-mono);
        font-size: .75rem;
        word-break: break-all;
    }

    .info-table tr {
        border-bottom: 1px solid var(--border);
    }

        .info-table tr:last-child {
            border-bottom: none;
        }

/* ─── Device stats ──────────────────────────────────────────────────────── */
.stat-count {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-bright);
}

/* ─── Login page ────────────────────────────────────────────────────────── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    background-image: radial-gradient(circle at 20% 50%, rgba(208,74,31,.05) 0%, transparent 50%), radial-gradient(circle at 80% 20%, rgba(37,99,235,.04) 0%, transparent 40%);
}

.login-wrap {
    width: 340px;
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.login-title {
    font-family: var(--font-ui);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-bright);
    margin: .5rem 0 .25rem;
}

.login-sub {
    color: var(--text-dim);
    font-size: .75rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.login-input {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-size: .9rem;
    padding: .75rem 1rem;
    outline: none;
    box-shadow: var(--shadow);
    transition: border-color .15s, box-shadow .15s;
    text-align: center;
    letter-spacing: .1em;
}

    .login-input:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(208,74,31,.12);
    }

.login-btn {
    background: var(--accent);
    border: none;
    border-radius: var(--radius-lg);
    color: #fff;
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 700;
    padding: .75rem;
    cursor: pointer;
    letter-spacing: .04em;
    box-shadow: 0 2px 4px rgba(208,74,31,.3);
    transition: opacity .15s, transform .1s, box-shadow .15s;
}

    .login-btn:hover {
        opacity: .92;
        box-shadow: 0 4px 8px rgba(208,74,31,.3);
    }

    .login-btn:active {
        transform: scale(.98);
    }

.login-error {
    background: var(--accent-bg);
    border: 1px solid rgba(208,74,31,.3);
    color: var(--accent);
    border-radius: var(--radius);
    padding: .5rem .75rem;
    font-size: .8rem;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-card.full-width {
        grid-column: 1;
    }

    .msg-cell {
        max-width: 160px;
    }
}
