/* The front end's Material 3 theme, as the handful of values these pages actually use.
   mat.theme() with $azure-palette generates them into --mat-sys-* custom properties; there is no
   way to import that from a Razor page, so they are copied. Read them back out of the running
   application (getComputedStyle on :root) if the palette is ever changed - and change them here
   too, because a shell that is nearly the same reads worse than one that is openly different. */
:root {
    --surface: #faf9fd;
    --surface-container: #efedf0;
    --on-surface: #1a1b1f;
    --on-surface-variant: #44474e;
    --outline: #74777f;
    --outline-variant: #c4c6d0;
    --primary: #005cbb;
    --on-primary: #fff;

    /* What a Material button or menu item does under the pointer: the text colour at 8%. */
    --hover: rgba(26, 27, 31, 0.08);

    color-scheme: light;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    margin: 0;
    background: var(--surface);
    color: var(--on-surface);
    font-size: 0.875rem;
    line-height: 1.25rem;
}

/* The application's toolbar, matched down to its height and gutter: 64px tall, and half of the
   grid's 1.5rem gutter each side so the brand sits over the content below it. */
.topbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 64px;
    padding-inline: 0.75rem;
    background: var(--surface);
    color: var(--on-surface);
}

.brand {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    margin-right: 1rem;
}

.spacer {
    flex: 1 1 auto;
}

/* A Material text button, which is what the application's navigation entries are. */
.nav-link {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding-inline: 12px;
    border-radius: 9999px;
    color: inherit;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.00714em;
    white-space: nowrap;
    opacity: 0.85;
}

.nav-link:hover {
    background: var(--hover);
    opacity: 1;
}

main {
    display: flex;
    justify-content: center;
    padding: 2rem 1rem 3rem;
}

/* ---- account menu -------------------------------------------------------------------- */

.account {
    position: relative;
    margin-left: 0.25rem;
}

.account-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    color: var(--on-surface-variant);
    cursor: pointer;

    /* Both are needed to take the disclosure triangle off a <summary>. */
    list-style: none;
}

.account-trigger::-webkit-details-marker {
    display: none;
}

.account-trigger:hover {
    background: var(--hover);
}

.account-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 10;
    min-width: 12rem;
    max-width: 280px;
    overflow: hidden;
    background: var(--surface-container);
    color: var(--on-surface);
    border-radius: 4px;
    box-shadow:
        0 3px 1px -2px rgba(0, 0, 0, 0.2),
        0 2px 2px 0 rgba(0, 0, 0, 0.14),
        0 1px 5px 0 rgba(0, 0, 0, 0.12);
}

/* The heading of the menu: who you are, and where you are working. Not clickable, so it is
   deliberately not an item - it reads as a label rather than something that got disabled. */
.account-identity {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem 0.5rem;
}

.account-name {
    font-weight: 600;
    line-height: 1.3;
}

.account-organisation {
    color: var(--outline);
    font-size: 0.8rem;
    line-height: 1.3;
}

.account-divider {
    border: 0;
    border-top: 1px solid var(--outline-variant);
    margin: 8px 0;
}

/* One rule for the links and the sign-out button, which is a form control only because signing
   out is a POST - it must not look like anything other than the entries beside it. */
.account-item {
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    width: 100%;
    height: 48px;
    padding: 0 12px;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.account-item:hover {
    background: var(--hover);
}

.account-item .icon {
    flex: none;
    color: var(--on-surface-variant);
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}

.auth-card h1 {
    margin-top: 0;
    font-size: 1.4rem;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-card label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
    padding: 0.55rem 0.65rem;
    border: 1px solid #ccd0d9;
    border-radius: 6px;
    font-size: 1rem;
}

.auth-card .checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 400;
}

.auth-card button[type="submit"] {
    margin-top: 1rem;
    padding: 0.65rem;
    border: none;
    border-radius: 6px;
    background: #3452ff;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.auth-card button[type="submit"]:hover {
    background: #2a41d1;
}

.auth-card p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.error {
    color: #c0362c;
    font-size: 0.85rem;
}

.success {
    color: #1e7a45;
    font-size: 0.9rem;
}

.hint {
    color: #5b6070;
    font-size: 0.85rem;
}

/* Deliberately styled to look like a debug tool rather than a product feature,
   so it's obvious at a glance that this isn't part of the real sign-in UI. */
.dev-tools {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed #c8ccd6;
}

.dev-tools-label {
    color: #8a6d1f;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 0.5rem;
}

.auth-card .dev-button {
    width: 100%;
    margin-top: 0;
    padding: 0.5rem;
    border: 1px dashed #b8952f;
    border-radius: 6px;
    background: #fdf6e3;
    color: #6b5314;
    font-size: 0.9rem;
    cursor: pointer;
}

.auth-card .dev-button:hover {
    background: #f7ecd0;
}

/* ---- two-factor pages ---------------------------------------------------------------- */

