:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    background: #10141b;
    color: #eef3f6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
}

.shell {
    width: min(960px, calc(100% - 32px));
    margin: 0 auto;
    padding: 56px 0;
}

header {
    margin-bottom: 28px;
}

.eyebrow,
.label {
    color: #7fd8c0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

h1 {
    margin: 6px 0;
    font-size: clamp(2rem, 5vw, 3.4rem);
    letter-spacing: -0.045em;
}
h2 {
    margin: 0 0 6px;
    font-size: 1.1rem;
}
p {
    color: #aebbc5;
    line-height: 1.55;
}
.lede {
    max-width: 600px;
    margin: 0;
}

.card {
    background: #1a212b;
    border: 1px solid #2a3745;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 45px rgb(0 0 0 / 0.16);
}
.actions {
    margin-bottom: 20px;
}
.sign-in-card {
    width: min(100%, 460px);
}
.sign-in-card form {
    display: grid;
    gap: 8px;
    margin-top: 20px;
}
.sign-in-card label {
    display: block;
    color: #aebbc5;
    font-size: 0.88rem;
}
.sign-in-card input {
    width: 100%;
    margin-bottom: 8px;
}
.sign-in-card button {
    justify-self: start;
    margin-top: 8px;
}
.management-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}
.management-header .message {
    margin: 0;
}
.text-button {
    color: #aebbc5;
    background: transparent;
    padding: 6px 0;
}
.key-row,
.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
input {
    min-width: 220px;
    flex: 1;
    background: #10141b;
    border: 1px solid #3a4a59;
    border-radius: 9px;
    color: inherit;
    padding: 11px 12px;
    font: inherit;
}
button {
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    padding: 11px 15px;
    color: #10201c;
    background: #7fd8c0;
    font: 700 0.9rem/1.2 inherit;
}
button.secondary {
    background: #dbe7ef;
}
button.danger {
    background: #f4a7a1;
}
button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.state-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    text-transform: capitalize;
}
.state-header {
    margin-bottom: 20px;
}
.state-header .label {
    margin: 0;
}
.state-actions {
    gap: 12px;
    justify-content: flex-end;
}
.state-actions button {
    min-width: 120px;
}
.status-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #80909d;
}
.status-connected {
    background: #5fdaa8;
    box-shadow: 0 0 0 5px rgb(95 218 168 / 0.16);
}
.status-awaiting_scan,
.status-connecting,
.status-reconnecting {
    background: #f3c86b;
}
.status-disconnected,
.status-logged_out,
.status-error,
.status-retry_exhausted,
.status-shutting_down {
    background: #ec8079;
}
dl {
    margin: 24px 0 0;
}
dl div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 0;
    border-top: 1px solid #2a3745;
}
dt {
    color: #aebbc5;
}
dd {
    margin: 0;
    text-align: right;
}
.qr-auth {
    display: grid;
    place-items: center;
    margin-top: 24px;
    border-top: 1px solid #2a3745;
    padding-top: 20px;
}
.qr-auth[hidden] {
    display: none;
}
.qr-auth .label {
    justify-self: start;
    width: 100%;
    text-align: left;
}
#qr {
    width: min(100%, 320px);
    aspect-ratio: 1;
    border-radius: 10px;
    background: white;
    padding: 10px;
    image-rendering: pixelated;
}
.actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    align-items: center;
}
.actions .message {
    grid-column: 1 / -1;
}
.message {
    min-height: 1.4em;
    margin: 12px 0 0;
    font-size: 0.9rem;
}
.error {
    color: #ffaaa4;
}

@media (max-width: 700px) {
    .shell {
        padding: 32px 0;
    }
    .grid,
    .actions {
        grid-template-columns: 1fr;
    }
    .management-header {
        align-items: flex-start;
    }
    .button-row {
        width: 100%;
    }
    .button-row button {
        flex: 1;
    }
    .state-actions button {
        min-width: 0;
    }
    .state-actions {
        justify-content: flex-start;
    }
}
