@import url('mcg-theme-tokens.css');

/*
 * Shared sign-in shell for the non-client sign-in pages.
 *
 * Draws the card, the fields, one primary action, a quiet link row, the
 * error line and the Show/Hide password toggle. Semantic MCG tokens only
 * (docs/ui-design-tokens.md §1, §8): a product supplies its logo and name,
 * never a button colour. Light/dark follow data-theme on <html>, set by
 * libs/admin-appearance.min.js. Pages keep their own element ids and logic.
 */

.auth-shell-page {
    align-items: center;
    background: var(--color-surface-bg);
    color: var(--color-text-1);
    display: flex;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    justify-content: center;
    margin: 0;
    min-height: 100vh;
    padding: 24px;
}

.auth-shell,
.auth-shell * {
    box-sizing: border-box;
}

.auth-shell {
    background: var(--color-surface-1);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    box-shadow: 0 30px 80px var(--color-shadow);
    color: var(--color-text-1);
    margin: 0 auto;
    max-width: 440px;
    padding: 40px 32px;
    width: 100%;
}

.auth-shell-brand {
    margin-bottom: 28px;
    text-align: center;
}

.auth-shell-logo {
    display: block;
    height: auto;
    margin: 0 auto 16px;
    max-height: 56px;
    max-width: 220px;
    object-fit: contain;
    width: auto;
}

.auth-shell-logo[hidden],
.auth-shell-logo:not([src]) {
    display: none;
}

.auth-shell-product {
    color: var(--color-text-2);
    font-size: 15px;
    font-weight: 500;
    margin: 0 0 4px;
}

.auth-shell-title {
    color: var(--color-text-1);
    font-size: 24px;
    font-weight: 650;
    line-height: 1.25;
    margin: 0;
}

/* Error line: what failed and the way out. Stays until the next attempt. */
.auth-shell-error {
    background: var(--status-danger-soft);
    border: 1px solid var(--color-action-danger-border);
    border-radius: 10px;
    color: var(--status-danger-text);
    display: block;
    font-size: 15px;
    line-height: 1.4;
    margin: 0 0 20px;
    padding: 12px 16px;
}

.auth-shell-error:empty,
.auth-shell-error[hidden] {
    display: none;
}

.auth-shell-field {
    display: block;
    margin-bottom: 20px;
}

.auth-shell-label {
    color: var(--color-text-2);
    display: block;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: normal;
    margin-bottom: 8px;
    text-transform: none;
}

.auth-shell-input {
    background: var(--color-field);
    border: 1px solid var(--color-control-border);
    border-radius: 12px;
    color: var(--color-text-1);
    font: inherit;
    font-size: 16px;
    margin: 0;
    min-height: 48px;
    padding: 12px 16px;
    width: 100%;
}

.auth-shell-input::placeholder {
    color: var(--color-text-3);
}

.auth-shell-input:focus-visible {
    border-color: var(--color-focus);
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

.auth-shell-password {
    position: relative;
}

.auth-shell-password .auth-shell-input {
    padding-right: 96px;
}

.auth-shell-toggle {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--color-text-2);
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    min-height: 44px;
    min-width: 64px;
    padding: 0 12px;
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.auth-shell-toggle:hover {
    background: var(--color-hover);
    color: var(--color-text-1);
}

.auth-shell-toggle:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

/* One primary action per screen. */
.auth-shell-submit {
    background: var(--color-action-primary);
    border: none;
    border-radius: 12px;
    color: var(--color-action-primary-text);
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    font-weight: 650;
    margin-top: 4px;
    min-height: 48px;
    padding: 12px 16px;
    width: 100%;
}

.auth-shell-submit:hover {
    background: var(--color-action-primary-hover);
}

.auth-shell-submit:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 3px;
}

.auth-shell-submit:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

/* Quiet link row. Every link is a 44 px line box. */
.auth-shell-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 16px;
    justify-content: center;
    margin-top: 16px;
}

