:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #17191c;
    --muted: #68707a;
    --border: #dfe3e8;
    --primary: #252b34;
    --match: #e0f4e7;
    --match-text: #176636;
    --reject: #f5e2e2;
    --reject-text: #812929;
    --info: #fff2cc;
    --info-text: #725500;
    --running: #e1edff;
    --running-text: #24558a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

.topbar {
    min-height: 64px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    font-weight: 750;
    font-size: 18px;
}

nav {
    display: flex;
    gap: 18px;
}

a {
    color: inherit;
    text-decoration: none;
}

nav a {
    color: var(--muted);
    font-weight: 550;
}

nav a:hover {
    color: var(--text);
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 36px 24px 80px;
}

h1 {
    margin-top: 0;
    font-size: 34px;
}

h2 {
    margin-top: 36px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
}

.stats {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(150px, 1fr)
        );
    gap: 14px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.stat strong {
    display: block;
    font-size: 30px;
}

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

.listing-grid {
    display: grid;
    gap: 14px;
}

.listing-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.listing-card:hover {
    border-color: #aeb5be;
}

.listing-card h3 {
    margin: 12px 0 6px;
}

.listing-card p {
    margin-bottom: 0;
    line-height: 1.5;
}

.listing-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
}

.badge.match,
.badge.done {
    background: var(--match);
    color: var(--match-text);
}

.badge.reject,
.badge.error {
    background: var(--reject);
    color: var(--reject-text);
}

.badge.needs_info,
.badge.queued {
    background: var(--info);
    color: var(--info-text);
}

.badge.running {
    background: var(--running);
    color: var(--running-text);
}

.score,
.meta,
.muted {
    color: var(--muted);
}

.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filters a {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
}

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

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

th {
    color: var(--muted);
    font-size: 13px;
}

.original-text {
    white-space: pre-wrap;
    line-height: 1.65;
}

pre {
    max-width: 100%;
    overflow-x: auto;
    background: #f4f5f7;
    border-radius: 8px;
    padding: 15px;
    font-size: 12px;
}

.back {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--muted);
}

.error {
    max-width: 320px;
    overflow-wrap: anywhere;
}

@media (
    max-width: 720px
) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
        padding: 16px;
    }

    nav {
        width: 100%;
        overflow-x: auto;
    }

    .container {
        padding: 24px 14px 60px;
    }

    h1 {
        font-size: 28px;
    }
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-box {
    width: min(420px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
}

.form {
    display: grid;
    gap: 18px;
}

.form label {
    display: grid;
    gap: 7px;
    font-weight: 600;
}

.form input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    padding: 11px 12px;
    font: inherit;
}

.form button,
.button-link {
    display: inline-block;
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    padding: 10px 15px;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(190px, 1fr)
        );
    gap: 16px;
}

.check-grid {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(230px, 1fr)
        );
    gap: 12px;
}

.check-grid label {
    display: flex;
    align-items: center;
    gap: 9px;
}

.check-grid input {
    width: auto;
}

.form-actions {
    margin-top: 15px;
}

.login-error {
    margin: 15px 0;
    padding: 11px;
    border-radius: 8px;
    background: var(--reject);
    color: var(--reject-text);
}

.notice {
    margin-bottom: 20px;
    padding: 13px 15px;
    border-radius: 9px;
    background: var(--match);
    color: var(--match-text);
}

.profile-summary {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(150px, 1fr)
        );
    gap: 15px;
    margin-top: 20px;
}

.profile-summary span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.profile-summary strong {
    display: block;
    margin-top: 3px;
    font-size: 20px;
}

.telegram-login {
    margin-top: 28px;
    text-align: center;
}

.login-section-title {
    margin-bottom: 16px;
    font-weight: 700;
}

.login-help {
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0;
    color: var(--muted);
    font-size: 13px;
}

.login-divider::before,
.login-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--border);
}

.admin-login summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
}

.admin-login-form {
    margin-top: 18px;
}
