:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-muted: #eef2f7;
    --border: #d8e0ea;
    --text: #1b2430;
    --muted: #667386;
    --primary: #1b6b5c;
    --primary-strong: #10483e;
    --danger: #b42318;
    --danger-bg: #fff1f0;
    --success: #147a48;
    --success-bg: #eaf7ef;
    --warning: #9a6700;
    --warning-bg: #fff7d6;
    --neutral-bg: #eef2f7;
    --shadow: 0 12px 30px rgba(27, 36, 48, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background: var(--bg);
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: inherit;
}

.auth-body {
    display: grid;
    min-height: 100dvh;
    place-items: center;
    padding: 24px;
}

.app-body {
    min-height: 100dvh;
}

.auth-shell {
    width: 100%;
    max-width: 440px;
}

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

.auth-panel {
    padding: 28px;
}

.auth-panel h1,
.topbar h1,
.section-heading h2 {
    margin: 0;
    letter-spacing: 0;
}

.auth-panel h1 {
    font-size: 28px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

.topbar h1 {
    font-size: 26px;
}

.layout {
    width: min(1320px, 100%);
    margin: 0 auto;
    padding: 24px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric {
    min-height: 86px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 26px;
    line-height: 1.1;
}

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

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

.section-heading h2 {
    font-size: 20px;
}

.section-heading p {
    margin: 4px 0 0;
    color: var(--muted);
}

.stacked-form,
.site-form {
    display: grid;
    gap: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-weight: 700;
}

label span {
    font-size: 13px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    background: #ffffff;
    outline: none;
}

textarea {
    min-height: 118px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 107, 92, 0.18);
}

.wide {
    grid-column: 1 / -1;
}

.toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 2px 0 18px;
}

.tabs a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-weight: 900;
    text-decoration: none;
    background: var(--surface);
}

.tabs a.active {
    color: #ffffff;
    border-color: var(--primary);
    background: var(--primary);
}

.option-group {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfcfe;
}

.option-group legend {
    padding: 0 6px;
    font-size: 14px;
    font-weight: 900;
}

.field-note {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 14px;
}

.check-label {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-muted);
}

.check-label input {
    width: 18px;
    min-height: 18px;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button:focus-visible {
    outline: 3px solid rgba(27, 107, 92, 0.28);
    outline-offset: 2px;
}

.primary {
    color: #ffffff;
    background: var(--primary);
}

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

.secondary {
    border-color: var(--border);
    background: var(--surface);
}

.secondary:hover {
    background: var(--surface-muted);
}

.danger {
    color: var(--danger);
    border-color: #f2b8b5;
    background: var(--danger-bg);
}

.danger:hover {
    border-color: var(--danger);
}

.compact {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 13px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 6px;
    font-weight: 700;
}

.notice.success {
    color: var(--success);
    background: var(--success-bg);
}

.notice.error {
    color: var(--danger);
    background: var(--danger-bg);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    background: var(--surface);
}

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

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

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

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

.block {
    display: block;
}

.status {
    display: inline-flex;
    min-width: 76px;
    justify-content: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.status.up {
    color: var(--success);
    background: var(--success-bg);
}

.status.down {
    color: var(--danger);
    background: var(--danger-bg);
}

.status.pending {
    color: var(--warning);
    background: var(--warning-bg);
}

.status.slow {
    color: var(--warning);
    background: var(--warning-bg);
}

.status.neutral {
    color: var(--muted);
    background: var(--neutral-bg);
}

.site-type-options {
    display: grid;
    gap: 12px;
}

.site-type-options + .site-type-options {
    margin-top: 12px;
}

.site-type-options.is-hidden {
    display: none;
}

.monitor-list {
    display: grid;
    gap: 6px;
}

.monitor-list span {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.monitor-list small {
    color: var(--muted);
    font-weight: 800;
}

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

.actions form {
    margin: 0;
}

.empty-state {
    padding: 26px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
    background: var(--surface-muted);
    font-weight: 700;
}

@media (max-width: 980px) {
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

    .layout {
        padding: 16px;
    }

    .metrics,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 16px;
    }

    .section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .form-actions,
    .form-actions .button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