.auth-shell-links a,
.auth-shell-link {
    align-items: center;
    border-radius: 8px;
    color: var(--color-action-primary);
    display: inline-flex;
    font-size: 15px;
    min-height: 44px;
    padding: 0 8px;
    text-decoration: none;
}

.auth-shell-links a:hover,
.auth-shell-link:hover {
    text-decoration: underline;
}

.auth-shell-links a:focus-visible,
.auth-shell-link:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

/* Forms and actions that a page script builds inside the shell (onboard.js). */
.auth-shell [hidden] {
    display: none !important;
}

.auth-shell form label {
    color: var(--color-text-2);
    display: block;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 8px;
}

.auth-shell form input:not([type="checkbox"]):not([type="radio"]) {
    background: var(--color-field);
    border: 1px solid var(--color-control-border);
    border-radius: 12px;
    color: var(--color-text-1);
    font: inherit;
    font-size: 16px;
    margin-bottom: 16px;
    min-height: 48px;
    padding: 12px 16px;
    width: 100%;
}

.auth-shell form input[aria-invalid="true"] {
    border-color: var(--color-action-danger-border);
}

/*
 * Show/Hide is in the vertical centre of its field. The rule above puts
 * 16 px under every form input. Inside the password wrapper, that margin
 * made the wrapper 16 px taller than the field, and the toggle sat 8 px
 * low. The wrapper keeps the gap, so the field and the toggle share one box.
 */
.auth-shell form .auth-shell-password input.auth-shell-input {
    margin-bottom: 0;
}

.auth-shell form .auth-shell-password {
    margin-bottom: 16px;
}

.auth-shell .primary {
    background: var(--color-action-primary);
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--color-action-primary-text);
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    font-weight: 650;
    min-height: 48px;
    overflow-wrap: anywhere;
    padding: 12px 16px;
    width: 100%;
}

.auth-shell .primary:hover {
    background: var(--color-action-primary-hover);
}

.auth-shell .secondary {
    background: transparent;
    border: 1px solid var(--color-control-border);
    border-radius: 12px;
    color: var(--color-text-1);
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    min-height: 48px;
    overflow-wrap: anywhere;
    padding: 12px 16px;
    width: 100%;
}

.auth-shell .secondary:hover {
    background: var(--color-hover);
}

.auth-shell .password-toggle {
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--color-text-2);
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    margin: -8px 0 12px;
    min-height: 44px;
    padding: 0 8px;
    text-decoration: underline;
}

.auth-shell button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.auth-shell button:focus-visible,
.auth-shell select:focus-visible,
.auth-shell input:focus-visible,
.auth-shell a:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 3px;
}

.auth-shell .subtitle {
    color: var(--color-text-2);
    font-size: 15px;
    line-height: 1.5;
    margin: 8px 0 24px;
    overflow-wrap: anywhere;
}

.auth-shell .subtitle:empty {
    display: none;
}

.auth-shell .hint {
    color: var(--color-text-2);
    font-size: 14px;
    line-height: 1.5;
    margin: -8px 0 20px;
}

/* Page status line: what happened and the way out. */
.auth-shell .message {
    border: 1px solid currentColor;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 20px;
    overflow-wrap: anywhere;
    padding: 12px 16px;
}

.auth-shell .message.info {
    color: var(--color-text-2);
}

.auth-shell .message.error {
    background: var(--status-danger-soft);
    color: var(--status-danger-text);
}

.auth-shell .message.ok {
    background: var(--status-success-soft);
    color: var(--status-success-text);
}

.auth-shell .message.warning {
    background: var(--status-warning-soft);
    color: var(--status-warning-text);
}

.auth-shell-actions {
    display: grid;
    gap: 12px;
}

.auth-shell-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

@media (max-width: 480px) {
    .auth-shell-page {
        padding: 16px;
    }

    .auth-shell {
        border-radius: 16px;
        padding: 28px 20px;
    }
}

