/* RSY brand: the logo's red, with its gold as an accent. */
:root {
    --primary: #c8102e;
    --primary-hover: #a50d26;
    --button: #c8102e;
    --button-hover: #a50d26;
    --accent: #c99a1a;
    --accent-text: #7a5800;
    --text: #242424;
    --muted: #616161;
    --border: #d1d1d1;
    --surface: #ffffff;
    --background: #f5f3f1;
    --danger: #b3261e;
    --danger-soft: #fdecea;
    --success: #107c10;
    --glow-primary: rgba(200, 16, 46, 0.08);
    --glow-accent: rgba(201, 154, 26, 0.12);
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #ff7b7f;
        --primary-hover: #ff9a9d;
        --button: #c8102e;
        --button-hover: #a50d26;
        --accent: #d9ad3c;
        --accent-text: #e3bb55;
        --text: #f0f0f0;
        --muted: #adadad;
        --border: #424242;
        --surface: #262524;
        --background: #181716;
        --danger: #ff8a80;
        --danger-soft: #3a1f1d;
        --success: #54b054;
        --glow-primary: rgba(229, 72, 77, 0.10);
        --glow-accent: rgba(217, 173, 60, 0.07);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 14px;
    color: var(--text);
    background:
        radial-gradient(900px 520px at 0% 0%, var(--glow-primary), transparent 70%),
        radial-gradient(800px 480px at 100% 100%, var(--glow-accent), transparent 70%),
        var(--background);
}

.card {
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 420px;
    padding: 32px 32px 32px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 12px 36px rgba(0, 0, 0, 0.12);
}

/* The brand's red-to-gold accent along the top of every card. */
.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.card.wide {
    max-width: 980px;
}

header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

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

.brand img {
    display: block;
    width: auto;
    height: 72px;
}

.brand span {
    padding-left: 12px;
    border-left: 1px solid var(--border);
    font-size: 18px;
    color: var(--muted);
}

/* The logo's dark-grey lettering needs a light background in dark mode. */
@media (prefers-color-scheme: dark) {
    .brand img {
        padding: 4px 6px;
        border-radius: 6px;
        background: #ffffff;
    }
}

/* Signed-out pages (sign-in, password reset, setup): the logo centred above the title. */
.card.auth header {
    justify-content: center;
    margin-bottom: 22px;
}

.card.auth .brand img {
    height: 96px;
}

.card.auth .brand span {
    display: none;
}

.card.auth h1 {
    margin-bottom: 6px;
    text-align: center;
}

.lead {
    margin: 0 0 22px;
    color: var(--muted);
    text-align: center;
}

.lead strong {
    color: var(--text);
}

/* ---------------------------------------------------------------- sign-in form */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field > label,
.label-row label {
    font-weight: 600;
}

.label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.label-row a {
    font-size: 13px;
}

.password {
    position: relative;
    display: flex;
}

.password input {
    flex: 1;
    min-width: 0;
    padding-right: 64px;
}

.password .reveal {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: transparent;
    border-radius: 4px;
}

.password .reveal:hover {
    background: var(--background);
}

.hint {
    margin: 0;
    font-size: 13px;
    color: var(--accent-text);
    font-weight: 600;
}

button.block {
    width: 100%;
    padding: 11px 16px;
    font-size: 15px;
}

button:disabled {
    cursor: progress;
    opacity: 0.75;
}

.secure-note {
    margin: 18px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

nav {
    display: flex;
    gap: 14px;
}

h1 {
    margin: 0 0 16px;
    font-size: 22px;
    font-weight: 600;
}

h2 {
    margin: 24px 0 8px;
    font-size: 16px;
    font-weight: 600;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

form.inline {
    display: inline-flex;
    flex-direction: row;
    gap: 6px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 600;
}

label.check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

input[type=email], input[type=password], input[type=text], textarea, select {
    padding: 8px 10px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-color: var(--muted);
    border-radius: 6px;
}

/* Signed-out pages: roomier fields; 16px text stops phones from zooming into a field. */
.card.auth input[type=email], .card.auth input[type=password], .card.auth input[type=text] {
    padding: 11px 12px;
    font-size: 16px;
}

input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}

input.input-validation-error {
    border-color: var(--danger);
}

button:focus-visible, a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button {
    padding: 8px 16px;
    font: inherit;
    font-weight: 600;
    color: #ffffff;
    background: var(--button);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background: var(--button-hover);
}

button.secondary {
    padding: 4px 10px;
    font-weight: 400;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border);
}

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

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

.error, .field-validation-error, .validation-summary-errors {
    color: var(--danger);
}

.field-validation-error {
    font-size: 13px;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 18px;
}

/* Form-level errors (e.g. a wrong password) as an alert box. */
.alert.validation-summary-errors {
    padding: 10px 12px;
    border: 1px solid var(--danger);
    border-left-width: 4px;
    border-radius: 6px;
    background: var(--danger-soft);
}

.alert.validation-summary-errors ul {
    padding: 0;
    list-style: none;
}

.alert.validation-summary-valid {
    display: none;
}

.notice {
    padding: 10px 12px;
    border-radius: 4px;
    border-left: 4px solid var(--success);
    background: var(--background);
}

.notice.warning {
    border-left-color: var(--danger);
}

.link-box {
    padding: 8px;
    border: 1px dashed var(--border);
    border-radius: 4px;
    word-break: break-all;
    font-family: Consolas, monospace;
    font-size: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 8px 6px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--muted);
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    background: var(--background);
    border: 1px solid var(--border);
}

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

.badge.success {
    color: var(--success);
    border-color: var(--success);
}

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

.danger-zone {
    align-items: center;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* Destructive actions are outlined, so they never look like the (red) primary button. */
button.danger {
    padding: 4px 10px;
    font-weight: 600;
    color: var(--danger);
    background: transparent;
    border: 1px solid var(--danger);
}

button.danger:hover {
    background: var(--danger-soft);
}

.button-link {
    align-self: center;
    padding: 8px 4px;
}

.fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

textarea {
    resize: vertical;
    font-family: Consolas, monospace;
    font-size: 12px;
}

code, td.uris {
    font-family: Consolas, monospace;
    font-size: 12px;
    word-break: break-all;
}

footer {
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 640px) {
    .card {
        padding: 20px 16px 24px;
    }

    table, thead, tbody, tr, th, td {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        padding: 8px 0;
        border-bottom: 1px solid var(--border);
    }

    td {
        border: none;
        padding: 2px 0;
    }
}
