:root {
    color-scheme: dark;
    --background: #10141b;
    --panel: #191f29;
    --border: #303946;
    --text: #e7ebf2;
    --muted: #98a4b6;
    --accent: #4c8df6;
    --green: #4ade80;
    --red: #f87171;
    --yellow: #fbbf24;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font: 15px/1.55 system-ui, sans-serif;
}

h1, h2, p { margin-top: 0; }

h1 { font-size: 26px; margin-bottom: 6px; }
h2 { font-size: 18px; margin-bottom: 16px; }

a { color: #83b1ff; }

button, input, textarea {
    font: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
}

button {
    background: #252e3b;
    padding: 10px 15px;
    cursor: pointer;
    min-height: 42px;
}

button:hover { background: #344154; }

button:disabled {
    opacity: .5;
    cursor: wait;
}

button.primary {
    background: #2867cf;
    border-color: #397be6;
    color: white;
    font-weight: 600;
}

button.primary:hover { background: #3479e7; }

button.danger { color: var(--red); }

input, textarea {
    display: block;
    background: #111720;
    padding: 12px;
    width: 100%;
    margin: 8px 0 16px;
    font-size: 16px;
}

textarea { resize: vertical; }

label { display: block; font-weight: 500; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.message { color: var(--yellow); overflow-wrap: anywhere; }
.message:empty { display: none; }

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

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 32px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-align: center;
}

.login-card button { width: 100%; margin: 10px 0; }
.login-card label { text-align: left; }

.brand-icon {
    background: #245fc0;
    color: white;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 800;
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    margin: 0 auto 24px;
}

.brand-icon.compact {
    width: 42px;
    height: 42px;
    font-size: 13px;
    border-radius: 9px;
    margin: 0;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.brand, .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navigation {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 12px 28px;
    border-bottom: 1px solid var(--border);
}

.navigation button {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.navigation button.selected {
    background: #25344d;
    color: #a9caff;
}

main {
    max-width: 1280px;
    margin: auto;
    padding: 28px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

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

.metric, .panel, .website {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
}

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

.metric strong {
    display: block;
    font-size: 25px;
    margin-top: 5px;
}

.panel { margin-bottom: 16px; }

.website-list {
    display: grid;
    gap: 12px;
}

.website-heading, .record {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.website-heading a {
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.website-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
    font-size: 13px;
}

.website-details div {
    overflow-wrap: anywhere;
}

.website-details span {
    display: block;
    color: var(--muted);
}

.status {
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
}

.status.up { color: var(--green); }
.status.redirect { color: #83b1ff; }
.status.down { color: var(--red); }
.status.pending { color: var(--muted); }
.status.degraded, .status.tls-error { color: var(--yellow); }

.record {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere;
}

.record:last-child { border-bottom: none; }

footer {
    padding: 24px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 650px) {
    .header { padding: 14px; }
    .navigation { padding: 8px 12px; }
    .navigation button { padding: 10px 12px; }
    main { padding: 16px; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric { padding: 14px; }
    .metric strong { font-size: 22px; }
    .website-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .website { padding: 14px; }
    #account-name { display: none; }
    .brand .small { display: none; }
    .login-card { padding: 24px; }
}

/* CNC website management controls */

.button-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.website-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.website-actions button {
    min-height: 36px;
    padding: 7px 14px;
    font-size: 13px;
}

select {
    display: block;
    width: 100%;
    margin: 8px 0 16px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #111720;
    color: var(--text);
    font: inherit;
    font-size: 16px;
}

dialog {
    width: min(480px, calc(100% - 32px));
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel);
    color: var(--text);
}

dialog::backdrop {
    background: rgba(0, 0, 0, .75);
}

.dialog-actions {
    justify-content: flex-end;
    margin-top: 20px;
}

button.danger-solid {
    background: #a32929;
    border-color: #c44343;
    color: white;
}

button.danger-solid:hover {
    background: #bc3535;
}

.domain-warning {
    color: var(--red);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.activity-list {
    margin-top: 16px;
}

.activity-entry {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.activity-entry:last-child {
    border-bottom: none;
}

.activity-entry pre {
    font-size: 12px;
    color: var(--muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.activity-entry details {
    margin-top: 8px;
}

@media (max-width: 650px) {
    .page-heading {
        flex-wrap: wrap;
    }

    .page-heading .button-group {
        width: 100%;
    }

    .page-heading .button-group button {
        flex: 1;
    }

    dialog {
        padding: 20px;
    }

    .dialog-actions button {
        flex: 1;
    }
}

/* LXC container telemetry */

.telemetry-value {
    font-size: 1.55rem;
    font-weight: 650;
    margin: 8px 0;
    font-variant-numeric: tabular-nums;
}

.telemetry-progress {
    display: block;
    width: 100%;
    height: 8px;
    margin-top: 12px;
    appearance: none;
    border: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #303946;
    accent-color: #4c8df6;
}

.telemetry-progress::-webkit-progress-bar {
    background: #303946;
    border-radius: 6px;
}

.telemetry-progress::-webkit-progress-value {
    background: #4c8df6;
    border-radius: 6px;
}

.telemetry-progress::-moz-progress-bar {
    background: #4c8df6;
    border-radius: 6px;
}

.telemetry-section {
    margin-top: 20px;
    margin-bottom: 24px;
}

.telemetry-section h2 {
    font-size: 1.05rem;
    margin-bottom: 12px;
}

.telemetry-service {
    padding: 14px;
    margin: 10px 0;
    border: 1px solid #303946;
    border-radius: 9px;
    background: #191f29;
}

.telemetry-service .website-heading {
    margin-bottom: 10px;
}

/* Independent certificate and website health */

.website-status-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
}

.tls-status {
    font-size: .75rem;
    font-weight: 600;
    color: #a5adba;
}

.tls-valid {
    color: #4ade80;
}

.tls-provisioning,
.tls-renewing {
    color: #60a5fa;
}

.tls-retrying,
.tls-renewal-retry {
    color: #fbbf24;
}

.tls-tls-error,
.tls-expired {
    color: #f87171;
}

.certificate-details {
    margin: 12px 0;
    padding: 10px 0;
    border-top: 1px solid #303946;
    border-bottom: 1px solid #303946;
}

.certificate-details summary {
    cursor: pointer;
    color: #a5adba;
    font-size: .85rem;
}

.certificate-details .website-details {
    margin-top: 12px;
    overflow-wrap: anywhere;
}

