/* ---------------------------------------------------------------------------
   Floating help launcher

   Extracted from style.css on 9 Sep 2026 so the public wizard can load it.
   The wizard has its own design and pulls only design-tokens, fonts, the icon
   font and the language switcher; pulling 140 KB of portal CSS onto a public
   page to get one button would have been the wrong trade, and copying the
   rules would have let the two drift. One file, two consumers: the theme
   footer and the wizard footer.
   --------------------------------------------------------------------------- */

.help-launcher {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 1040;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.help-launcher i {
  font-size: 22px;
  color: var(--text-link);
  flex: none;
}

.help-launcher:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.help-launcher:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* Icon only on phones */
.help-launcher-label { display: none; }

[dir="rtl"] .help-launcher,
[dir="rtl"] .help-sheet { right: auto; left: 16px; }

[data-theme="dark"] .help-launcher { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }

/* The portal shell already leans on frosted surfaces; document pages do not. */
body:has(.fennec360-layout) .help-launcher {
  background: color-mix(in srgb, var(--surface-raised) 78%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Sheet */
.help-sheet {
  position: fixed;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 1040;
  width: calc(100vw - 32px);
  max-width: 320px;
  padding: var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  background: var(--surface-raised);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
}

[data-theme="dark"] .help-sheet { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6); }

.help-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.help-sheet-title {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.help-sheet-title:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

.help-sheet-close {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.help-sheet-close:hover { background: var(--surface-hover); color: var(--text-primary); }
.help-sheet-close:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

.help-sheet-team { font-size: 14px; color: var(--text-secondary); margin: 2px 0 var(--space-3); }
.help-sheet-row { display: flex; gap: var(--space-2); }
.help-sheet-row .btn { flex: 1; }
.help-sheet-reply { font-size: 14px; color: var(--text-secondary); margin: var(--space-3) 0 0; }

.help-sheet-call {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  margin-top: var(--space-2);
  font-size: 15px;
  color: var(--text-link);
}

.help-sheet-call:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* Ways to reach the team are the grey Support role with a navy icon (#87):
   green is money, red is destructive. Here as well as in portal-scale.css
   because the public wizard loads this file without the portal one. */
.help-sheet .btn.help-btn-whatsapp,
.help-sheet .btn.help-btn-email { background: var(--neutral-100); border-color: var(--neutral-100); color: var(--text-primary); }
.help-sheet .btn.help-btn-whatsapp i,
.help-sheet .btn.help-btn-email i { color: #272976; }
.help-sheet .btn.help-btn-whatsapp:hover,
.help-sheet .btn.help-btn-email:hover { background: var(--neutral-200); border-color: var(--neutral-200); color: var(--text-primary); }
[data-theme="dark"] .help-sheet .btn.help-btn-whatsapp,
[data-theme="dark"] .help-sheet .btn.help-btn-email { background: #24243c; border-color: #24243c; color: var(--text-primary); }
[data-theme="dark"] .help-sheet .btn.help-btn-whatsapp i,
[data-theme="dark"] .help-sheet .btn.help-btn-email i { color: #818cf9; }
[data-theme="dark"] .help-sheet .btn.help-btn-whatsapp:hover,
[data-theme="dark"] .help-sheet .btn.help-btn-email:hover { background: #2e2e4a; border-color: #2e2e4a; }

/* Clear the sticky Pay bar rather than sitting on top of it.
   The body class is the fallback for engines without :has(); the invoice
   page's own JS sets it from the same state that hides the bar. */
body:has(.inv-sticky:not([hidden])) .help-launcher,
body.has-sticky-pay .help-launcher { bottom: calc(96px + env(safe-area-inset-bottom)); }
body:has(.inv-sticky:not([hidden])) .help-sheet,
body.has-sticky-pay .help-sheet { bottom: calc(156px + env(safe-area-inset-bottom)); }
/* The contract page's Sign bar (fennec360_contracts, #34): same lift. */
body.has-doc-sign-bar .help-launcher { bottom: calc(96px + env(safe-area-inset-bottom)); }
body.has-doc-sign-bar .help-sheet { bottom: calc(156px + env(safe-area-inset-bottom)); }

/* The proof form owns the screen while it is open */
body:has(#invoice-proof[open]) .help-launcher,
body:has(#invoice-proof[open]) .help-sheet,
body.proof-open .help-launcher,
body.proof-open .help-sheet { display: none; }

@media (min-width: 1024px) {
  .help-launcher {
    right: 24px;
    bottom: calc(24px + env(safe-area-inset-bottom));
    width: auto;
    height: 48px;
    padding: 0 var(--space-4);
  }

  .help-launcher-label { display: inline; }

  [dir="rtl"] .help-launcher,
  [dir="rtl"] .help-sheet { left: 24px; }

  .help-sheet {
    right: 24px;
    bottom: calc(84px + env(safe-area-inset-bottom));
  }

  /* The Pay bar is phone only, so the offset goes with it */
  body:has(.inv-sticky:not([hidden])) .help-launcher,
  body.has-sticky-pay .help-launcher { bottom: calc(24px + env(safe-area-inset-bottom)); }
  body:has(.inv-sticky:not([hidden])) .help-sheet,
  body.has-sticky-pay .help-sheet { bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.has-doc-sign-bar .help-launcher { bottom: calc(24px + env(safe-area-inset-bottom)); }
  body.has-doc-sign-bar .help-sheet { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

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

@media print {
  .help-launcher, .help-sheet { display: none !important; }
}

/* Phase 2 portal: invoice roles shared with the application and arrival pages. */
.ob-phase2 {
  --radius-card: var(--radius-xl);
  --radius-input: var(--radius-lg);
  --warning: var(--tone-warning);
  --warning-bg: var(--tone-warning-tint);
  --danger: var(--tone-danger);
  --danger-bg: var(--tone-danger-tint);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
}
.ob-phase2 .inv-chip { gap: var(--space-2); font-size: 13px; }
:is(.ob-phase2, .auth-portal) .inv-chip-info { background: var(--tone-info-tint); color: var(--tone-info); }
.ob-phase2 .inv-chip-success { background: var(--success-bg); color: var(--success); }
:is(.ob-phase2, .auth-portal) :is(a, button).portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-3) var(--space-6);
  border: 1px solid var(--color-navy);
  border-radius: var(--radius-full);
  background: var(--color-navy);
  color: var(--text-on-primary);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  white-space: normal;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
  transition: background-color var(--motion-base) var(--ease-standard), border-color var(--motion-base) var(--ease-standard), color var(--motion-base) var(--ease-standard);
}
:is(.ob-phase2, .auth-portal) :is(a, button).portal-btn:hover, :is(.ob-phase2, .auth-portal) :is(a, button).portal-btn:focus {
  background: var(--color-navy-hover); border-color: var(--color-navy-hover); color: var(--text-on-primary); text-decoration: none; transform: none;
}
:is(.ob-phase2, .auth-portal) :is(a, button).portal-btn i { flex: none; font-size: 16px; }
.ob-phase2 :is(a, button).portal-btn-pay { background: var(--success-600); border-color: var(--success-600); }
.ob-phase2 :is(a, button).portal-btn-pay:hover, .ob-phase2 :is(a, button).portal-btn-pay:focus { background: var(--success-700); border-color: var(--success-700); }
:is(.ob-phase2, .auth-portal) :is(a, button).portal-btn-ghost { background: var(--surface-base); border-color: var(--border-default); color: var(--text-primary); font-weight: 500; }
/* The Button Icon Rule (#88): the navy icon belongs to Support, the ways to
   reach the team. Every other grey button takes its label's colour. */
:is(.ob-phase2, .auth-portal) :is(a, button).portal-btn-ghost i { color: inherit; }
:is(.ob-phase2, .auth-portal) :is(a, button):is(.btn-support, .ob-help-grey) i { color: var(--tone-info); }
:is(.ob-phase2, .auth-portal) :is(a, button).portal-btn-ghost:hover, :is(.ob-phase2, .auth-portal) :is(a, button).portal-btn-ghost:focus { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text-primary); }
:is(.ob-phase2, .auth-portal) :is(a, button).portal-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.portal-steps { list-style: none; padding: 0; margin: 0; }
.portal-steps li { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4) 0; }
.portal-steps li + li { border-top: 1px solid var(--border-subtle); }
.portal-steps li:first-child { padding-top: 0; }
.portal-steps li:last-child { padding-bottom: 0; }
.portal-steps-dot { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: var(--radius-full); font-size: 16px; font-weight: 600; line-height: 1; }
.portal-steps-info { background: var(--tone-info-tint); color: var(--tone-info); }
.portal-steps-warning { background: var(--tone-warning-tint); color: var(--tone-warning); }
.portal-steps-success { background: var(--success-bg); color: var(--success); }
.portal-steps-title { font-family: var(--font-body); font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--text-primary); margin: 0 0 var(--space-1); }
.portal-steps-description { font-size: 16px; line-height: 1.5; color: var(--text-secondary); margin: 0; }
body:has(.ob-phase2) { background-image: none; }

/* P2 auth surfaces. Scoped aliases keep the rest of the portal unchanged. */
.auth-portal,
body:has(.auth-portal) .auth-alert {
  --radius-card: var(--radius-xl);
  --radius-input: var(--radius-lg);
  --warning: var(--tone-warning);
  --warning-bg: var(--tone-warning-tint);
  --danger: var(--tone-danger);
  --danger-bg: var(--tone-danger-tint);
  --success: var(--tone-info);
  --success-bg: var(--tone-info-tint);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  min-width: 0;
}
body:has(.auth-portal) { background-image: none; }
.auth-portal .auth-form-body { max-width: 560px; justify-content: flex-start; padding: var(--space-8); }
body.register .auth-portal .auth-form-body { max-width: 720px; }
.auth-portal .auth-form-header-actions { display: flex; align-items: center; gap: var(--space-3); }
/* These three used to take the page's own text colours, which put grey
   secondary text on a navy panel (#102). They sit on the navy band now, so
   they take white: 12.6:1 for the tagline, and the Tifinagh line is dropped to
   78% for a quieter second voice, still about 8:1. */
.auth-portal .auth-illustration-logo-text { font-size: 32px; color: #ffffff; }
.auth-portal .auth-illustration-tagline { font-size: 16px; line-height: 1.5; color: #ffffff; }
.auth-portal .auth-illustration-tagline-tzm { font-size: 15px; line-height: 1.5; color: rgba(255, 255, 255, 0.78); }
.auth-portal .auth-heading { font-size: 32px; font-weight: 700; line-height: 1.125; letter-spacing: -0.02em; margin-bottom: var(--space-3); }
.auth-portal .auth-subheading { font-size: 16px; line-height: 1.5; margin-bottom: var(--space-6); }
.auth-portal .auth-register-header { margin-bottom: 0; }
.auth-portal .auth-card { box-shadow: none; border-radius: var(--radius-card); padding: var(--space-6); }
.auth-portal .auth-card .row { margin-inline: calc(-1 * var(--space-2)); }
.auth-portal .auth-card .row > [class*="col-"] { padding-inline: var(--space-2); }
.auth-portal .form-group { margin-bottom: var(--space-4); }
.auth-portal :is(label, .control-label, .field-optional, .auth-checkbox, .auth-checkbox-label) { font-size: 16px; line-height: 1.5; }
.auth-portal .form-control {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 48px;
  padding: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-input);
  color: var(--text-primary);
  background: var(--surface-input);
  box-shadow: none;
}
.auth-portal .form-control::placeholder { color: var(--text-secondary); opacity: 1; }
.auth-portal .auth-password-wrap .form-control { padding-right: var(--space-12); }
.auth-portal .auth-password-toggle { color: var(--text-secondary); border-radius: var(--radius-md); }
.auth-portal :is(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  box-shadow: none;
}
.auth-portal .form-control:focus { border-color: var(--border-focus); }
.auth-portal .auth-checkbox-box { width: 24px; height: 24px; border-radius: var(--radius-md); transition: background-color var(--motion-base) var(--ease-standard); }
.auth-portal .auth-checkbox-box i { color: var(--text-on-primary); font-size: 16px; }
.auth-portal .auth-checkbox input:checked ~ .auth-checkbox-box { background: var(--color-navy); border-color: var(--color-navy); }
.auth-portal .auth-checkbox input:focus-visible ~ .auth-checkbox-box { outline: 2px solid var(--border-focus); outline-offset: 2px; box-shadow: none; }
.auth-portal .auth-checkbox-label { line-height: 1.5; }
.auth-portal .auth-social-buttons { display: flex; flex-direction: column; gap: var(--space-3); }
.auth-portal .auth-social-buttons .btn + .btn { margin-top: 0; }
.auth-portal .auth-social-btn svg { flex: none; color: var(--text-primary); }
.auth-portal .auth-social-btn { gap: var(--space-3); }
.auth-portal .auth-login-divider { margin-block: var(--space-6); color: var(--text-secondary); }
.auth-portal :is(.auth-divider-text, .auth-field-hint, .auth-login-toggle-link, .auth-strength-text, .auth-signup-cta-text, .auth-otp-tip p, .auth-otp-tip-link) { font-size: 16px; line-height: 1.5; }
.auth-portal :is(.auth-field-hint, .auth-strength-text) { color: var(--text-secondary); margin-top: var(--space-2); }
.auth-portal :is(.auth-login-toggle-link, .auth-otp-tip-link) { color: var(--tone-info); white-space: normal; }
.auth-portal .auth-login-toggle-link { text-align: center; }
.auth-portal .auth-otp-tip { background: var(--surface-card); border-color: var(--border-default); border-radius: var(--radius-card); }
.auth-portal .auth-otp-tip > i { color: var(--tone-info); }
.auth-portal .auth-signup-cta { padding: var(--space-4); border-radius: var(--radius-card); }
.auth-portal .auth-signup-cta-btn { width: 100%; }
.auth-portal .otp-digit-wrap { gap: var(--space-2); }
.auth-portal .otp-digit-box {
  flex: 0 1 48px;
  min-width: 0;
  width: 48px;
  height: 56px;
  font-family: var(--font-heading);
  font-size: 24px;
  color: var(--text-primary);
  background: var(--surface-input);
  border-color: var(--border-default);
  border-radius: var(--radius-input);
  caret-color: var(--tone-info);
  box-shadow: none;
}
.auth-portal .otp-digit-box:focus { border-color: var(--border-focus); outline: 2px solid var(--border-focus); outline-offset: 2px; box-shadow: none; }
.auth-portal #fennec-otp-section .btn-primary { display: inline-flex; padding: var(--space-3) var(--space-6); border: 1px solid var(--color-navy); border-radius: var(--radius-full); }
.auth-portal #fennec-otp-section #es_phone_number_error_message { font-size: 16px; }
.auth-portal .auth-password-strength { gap: var(--space-2); flex-wrap: wrap; }
.auth-portal .auth-strength-bar { border-radius: var(--radius-full); }
.auth-portal .auth-strength-bar span { background: var(--tone-info); border-radius: var(--radius-full); }
.auth-portal .auth-strength-bar .strength-weak,
.auth-portal .auth-strength-bar .strength-fair { background: var(--tone-warning); }
.auth-portal :is(.alert, .auth-alert) { border: 1px solid var(--border-default); border-radius: var(--radius-input); font-size: 16px; line-height: 1.5; box-shadow: none; }
.auth-portal :is(.alert-success, .auth-alert-success, .auth-alert-info) { color: var(--tone-info); background: var(--tone-info-tint); border-color: var(--border-default); }
.auth-portal :is(.alert-danger, .auth-alert-danger) { color: var(--danger); background: var(--danger-bg); border-color: var(--border-default); }
.auth-portal :is(.alert-warning, .auth-alert-warning) { color: var(--warning); background: var(--warning-bg); border-color: var(--border-default); }
.auth-portal :is(.text-danger, .text-success, .help-block) { font-size: 16px; line-height: 1.5; }
.auth-portal .text-success { color: var(--tone-info) !important; }
.auth-portal .text-muted { color: var(--text-secondary) !important; }
.auth-portal .inv-chip { min-height: 28px; height: auto; font-size: 13px; line-height: 1.5; gap: var(--space-2); padding: var(--space-1) var(--space-3); white-space: normal; }
.auth-portal .auth-status-copy { margin-block: var(--space-4); }
.auth-portal .inv-support { margin: var(--space-6) 0 0; border-radius: var(--radius-card); }
.auth-portal .inv-support-head { margin-bottom: var(--space-3); }
.auth-portal :is(.inv-support-team, .inv-support-reply) { font-size: 16px; line-height: 1.5; margin: var(--space-1) 0 var(--space-3); }
.auth-portal .inv-support-title { font-family: var(--font-heading); font-size: 20px; line-height: 1.2; }
.auth-portal .inv-support-row { flex-wrap: wrap; }
.auth-portal .inv-support-row .portal-btn { padding-inline: var(--space-3); }
.auth-portal .inv-support-avatar { border-radius: var(--radius-md); }
.auth-portal .auth-consent-company { font-family: var(--font-heading); font-size: 24px; line-height: 1.25; margin-block: var(--space-4); }
.auth-portal .auth-consent-purpose { min-width: 0; border: 0; margin: var(--space-6) 0; padding: 0; }
.auth-portal .auth-consent-purpose legend { font-family: var(--font-heading); font-size: 20px; line-height: 1.4; color: var(--text-primary); border: 0; margin-bottom: var(--space-2); }
.auth-portal .pay-field { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); border-block: 1px solid var(--border-default); padding-block: var(--space-3); margin-bottom: var(--space-4); }
.auth-portal .pay-copy-label { font-size: 16px; line-height: 1.5; color: var(--text-secondary); }
.auth-portal .auth-consent-actions { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.auth-portal .auth-consent-actions .radio { margin: 0; padding: 0; display: flex; align-items: center; gap: var(--space-2); }
.auth-portal .auth-consent-actions input { position: static; opacity: 1; margin: 0; width: 20px; height: 20px; accent-color: var(--color-navy); }
.auth-portal .auth-consent-actions label { padding: var(--space-2) 0; }
.auth-portal .auth-consent-actions label::before,
.auth-portal .auth-consent-actions label::after { display: none; }
.auth-legacy-pending :is(.auth-heading, .auth-subheading, .auth-card) { opacity: 0; transition: opacity var(--motion-fast) var(--ease-standard); }
.auth-login-ready .auth-legacy-pending :is(.auth-heading, .auth-subheading, .auth-card) { opacity: 1; }
@media (max-width: 991px) {
  .auth-portal .auth-form-body,
  body.register .auth-portal .auth-form-body { max-width: 560px; padding: var(--space-4); }
  .auth-portal .auth-card { padding: var(--space-4); }
}

/* Same specificity as the legacy dark-mode sheet, after it in the cascade.
   A pale surface here showed through wherever the photo did not reach and left
   the panel reading as two different grounds (#102); navy in both themes. */
.auth-portal .auth-illustration-panel { background: var(--primary-900); }
.auth-portal :is(.auth-field-error, .auth-field-success, .auth-caps-warn) { display: block; font-size: 16px; line-height: 1.5; margin-top: var(--space-2); }
.auth-portal .auth-field-error { color: var(--danger); }
.auth-portal .auth-field-success { color: var(--tone-info); }
.auth-portal .auth-caps-warn { color: var(--tone-warning); }
.auth-portal .has-success .form-control { border-color: var(--border-default); box-shadow: none; }
.auth-portal .has-error .form-control { border-color: var(--danger); box-shadow: none; }

/* Flash alerts also appear before the view in the public and logged-in shells. */
body:has(.auth-portal) .auth-alert { border: 1px solid var(--border-default); border-radius: var(--radius-lg); font-size: 16px; line-height: 1.5; }
body:has(.auth-portal) :is(.auth-alert-success, .auth-alert-info) { color: var(--tone-info); background: var(--tone-info-tint); }
body:has(.auth-portal) .auth-alert-warning { color: var(--tone-warning); background: var(--tone-warning-tint); }
body:has(.auth-portal) .auth-alert-danger { color: var(--danger); background: var(--danger-bg); }
.auth-portal .auth-checkbox input:focus ~ .auth-checkbox-box { box-shadow: none; }
.auth-portal .otp-digit-box:is(:not(:placeholder-shown), :not([value=""])) { background: var(--surface-input); border-color: var(--border-default); }
.auth-portal .otp-digit-box:focus:is(:not(:placeholder-shown), :not([value=""])) { border-color: var(--border-focus); }
.auth-portal .bootstrap-select :is(.dropdown-toggle, .dropdown-menu, .dropdown-menu a) { font-size: 16px; line-height: 1.5; }
.auth-portal .language-switcher-header { font-size: 13px; }
.auth-portal .language-switcher-item { font-size: 16px; }
