:root {
    color-scheme: light;
    --color-page: #f4f7f5;
    --color-surface: #fff;
    --color-surface-soft: #f8fbfa;
    --color-ink: #15201c;
    --color-muted: #68756f;
    --color-faint: #91a099;
    --color-line: #dbe5e0;
    --color-line-soft: #edf2ef;
    --color-primary: #7cda60;
    --color-primary-strong: #58bf3f;
    --color-primary-soft: #ddffdd;
    --color-primary-tint: #f2ffee;
    --color-warning: #b45309;
    --color-danger-bg: #fff2f0;
    --color-danger-line: #e7aca5;
    --color-danger-text: #8d2d22;
    --space-1: 4px;
    --space-2: 6px;
    --space-3: 10px;
    --space-4: 12px;
    --space-5: 14px;
    --space-6: 16px;
    --space-7: 18px;
    --space-8: 24px;
    --space-9: 28px;
    --space-10: 32px;
    --space-11: 56px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --shadow-panel: 0 18px 50px rgb(35 55 46 / 10%);
    --shadow-popover: 0 10px 28px rgb(35 55 46 / 18%);
    --z-tooltip: 20;
    --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--color-page);
    color: var(--color-ink);
    font-family: var(--font-sans);
    letter-spacing: 0;
}

.auth-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(360px, 480px) 1fr;
}

.auth-panel {
    display: grid;
    align-content: center;
    border-right: 1px solid var(--color-line);
    background: var(--color-surface);
    padding: var(--space-11);
}

.auth-panel__inner {
    width: 100%;
}

.auth-brand {
    display: flex;
    gap: var(--space-5);
    align-items: center;
    margin-bottom: var(--space-8);
}

.auth-brand__mark {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border-radius: var(--radius-md);
    background: #1c2a21;
}

.auth-brand__mark img {
    display: block;
    width: 30px;
    height: auto;
}

.auth-brand__eyebrow,
.auth-preview__eyebrow {
    margin: 0 0 var(--space-1);
    color: var(--color-faint);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.auth-brand__title {
    margin: 0;
    color: var(--color-ink);
    font-size: 28px;
    line-height: 1.15;
    font-weight: 800;
}

.auth-brand__description {
    max-width: 360px;
    margin: 0 0 var(--space-9);
    color: var(--color-muted);
    font-size: 16px;
    line-height: 1.5;
}

.alert {
    margin-bottom: var(--space-7);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--color-danger-line);
    border-radius: var(--radius-md);
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    font-size: 14px;
}

.form-stack {
    display: grid;
    gap: var(--space-3);
    max-width: 368px;
}

.form-stack__label {
    margin-top: var(--space-2);
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 760;
}

.form-stack__control {
    width: 100%;
    min-height: 42px;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    background: var(--color-surface-soft);
    color: var(--color-ink);
    font: inherit;
}

.form-stack__control:focus {
    border-color: var(--color-primary);
    outline: 0;
    box-shadow: 0 0 0 4px rgb(124 218 96 / 22%);
}

.form-stack__hint {
    margin: 0;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.5;
}

/* A note that follows the form rather than sitting inside its grid. */
.form-stack + .form-stack__hint {
    margin-top: var(--space-6);
}

/* Validation messages, as the form component renders them: a list per field. */
.form-stack ul {
    margin: 0;
    padding-left: var(--space-6);
    color: var(--color-danger-text);
    font-size: 13px;
    line-height: 1.5;
}

/*
    Password policy: the rules the validator enforces, plus a meter that runs the
    same scoring the server does. Rules render without JavaScript; the meter is
    revealed by the script, so it is `hidden` until then.
*/
.password-policy {
    position: relative;
    display: grid;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--color-line-soft);
    border-radius: var(--radius-sm);
    background: var(--color-surface-soft);
}

/* Bar across the top, then the rating and the help marker sharing a row. */
.password-policy__meter {
    --meter-fill: var(--color-warning);

    display: grid;
    gap: var(--space-2);
    margin: 0;
    grid-template-areas:
        "bar bar"
        "rating help";
    grid-template-columns: 1fr auto;
    align-items: center;
}

.password-policy__bar {
    display: grid;
    gap: var(--space-1);
    grid-area: bar;
    grid-template-columns: repeat(4, 1fr);
}

.password-policy__bar i {
    height: 4px;
    border-radius: 999px;
    background: var(--color-line);
}

/*
    Segments light up to the current score. The colour says whether the bar has
    been cleared, not how high the score is - so it follows the policy rather
    than a number baked into this file.
*/
.password-policy__meter[data-met="true"] {
    --meter-fill: var(--color-primary-strong);
}

.password-policy__meter[data-score="1"] .password-policy__bar i:nth-child(-n + 1),
.password-policy__meter[data-score="2"] .password-policy__bar i:nth-child(-n + 2),
.password-policy__meter[data-score="3"] .password-policy__bar i:nth-child(-n + 3),
.password-policy__meter[data-score="4"] .password-policy__bar i {
    background: var(--meter-fill);
}

.password-policy__rating {
    grid-area: rating;
    color: var(--meter-fill);
    font-size: 12px;
    font-weight: 760;
    min-height: 18px;
}