/* ========================================================================
 * The brand sign-in: body.auth-brand (sign-in.html)
 *
 * Desktop and web redesign, mockup 08, approved by Robert on 2026-11-19.
 * One column of 400 px in the centre of the window, with no card. The
 * colours are the family palette of the client portal (css/client-portal.css,
 * the mockup TOKENS), set on the MCG tokens that this file reads:
 *   Malka dark:  navy-black page, orange main button with navy text.
 *   Malka light: light grey page, the same orange button.
 *   Maple dark:  near-black page, white main button, Maple red brand.
 *   Maple light: white page, black main button, Maple red brand.
 * shared/web-brand.js sets data-tenant and data-admin-brand on <html> before
 * the first paint, and libs/admin-appearance.min.js sets data-theme. Pages
 * without body.auth-brand keep the neutral look above.
 * ======================================================================== */
body.auth-brand {
    --color-surface-bg: #0A0A1A;
    --color-surface-1: #0A0A1A;
    --color-surface-2: #212439;
    --color-field: #16182B;
    --color-border: #272A41;
    --color-control-border: #363A55;
    --color-text-1: #F4F4F7;
    --color-text-2: #A6A9BA;
    --color-text-3: #6F7391;
    --color-hover: #212439;
    --color-focus: #F47D22;
    --color-action-primary: #F47D22;
    --color-action-primary-hover: #FF8F3A;
    --color-action-primary-text: #0D1A38;
    --status-danger-text: #FF6B6B;
    --status-danger-soft: rgba(255, 107, 107, 0.12);
    /* The text links and Show/Hide, and the Maple leaf. */
    --auth-brand-link: #F7934A;
    --auth-brand-leaf: #F47D22;
    color-scheme: dark;
}

[data-theme="light"] body.auth-brand {
    --color-surface-bg: #F6F7FA;
    --color-surface-1: #F6F7FA;
    --color-surface-2: #E8EAF0;
    --color-field: #FFFFFF;
    --color-border: #DFE2EA;
    --color-control-border: #C9CDD9;
    --color-text-1: #0D1A38;
    --color-text-2: #545A73;
    --color-text-3: #8C91A7;
    --color-hover: #E8EAF0;
    --color-focus: #F47D22;
    --color-action-primary: #F47D22;
    --color-action-primary-hover: #E5701A;
    --color-action-primary-text: #0D1A38;
    --status-danger-text: #C62828;
    --status-danger-soft: #FDECEC;
    --auth-brand-link: #A84A00;
    --auth-brand-leaf: #F47D22;
    color-scheme: light;
}

[data-tenant="maple"] body.auth-brand {
    --color-surface-bg: #0B0B0B;
    --color-surface-1: #0B0B0B;
    --color-surface-2: #262626;
    --color-field: #1A1A1A;
    --color-border: #2A2A2A;
    --color-control-border: #3A3A3A;
    --color-text-1: #F5F5F5;
    --color-text-2: #B3B3B3;
    --color-text-3: #7A7A7A;
    --color-hover: #262626;
    --color-focus: #E0262B;
    --color-action-primary: #FFFFFF;
    --color-action-primary-hover: #E8E8E8;
    --color-action-primary-text: #0B0B0B;
    --status-danger-text: #FF6B6B;
    --status-danger-soft: rgba(255, 107, 107, 0.12);
    --auth-brand-link: #FF6166;
    --auth-brand-leaf: #E0262B;
    color-scheme: dark;
}

