* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 36px 32px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
}

.wordmark {
    margin: 0 0 32px 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    text-align: center;
}

.wordmark.tight {
    margin-bottom: 8px;
}

.auth-subhead {
    margin: 0 0 32px 0;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-field-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.auth-field input {
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 120ms ease, background-color 120ms ease;
}

.auth-field input:hover {
    border-color: var(--text-muted);
}

.auth-field input:focus {
    outline: none;
    border-color: var(--accent);
    background-color: var(--surface-2);
}

.auth-submit {
    margin-top: 8px;
    background-color: var(--accent);
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 120ms ease;
}

.auth-submit:hover {
    background-color: var(--accent-hover);
}

.auth-submit:active {
    background-color: color-mix(in srgb, var(--accent) 80%, black);
}

.auth-submit:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.auth-error {
    background-color: var(--red-bg);
    border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
    color: var(--red);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
}

.auth-body-text {
    margin: 0 0 24px 0;
    color: var(--text-secondary);
    text-align: center;
}

.auth-message {
    margin: 24px 0 0 0;
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}

.auth-message a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: border-color 120ms ease;
}

.auth-message a:hover {
    border-bottom-color: var(--accent);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 0 0 28px 0;
}

.auth-brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.auth-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-brand-name {
    margin: 4px 0 0 0;
    font-size: 17px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
}

.auth-brand-sub {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
}

/* Password input with visibility toggle */
.auth-field-password {
    position: relative;
}
.auth-field-password input {
    padding-right: 40px;
}
.auth-password-toggle {
    position: absolute;
    right: 8px;
    bottom: 7px;
    background: transparent;
    border: 0;
    padding: 6px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 120ms ease, background-color 120ms ease;
}
.auth-password-toggle:hover {
    color: var(--text-primary);
    background-color: var(--surface-2);
}
.auth-password-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.auth-password-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
}
.auth-password-toggle .auth-password-eye-off {
    display: none;
}
.auth-password-toggle[data-visible="true"] .auth-password-eye {
    display: none;
}
.auth-password-toggle[data-visible="true"] .auth-password-eye-off {
    display: block;
}

/* Sprint 3.23 Chunk C: shared e-sign audit line (esign/_signature_block.html).
   auth.css backs the vendor-portal / e-sign shells, which load tokens.css. */
.esign-audit-line {
  margin: 6px 0 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

/* Sprint 3.23 Chunk C ext: drawn-signature render (esign/_signature_block.html).
   The image is the PNG the signer drew; the typed fallback is plain text and
   is deliberately NOT styled to imitate handwriting. */
.esign-signature-render { margin: 10px 0 2px; }
.esign-signature-img {
  display: block;
  max-width: 260px;
  max-height: 90px;
  width: auto;
  height: auto;
}
.esign-signature-typed {
  font-size: 15px;
  letter-spacing: .01em;
  color: var(--text-primary);
}

/* ---------------------------------------------------------------------------
   Staff invite claim page (Sprint Staff Invite, Chunk F2/F3).

   Four additions to the auth vocabulary, per docs/design-handoffs/
   "Staff Invite - Claim Flow.html". All four are NEW selector names -- nothing
   else in the app uses them -- so the vendor login, password-reset and e-sign
   shells that also load this stylesheet are untouched.

   Token mapping: the handoff's :root defines --danger / --danger-bg, which do
   NOT exist in tokens.css. They map to --red / --red-bg here (the app's error
   colour). Every other custom property the handoff uses is already in
   tokens.css and is referenced unchanged.
--------------------------------------------------------------------------- */

/* Display-face greeting above the subhead. The vendor shell opens with a bare
   "Set your password to activate your account"; this is a person joining the
   team, so the card greets them by name first. */
.auth-greet {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    color: var(--fg);
    text-align: center;
    line-height: 1.25;
}

/* The line under each password field carrying the length rule and both
   validation messages. --fg-2 rather than the muted tier on purpose: it is
   the one line a user must read to succeed here, so it clears the contrast
   floor instead of inheriting the muted treatment. */
.auth-hint {
    font-size: 12px;
    color: var(--fg-2);
    margin-top: -6px;
}
.auth-hint.err {
    color: var(--red);
    font-weight: 600;
}

/* Divider-separated expiry line at the card foot. */
.auth-note {
    margin: 20px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--divider);
    font-size: 12px;
    color: var(--fg-3);
    text-align: center;
    line-height: 1.55;
}

/* Role-group chip in the invite sentence. Draws on the --role-* tokens; the
   modifier picks the group, matching the .stf-grp pills on Settings > Users
   so a group reads the same in both places. */
.rolepill {
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 5px;
    background: var(--surface-2);
    color: var(--fg-2);
}
.rolepill.super  { background: var(--role-super-bg);  color: var(--role-super-fg); }
.rolepill.doc    { background: var(--role-doc-bg);    color: var(--role-doc-fg); }
.rolepill.purch  { background: var(--role-purch-bg);  color: var(--role-purch-fg); }
.rolepill.design { background: var(--role-design-bg); color: var(--role-design-fg); }

/* Heading treatment for the terminal states on the invite-invalid card
   (expired / already claimed / unrecognised). The handoff carried these
   values as an inline style on .auth-subhead; named here so the two
   templates cannot drift apart. */
.auth-subhead-strong {
    margin-bottom: 14px;
    font-weight: 600;
    color: var(--fg);
}

/* Phone rules for the auth pages: 16px inputs (no iOS zoom), 44px targets (vendor portal audit fix 11). */
.auth-field input { font-size: 16px; min-height: 44px; }
.auth-submit, .auth-password-toggle { min-height: 44px; }
.auth-password-toggle { min-width: 44px; }
.auth-footer-link a, .auth-description a { display: inline-flex; align-items: center; min-height: 44px; }
