/* ============================================
   Brand alignment with adjustservices.co.uk

   Loaded LAST (after global/dashboard/crm/audit.css) so it can re-point the
   shared tokens and restyle the public, logged-out surfaces without touching
   the markup those pages' JS depends on.

   Source of truth: adjustservices-site/src/styles/global.css.
   That site has two themes in preview: "a" (Refined, cool) and "b" (Warmer).
   The warm values below are theme "b". If Adjust settles on theme "a", swap:
     --brand-bg    #FBF8F5 -> #F4F6FD
     --brand-panel #F3EEE9 -> #E9ECFB
     --brand-line  #ECE4DC -> #E1E4F2
   and the --brand-hero gradient -> linear-gradient(180deg,#ECEFFF,var(--brand-bg)).

   Font: Instrument Sans (Google Fonts, OFL). Bariol is NOT used here — no web
   licence has been confirmed. Lato stays in the stack as a fallback.

   Scope:
   - Shared tokens (--bg, --fg, --primary, --border), font and focus ring
     apply app-wide. CRM keeps its own teal accent (--crm-accent).
   - Pill buttons, white bordered cards etc. are scoped to:
       .aa-public        login, request-access, auth callback
       .audit-page       public audit
       .consent-bar      cookie banner
       .app-header       logged-in header
   ============================================ */

:root {
  --brand-blue: #0000FF;
  --brand-ink: #10104A;
  --brand-muted: #4A4F72;
  --brand-tint: #C9CDFF;
  --brand-bg: #FBF8F5;
  --brand-panel: #F3EEE9;
  --brand-line: #ECE4DC;
  --brand-line-strong: #D9CFC5;
  --brand-card: #FFFFFF;
  --brand-hero: linear-gradient(180deg, #EEF0FF 0%, #F8F5F8 45%, var(--brand-bg));
  --brand-r-card: 22px;
  --brand-font: 'Instrument Sans', 'Lato', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* Re-point the app's shared tokens */
  --bg: var(--brand-bg);
  --fg: var(--brand-ink);
  --primary: var(--brand-blue);
  --border: var(--brand-line);
}

body {
  font-family: var(--brand-font);
  color: var(--brand-ink);
}

/* Visible focus ring, same as the marketing site */
:focus-visible {
  outline: 3px solid var(--brand-blue);
  outline-offset: 3px;
}

/* Shared button + input colour states (shape is left alone app-wide) */
.btn-primary:hover:not(:disabled) {
  background: var(--brand-ink);
  box-shadow: none;
}
.form-input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(0, 0, 255, 0.14);
}

/* ============================================
   Public pages: login, request access, auth callback
   ============================================ */
.aa-public {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--brand-hero);
  color: var(--brand-ink);
  padding: 0 16px calc(40px + var(--safe-bottom, 0px));
}

.aa-public-top {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(14px + var(--safe-top, 0px)) 0 8px;
  display: flex;
  align-items: center;
}

.aa-site-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-blue);
  text-decoration: none;
  border-radius: 8px;
}
.aa-site-link:hover { text-decoration: underline; text-underline-offset: 0.2em; }

.aa-public-main {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
}

.aa-public .aa-public-card {
  background: var(--brand-card);
  border: 1px solid var(--brand-line);
  border-radius: var(--brand-r-card);
  box-shadow: 0 24px 48px -32px rgba(16, 16, 74, 0.28);
  padding: 36px 32px;
}

.aa-public h1,
.aa-public h2 {
  color: var(--brand-ink);
  letter-spacing: -0.02em;
}

.aa-public .btn {
  border-radius: 999px;
  min-height: 48px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
}
.aa-public .btn-sm {
  min-height: 44px;
  padding: 10px 20px;
  font-size: 14px;
}
.aa-public .btn-outline,
.aa-public .btn-secondary {
  background: transparent;
  color: var(--brand-ink);
  border: 2px solid currentColor;
}
.aa-public .btn-outline:hover:not(:disabled),
.aa-public .btn-secondary:hover:not(:disabled) {
  background: rgba(16, 16, 74, 0.06);
  border-color: currentColor;
}