[data-tenant="maple"][data-theme="light"] body.auth-brand {
    --color-surface-bg: #FFFFFF;
    --color-surface-1: #FFFFFF;
    --color-surface-2: #EEEEEE;
    --color-field: #FFFFFF;
    --color-border: #E4E4E4;
    --color-control-border: #CFCFCF;
    --color-text-1: #0B0B0B;
    --color-text-2: #5E5E5E;
    --color-text-3: #8F8F8F;
    --color-hover: #EEEEEE;
    --color-focus: #A90000;
    --color-action-primary: #0B0B0B;
    --color-action-primary-hover: #2A2A2A;
    --color-action-primary-text: #FFFFFF;
    --status-danger-text: #C62828;
    --status-danger-soft: #FDECEC;
    --auth-brand-link: #A90000;
    --auth-brand-leaf: #A90000;
    color-scheme: light;
}

body.auth-brand.auth-shell-page {
    -webkit-font-smoothing: antialiased;
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 21px;
    padding: 0 16px;
}

/* The column: in the centre of the window, Privacy at the bottom. */
.auth-brand .auth-shell {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 400px;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 88px 0;
    position: relative;
    width: 100%;
}

.auth-brand .auth-shell-brand {
    margin-bottom: 24px;
}

/* The brand mark: the Malka logo, or the Maple leaf and word, in the page colours. */
.auth-brand-mark {
    display: none;
}

[data-admin-brand="malka"] .auth-brand .auth-brand-mark,
[data-admin-brand="maple"] .auth-brand .auth-brand-mark {
    display: flex;
    justify-content: center;
    margin: 0 auto 8px;
}

[data-admin-brand="malka"] .auth-brand .auth-brand-mark {
    background: var(--color-text-1);
    height: 60px;
    -webkit-mask: url('../images/malka-logo-white.png') no-repeat center / contain;
    mask: url('../images/malka-logo-white.png') no-repeat center / contain;
    width: 128px;
}

[data-admin-brand="maple"] .auth-brand .auth-brand-mark {
    align-items: center;
    gap: 10px;
    height: 60px;
}

.auth-brand-leaf,
.auth-brand-word {
    display: none;
}

[data-admin-brand="maple"] .auth-brand .auth-brand-leaf {
    background: var(--auth-brand-leaf);
    display: block;
    height: 41px;
    -webkit-mask: url('../images/maple-header-leaf@3x.png') no-repeat center / contain;
    mask: url('../images/maple-header-leaf@3x.png') no-repeat center / contain;
    width: 44px;
}

[data-admin-brand="maple"] .auth-brand .auth-brand-word {
    background: var(--color-text-1);
    display: block;
    height: 18px;
    -webkit-mask: url('../images/maple-header-word@3x.png') no-repeat left center / contain;
    mask: url('../images/maple-header-word@3x.png') no-repeat left center / contain;
    width: 118px;
}

/* A tenant with its own logo image keeps the image. */
[data-admin-brand="malka"] .auth-brand .auth-shell-logo,
[data-admin-brand="maple"] .auth-brand .auth-shell-logo {
    display: none;
}

.auth-brand .auth-shell-product {
    color: var(--color-text-2);
    font-size: 15px;
    font-weight: 500;
    line-height: 21px;
    margin: 0 0 28px;
}

.auth-brand .auth-shell-title {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.2px;
    line-height: 30px;
}

.auth-brand .auth-shell-field {
    margin: 0 0 16px;
}

.auth-brand .auth-shell-label,
.auth-brand .auth-shell form label.auth-shell-label {
    color: var(--color-text-2);
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
    margin: 0 0 6px;
}

.auth-brand .auth-shell form input.auth-shell-input {
    background: var(--color-field);
    border: 1px solid var(--color-control-border);
    border-radius: 10px;
    color: var(--color-text-1);
    font-size: 15px;
    height: 40px;
    line-height: 20px;
    margin: 0;
    min-height: 40px;
    padding: 0 12px;
}

.auth-brand .auth-shell form input.auth-shell-input:focus,
.auth-brand .auth-shell form input.auth-shell-input:focus-visible {
    border-color: var(--color-focus);
    box-shadow: 0 0 0 1px var(--color-focus) inset;
    outline: none;
}