/*
    The footnote nobody needs twice: a marker next to the rating, opening the
    explanation on hover, on keyboard focus, and on tap.
*/
.password-policy__help {
    display: flex;
    grid-area: help;
}

.password-policy__help-trigger {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid var(--color-line);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-muted);
    cursor: help;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.password-policy__help-trigger:hover,
.password-policy__help-trigger:focus-visible {
    border-color: var(--color-primary);
    color: var(--color-ink);
    outline: 0;
    box-shadow: 0 0 0 3px rgb(124 218 96 / 22%);
}

/*
    Anchored to the panel rather than to the marker, so it can never be pushed
    off the edge of a narrow screen.
*/
.password-policy__tooltip {
    position: absolute;
    z-index: var(--z-tooltip);
    right: 0;
    bottom: calc(100% + var(--space-2));
    left: 0;
    padding: var(--space-4);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    box-shadow: var(--shadow-popover);
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    /* It sits over the password field, so it must never swallow a click. */
    pointer-events: none;
    transition: opacity 120ms ease;
}

/*
    `:focus` rather than `:focus-visible`, because a tap on a touch screen gives
    the button focus but not focus-visible - and a touch screen has no hover at
    all, so this is the only way in on a phone.
*/
.password-policy__help:hover .password-policy__tooltip,
.password-policy__help-trigger:focus + .password-policy__tooltip {
    opacity: 1;
    visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
    .password-policy__tooltip {
        transition: none;
    }
}

.password-policy__rules {
    display: grid;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
    padding-left: 0 !important;
}

.password-policy__rule {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: 14px 1fr;
    align-items: baseline;
    color: var(--color-muted);
    font-size: 13px;
    line-height: 1.5;
}

/* A dot until the script has an opinion, then a tick or a cross. */
.password-policy__rule::before {
    content: "•";
    color: var(--color-faint);
    font-weight: 800;
    text-align: center;
}

.password-policy__rule[data-state="met"] {
    color: var(--color-ink);
}

.password-policy__rule[data-state="met"]::before {
    content: "✓";
    color: var(--color-primary-strong);
}

.password-policy__rule[data-state="unmet"]::before {
    content: "✗";
    color: var(--color-warning);
}

/* Said by the script before submitting; the validator says the same after. */
.form-stack__mismatch {
    margin: 0;
    color: var(--color-danger-text);
    font-size: 13px;
    line-height: 1.5;
}

/* Quiet text link under a form: sign-in and forgot-password point at each other. */
.auth-link {
    color: var(--color-muted);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-link:hover,
.auth-link:focus {
    color: var(--color-ink);
}

.button {
    min-height: 42px;
    margin-top: var(--space-4);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: #10210e;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.button:hover,
.button:focus {
    border-color: var(--color-primary-strong);
    background: var(--color-primary-strong);
}

.button--link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-6);
    text-decoration: none;
}

.access-denied-detail {
    display: grid;
    max-width: 420px;
    gap: var(--space-2);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-md);
    background: var(--color-surface-soft);
    padding: var(--space-5);
}

.access-denied-detail__label {
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 760;
}

.access-denied-detail__path {
    overflow-wrap: anywhere;
    color: var(--color-ink);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 13px;
}

.access-denied-actions {
    margin-top: var(--space-6);
}

.access-denied-preview {
    min-height: 220px;
}

.auth-visual {
    display: grid;
    place-items: center;
    padding: var(--space-11);
    background:
        linear-gradient(90deg, rgb(255 255 255 / 70%) 0 1px, transparent 1px 100%),
        linear-gradient(180deg, rgb(255 255 255 / 70%) 0 1px, transparent 1px 100%),
        var(--color-page);
    background-size: 36px 36px;
}

.auth-preview {
    width: min(760px, 100%);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-panel);
    padding: var(--space-8);
}

.auth-preview__header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: var(--space-8);
}

.auth-preview h2 {
    margin: 0;
    color: var(--color-ink);
    font-size: 26px;
    line-height: 1.15;
}

.auth-preview__header span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    border-radius: 999px;
    background: var(--color-primary-tint);
    color: #327a25;
    padding: var(--space-2) var(--space-4);
    font-size: 12px;
    font-weight: 800;
}

.auth-preview__header span::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.auth-preview__bars {
    display: flex;
    height: 220px;
    align-items: end;
    gap: var(--space-6);
    margin-top: var(--space-8);
    border-bottom: 1px solid var(--color-line);
    padding: 0 var(--space-3) var(--space-8);
}

.auth-preview__bars i {
    flex: 1;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: linear-gradient(180deg, var(--color-primary), #9eed8a);
}

.auth-preview__bars i:nth-child(1) {
    height: 48%;
}

.auth-preview__bars i:nth-child(2) {
    height: 66%;
}

.auth-preview__bars i:nth-child(3) {
    height: 38%;
}

.auth-preview__bars i:nth-child(4) {
    height: 84%;
}

.auth-preview__bars i:nth-child(5) {
    height: 58%;
}

.auth-preview__bars i:nth-child(6) {
    height: 74%;
}

@media (max-width: 900px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }

    .auth-panel {
        min-height: 100vh;
        border-right: 0;
        padding: var(--space-8);
    }

    .auth-visual {
        display: none;
    }
}
