:root {
    color-scheme: dark;
    --bg: #0f172a;
    --card: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --blue: #2563eb;
    --green: #4ade80;
    --red: #f87171;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

.dashboard {
    max-width: 860px;
    margin: auto;
    padding: 32px 20px;
}

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

header {
    margin-bottom: 24px;
}

h1 {
    font-size: 26px;
    margin: 0;
}

h2 {
    font-size: 19px;
    margin: 0 0 10px;
}

p {
    margin: 6px 0 14px;
}

.muted, small, footer {
    color: var(--muted);
}

.card, .login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 18px;
}

button, input {
    font: inherit;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 11px 15px;
    color: var(--text);
}

input {
    background: var(--bg);
    width: 100%;
    min-width: 0;
}

input:focus {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

button {
    background: var(--border);
    cursor: pointer;
    transition: filter .15s;
}

button:hover {
    filter: brightness(1.2);
}

button:disabled, input:disabled {
    opacity: .5;
    cursor: not-allowed;
}

button.primary {
    background: var(--blue);
    border-color: var(--blue);
    color: white;
}

.input-row, .actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.actions {
    flex-wrap: wrap;
}

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

.metrics > div {
    background: var(--bg);
    padding: 15px;
    border-radius: 10px;
}

.metrics small {
    display: block;
    margin-bottom: 5px;
}

.metrics strong {
    font-size: 18px;
    overflow-wrap: anywhere;
}

.domain-row, .diagnostic-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.domain-row span {
    overflow-wrap: anywhere;
}

.domain-row button {
    color: var(--red);
    padding: 5px 12px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 30px;
    flex-shrink: 0;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background: #475569;
    border-radius: 30px;
    pointer-events: none;
    transition: .2s;
}

.switch-slider::before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    left: 4px;
    top: 4px;
    background: white;
    border-radius: 50%;
    transition: .2s;
}

.switch input:checked + .switch-slider {
    background: #16a34a;
}

.switch input:checked + .switch-slider::before {
    transform: translateX(26px);
}

.switch input:focus-visible + .switch-slider {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}

.switch input:disabled + .switch-slider {
    opacity: .5;
}

.success {
    color: var(--green);
}

.error {
    color: var(--red);
}

#message:not(:empty) {
    padding: 14px;
    margin-bottom: 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
}

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

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-card h1 {
    font-size: 23px;
}

.login-card label {
    display: block;
    margin: 15px 0 6px;
}

.login-card button {
    width: 100%;
    margin-top: 24px;
}

.logo {
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #9333ea, #2563eb);
    border-radius: 15px;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

footer {
    text-align: center;
    font-size: 13px;
    padding: 12px;
}

@media (max-width: 600px) {
    .dashboard {
        padding: 18px 12px;
    }

    .card {
        padding: 18px;
    }

    h1 {
        font-size: 21px;
    }

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

    button, input {
        font-size: 16px;
    }
}


.all-domains-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 12px;
    font-weight: 600;
    cursor: pointer;
}

.all-domains-option input {
    width: 19px;
    height: 19px;
    margin: 0;
    accent-color: #2563eb;
    flex-shrink: 0;
}

#domain-list.inactive {
    opacity: 0.45;
}

button:disabled,
input:disabled {
    cursor: not-allowed;
}
