:root {
    color-scheme: light;
    --bg: #f7f8fb;
    --surface: #ffffff;
    --surface-strong: #eef6f8;
    --text: #172026;
    --muted: #64727d;
    --line: #dce4ea;
    --primary: #176f7b;
    --primary-strong: #0f5660;
    --success: #147a4b;
    --danger: #b42318;
    --warning: #a15c07;
    --shadow: 0 18px 45px rgba(23, 32, 38, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-x: hidden;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
}

.brand {
    font-weight: 800;
    text-decoration: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--muted);
    font-size: 14px;
}

.nav a,
.link-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
}

.shell {
    width: min(1080px, calc(100% - 32px));
    margin: 34px auto 64px;
}

.hero,
.recommendation,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 34px;
}

.hero.compact {
    padding: 28px 30px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

h1 {
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.08;
}

h2 {
    font-size: 22px;
}

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

.hero .muted,
.recommendation .muted,
.panel .muted {
    margin: 10px 0 0;
    overflow-wrap: anywhere;
}

.recommendation .muted {
    white-space: pre-line;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover {
    border-color: #b8c7d0;
}

.button:disabled {
    cursor: progress;
    opacity: 0.66;
}

.button.disabled {
    cursor: default;
    opacity: 0.66;
}

.button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    border-color: var(--primary-strong);
    background: var(--primary-strong);
}

.button.success {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
}

.button.danger {
    border-color: #f1c7c2;
    color: var(--danger);
}

.button.small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 14px;
}

.button-icon {
    display: inline-grid;
    width: 18px;
    height: 18px;
    place-items: center;
}

.recommendation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 18px;
    padding: 24px;
    background: var(--surface-strong);
}

.recommendation[hidden] {
    display: none;
}

.status-line {
    min-height: 42px;
    margin: 18px 0 10px;
    color: var(--muted);
    font-weight: 650;
}

.table-wrap {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.table-head,
.url-row {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 116px 96px 92px;
    align-items: center;
    gap: 14px;
}

.table-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: #f2f5f7;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.url-row {
    min-height: 76px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.url-row:last-child {
    border-bottom: 0;
}

.url-title {
    min-width: 0;
}

.url-title strong,
.url-title span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-title span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-width: 76px;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #f4f6f8;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.badge.ok,
.badge.online {
    border-color: #bbe6ce;
    background: #eaf8f0;
    color: var(--success);
}

.badge.fail,
.badge.offline {
    border-color: #efc6c0;
    background: #fff1ef;
    color: var(--danger);
}

.badge.checking {
    border-color: #f1d49d;
    background: #fff7e8;
    color: var(--warning);
}

.latency {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 760;
}

.panel {
    margin-top: 18px;
    padding: 24px;
}

.auth-panel {
    width: min(460px, 100%);
    margin: 56px auto;
}

.form {
    display: grid;
    gap: 16px;
    margin-top: 22px;
}

.grid-form {
    grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr) auto;
    align-items: end;
}

.cloudflare-form {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    align-items: end;
}

.cloudflare-form .button {
    min-height: 42px;
}

.form-actions {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.form-actions .button {
    flex: 1 1 180px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 750;
}

input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    background: #fff;
    color: var(--text);
    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(23, 111, 123, 0.14);
}

.alert {
    margin: 18px 0 0;
    border-radius: 8px;
    padding: 13px 15px;
    font-weight: 700;
}

.alert.error {
    border: 1px solid #efc6c0;
    background: #fff1ef;
    color: var(--danger);
}

.success-alert {
    border: 1px solid #bbe6ce;
    background: #eaf8f0;
    color: var(--success);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.admin-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.admin-row {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto auto auto;
    align-items: center;
    gap: 12px;
    min-height: 70px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.admin-row div {
    min-width: 0;
}

.admin-row strong,
.admin-row a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-row a {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}

.admin-row form {
    margin: 0;
}

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

.help-text {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

@media (max-width: 720px) {
    .topbar {
        padding: 0 16px;
    }

    .shell {
        width: auto;
        max-width: none;
        margin: 16px 10px 64px;
    }

    .hero,
    .recommendation,
    .panel,
    .table-wrap {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .hero,
    .recommendation {
        align-items: stretch;
        flex-direction: column;
        padding: 22px;
    }

    .hero > div,
    .recommendation > div {
        min-width: 0;
        max-width: 100%;
    }

    .hero > .button,
    .recommendation > .button {
        width: 100%;
    }

    h1 {
        font-size: 32px;
    }

    .hero .muted,
    .recommendation .muted {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .table-head {
        display: none;
    }

    .url-list {
        display: grid;
        gap: 0;
    }

    .url-row {
        grid-template-columns: 1fr auto;
        min-height: 0;
    }

    .url-title {
        grid-column: 1 / -1;
    }

    .latency {
        justify-self: start;
    }

    .grid-form,
    .cloudflare-form,
    .admin-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        display: grid;
    }

    .admin-row .badge {
        order: -1;
    }
}