.aa-public .form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-ink);
}
.aa-public .form-input {
  min-height: 48px;
  border: 1.5px solid var(--brand-line-strong);
  border-radius: 12px;
  padding: 11px 14px;
}
.aa-public textarea.form-input { min-height: 96px; }
.aa-public .form-input::placeholder { color: #8A8DA6; }

.aa-public a:not(.btn) {
  color: var(--brand-blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}
.aa-public a:not(.btn):hover { text-decoration-thickness: 2px; }
.aa-public .aa-site-link { text-decoration: none; font-weight: 700; }

/* Short "how access works" explainer */
.aa-access-note {
  margin: 20px 0 0;
  padding: 16px 18px;
  background: var(--brand-panel);
  border-radius: 16px;
  text-align: left;
  font-size: 14px;
  line-height: 1.55;
  color: var(--brand-ink);
}
.aa-access-note p { margin: 0 0 8px; }
.aa-access-note p:last-child { margin-bottom: 0; }
.aa-access-note strong { font-weight: 700; }

.aa-public .error-box { border-radius: 14px; }

@media (max-width: 600px) {
  .aa-public .aa-public-card {
    padding: 28px 20px;
    border-radius: 18px;
  }
}

/* ============================================
   Public audit (/audit) — re-point its scoped tokens
   ============================================ */
.audit-page {
  --audit-blue: var(--brand-blue);
  --audit-blue-deep: var(--brand-ink);
  --audit-bg: var(--brand-panel);
  --audit-ink: var(--brand-ink);
  --audit-muted: var(--brand-muted);
  --audit-line: var(--brand-line);
  background: var(--brand-hero);
  font-family: var(--brand-font);
}

.audit-card {
  border: 1px solid var(--brand-line);
  border-radius: var(--brand-r-card);
  box-shadow: 0 24px 48px -32px rgba(16, 16, 74, 0.28);
}

.audit-h1,
.audit-h2 { letter-spacing: -0.02em; }

.audit-progress { background: var(--brand-tint); }
.audit-loading-track { background: var(--brand-tint); }

.audit-btn { border-radius: 999px; min-height: 48px; font-weight: 700; }
.audit-btn-primary:hover:not(:disabled) { background: var(--brand-ink); }
.audit-btn-ghost { min-height: 44px; }

.audit-option { border-radius: 14px; }
.audit-option:hover,
.audit-option.selected { background: #F3F3FF; }

.audit-chat-assistant { border-color: var(--brand-line); }
.audit-chat-form { border-radius: 16px; }
.audit-chat-form:focus-within { box-shadow: 0 0 0 3px rgba(0, 0, 255, 0.14); }
.audit-chat-send { border-radius: 999px; }
.audit-chat-send:hover { background: var(--brand-ink); }

.audit-capture {
  background: var(--brand-bg);
  border-color: var(--brand-line);
  border-radius: 18px;
}
.audit-capture-form input {
  min-height: 48px;
  border-color: var(--brand-line-strong);
  border-radius: 12px;
}
.audit-capture-form input:focus { box-shadow: 0 0 0 3px rgba(0, 0, 255, 0.14); }

.audit-next-body,
.audit-chat-invite-sub,
.audit-chat-closed-sub,
.audit-capture-sub,
.audit-proof-quote p { color: var(--brand-muted); }

.audit-footer a.audit-footer-link { color: var(--brand-muted); }
.audit-footer a.audit-footer-link:hover { color: var(--brand-ink); }

@media (max-width: 560px) {
  .audit-card { border-radius: 18px; }
}

/* ============================================
   Cookie consent banner
   Accept and decline keep EQUAL size and shape (ICO guidance); only the
   colours are re-pointed to the brand.
   ============================================ */
.consent-bar {
  border-color: var(--brand-line);
  border-radius: 18px;
  box-shadow: 0 24px 48px -24px rgba(16, 16, 74, 0.35);
}
.consent-text { color: var(--brand-ink); opacity: 1; }
.consent-text a { color: var(--brand-blue); }
.consent-btn {
  min-height: 44px;
  border-radius: 999px;
  border: 2px solid var(--brand-ink);
  color: var(--brand-ink);
  font-weight: 700;
}
.consent-btn:hover { border-color: var(--brand-ink); background: rgba(16, 16, 74, 0.06); }
.consent-btn-primary {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #fff;
}
.consent-btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }

/* ============================================
   Logged-in app header
   ============================================ */
.app-header {
  border-bottom-color: var(--brand-line);
  box-shadow: inset 0 3px 0 var(--brand-blue);
}
.header-title { color: var(--brand-ink); }

.header-site-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-blue);
  text-decoration: none;
  white-space: nowrap;
}
.header-site-link:hover {
  background: var(--surface-muted);
  text-decoration: none;
}
.header-site-link-short { display: none; }
@media (max-width: 600px) {
  .header-site-link { padding: 0 8px; margin-right: 0; }
  .header-site-link-full { display: none; }
  .header-site-link-short { display: inline; }
}