/* A browser that fills the field keeps the page colours. */
.auth-brand .auth-shell form input.auth-shell-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 40px var(--color-field) inset;
    -webkit-text-fill-color: var(--color-text-1);
    caret-color: var(--color-text-1);
}

.auth-brand .auth-shell form input.auth-shell-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1px var(--color-focus) inset, 0 0 0 40px var(--color-field) inset;
}

/*
 * Show/Hide: a quiet text button in the vertical centre of the field, at the
 * end. It has a fixed width, so the field does not move when the word changes.
 */
.auth-brand .auth-shell form .auth-shell-password {
    margin-bottom: 0;
}

.auth-brand .auth-shell form .auth-shell-password input.auth-shell-input {
    padding-right: 72px;
}

.auth-brand .auth-shell-toggle {
    border: 0;
    border-radius: 10px;
    color: var(--auth-brand-link);
    font-size: 14px;
    font-weight: 600;
    height: 40px;
    line-height: 40px;
    min-height: 40px;
    min-width: 0;
    padding: 0 12px 0 0;
    right: 0;
    text-align: right;
    top: 0;
    transform: none;
    width: 64px;
}

.auth-brand .auth-shell-toggle:hover {
    background: transparent;
    color: var(--auth-brand-link);
    text-decoration: underline;
}

.auth-brand .auth-shell-toggle:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: -4px;
}

/* The error line, above the main button of the step (sign-in.js). */
.auth-brand .auth-shell-error {
    align-items: center;
    background: var(--status-danger-soft);
    border: 0;
    border-radius: 12px;
    color: var(--status-danger-text);
    display: flex;
    gap: 12px;
    line-height: 20px;
    margin: 0 0 16px;
    min-height: 48px;
    padding: 6px 14px;
}

.auth-brand .auth-shell-error:empty,
.auth-brand .auth-shell-error[hidden] {
    display: none;
}

.auth-brand .auth-shell-error::before {
    background: currentColor;
    content: '';
    flex: none;
    height: 20px;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E") no-repeat center / contain;
    width: 20px;
}

.auth-brand .auth-shell-error a {
    color: inherit;
    font-weight: 600;
}

.auth-brand .auth-shell-submit,
.auth-brand .auth-shell button.auth-shell-submit {
    background: var(--color-action-primary);
    border-radius: 14px;
    color: var(--color-action-primary-text);
    font-size: 16px;
    font-weight: 600;
    height: 52px;
    margin-top: 4px;
    min-height: 52px;
    padding: 0 22px;
}

.auth-brand .auth-shell-submit:hover {
    background: var(--color-action-primary-hover);
}

.auth-brand .auth-shell-submit:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 3px;
}

/* The link row: 24 px between the words, each link a 44 px target. */
.auth-brand .auth-shell-links {
    gap: 0 8px;
    margin-top: 8px;
}

.auth-brand .auth-shell-links a,
.auth-brand .auth-shell-link {
    color: var(--auth-brand-link);
    font-size: 14px;
    font-weight: 500;
}

/* Interpreters use the Terp app: no "Interpret with us" in the desktop app. */
[data-shell="app"] .auth-brand #signInInterpret {
    display: none;
}

.auth-brand .auth-shell-footer {
    bottom: 16px;
    left: 0;
    margin: 0;
    position: absolute;
    right: 0;
}

.auth-brand .auth-shell-footer .auth-shell-links a {
    color: var(--color-text-2);
    font-size: 13px;
    font-weight: 400;
}

@media (max-width: 480px) {
    .auth-brand .auth-shell {
        padding: 56px 0 88px;
    }

    /* 16 px text: iOS does not zoom into the field. A 48 px field for a finger. */
    .auth-brand .auth-shell form input.auth-shell-input {
        font-size: 16px;
        height: 48px;
        min-height: 48px;
    }

    .auth-brand .auth-shell-toggle {
        height: 48px;
        line-height: 48px;
        min-height: 48px;
    }
}