/* The QR code is inline SVG sized by its container, so it scales without pixelation. */
.auth-card .qr svg {
    width: 12rem;
    height: 12rem;
    display: block;
    margin: 0.5rem 0;
}

.auth-card .steps {
    padding-left: 1.25rem;
    margin: 0 0 0.75rem;
}

.auth-card .steps li {
    margin-bottom: 0.35rem;
}

/* Shown exactly once, so they are set to be read and copied, not skimmed. */
.auth-card .recovery-codes {
    list-style: none;
    padding: 0.5rem 0.75rem;
    margin: 0 0 1rem;
    background: #f4f4f5;
    border-radius: 4px;
    columns: 2;
}

.auth-card .recovery-codes code {
    font-size: 0.95rem;
}

.auth-card .secondary {
    color: #52525b;
    font-size: 0.9rem;
}

/* The quieter siblings of the primary submit button, for actions beside the main one. */
.auth-card button.secondary {
    background: none;
    border: 1px solid #d4d4d8;
    color: #3f3f46;
}

.auth-card button.secondary:hover {
    background: #f4f4f5;
}

.auth-card .button-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #3452ff;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
}

/* ---- account self-service ---------------------------------------------------------- */

.auth-card h2 {
    font-size: 1.05rem;
    margin: 1.5rem 0 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e4e4e7;
}

/* ---- privacy policy ------------------------------------------------------------------ */

/* A document rather than a form. The card around it is .settings-panel, which it shares with every
   other section; what is left here is what makes a long text readable. */
.policy {
    line-height: 1.55;
}

.policy h1 {
    font-size: 1.5rem;
}

.policy li {
    margin-bottom: 0.35rem;
}

/* Unfilled facts refuse to blend in: the page must not look finished while it is not.
   Delete the class's last usage and this rule together, once a lawyer has signed off. */
.placeholder {
    background: #fdf0cd;
    color: #7a5c10;
    padding: 0 0.2rem;
    border-radius: 3px;
}

.policy-updated {
    margin-top: 2rem;
    color: #5b6070;
    font-size: 0.85rem;
}

.footer {
    text-align: center;
    padding: 0 1rem 2rem;
    font-size: 0.85rem;
}

.footer a {
    color: #5b6070;
}

/* ---- account settings ---------------------------------------------------------------- */

/* Navigation down the left, the panel beside it. The pages inside were separate cards reached
   through each other's prose; the shape is what makes them one place. Below 720px the navigation
   becomes a row above the panel rather than a column beside it - a phone has no left margin to
   spare, and the entries are few enough to sit in a line. */
.settings {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    gap: 1.5rem;
    width: 100%;
    max-width: 900px;
    align-items: start;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.settings-nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    color: #3f3f46;
    text-decoration: none;
    font-size: 0.95rem;
}

.settings-nav a:hover {
    background: #eceef4;
}

.settings-nav a.active {
    background: #e4e8ff;
    color: #2a41d1;
    font-weight: 600;
}

.settings-panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.75rem 2rem;
}

.settings-panel h1 {
    margin-top: 0;
    font-size: 1.4rem;
}

/* Same rhythm the auth card gives its sections, so a page moved in here does not change shape. */
.settings-panel h2 {
    font-size: 1.05rem;
    margin: 1.75rem 0 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e4e4e7;
}

.settings-panel form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
}

.settings-panel label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.settings-panel input[type="text"],
.settings-panel input[type="email"],
.settings-panel input[type="password"] {
    padding: 0.55rem 0.65rem;
    border: 1px solid #ccd0d9;
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
    max-width: 22rem;
}

.settings-panel .checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 400;
}

.settings-panel button {
    margin-top: 0.75rem;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 6px;
    background: #3452ff;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
}

.settings-panel button:hover {
    background: #2a41d1;
}

.settings-panel button.secondary {
    background: none;
    border: 1px solid #d4d4d8;
    color: #3f3f46;
}

.settings-panel button.secondary:hover {
    background: #f4f4f5;
}

.settings-panel .secondary {
    color: #52525b;
    font-size: 0.9rem;
}

.settings-panel .qr svg {
    width: 12rem;
    height: 12rem;
    display: block;
    margin: 0.5rem 0;
}

.settings-panel .recovery-codes {
    list-style: none;
    padding: 0.5rem 0.75rem;
    margin: 0 0 1rem;
    background: #f4f4f5;
    border-radius: 4px;
    columns: 2;
}

.settings-panel .steps {
    padding-left: 1.25rem;
    margin: 0 0 0.75rem;
}

.settings-panel .steps li {
    margin-bottom: 0.35rem;
}

.settings-panel .button-link {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: #3452ff;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
}

@media (max-width: 720px) {
    .settings {
        grid-template-columns: minmax(0, 1fr);
    }

    .settings-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* The privacy policy shares this shell but is readable before anybody signs in, so it renders
   without the navigation - and then the panel takes the width the two columns had. */
.settings-alone {
    grid-template-columns: minmax(0, 1fr);
    max-width: 760px;
}
