/* Canonical brand tokens shared by Web, Messages, CRM and support surfaces. */
:root {
  --brand-lapis: #2341A0;
  --brand-gold: #E8C26A;
  --brand-gold-dark: #C9A24A;
  --brand-cream: #F6F2E8;
  --brand-night: #12172B;
  --brand-primary-2: #3A5BD0;
  --brand-primary-ink: #27348F;

  /* Compatibility aliases for pre-rebrand component systems. */
  --brand-primary: var(--brand-lapis);
  --brand-accent: var(--brand-gold);
  --brand-accent-dark: var(--brand-gold-dark);
  --brand-background: var(--brand-cream);
  --brand-text: var(--brand-night);
  --primary: var(--brand-lapis);
  --primary-dark: var(--brand-night);
  --crm-brand: var(--brand-lapis);
  --crm-brand-dark: var(--brand-night);
  --primary-color: var(--brand-lapis);
  --color-primary: var(--brand-lapis);
  --accent: var(--brand-gold);
  --accent-color: var(--brand-gold);
  /* Gold on white is 1.7:1 and was nearly invisible. Lapis is 9:1. */
  --focus-ring: var(--brand-lapis);
}

html,
body {
  /* Latin text in Inter (served from /public/fonts); "Sora" had no font file, so English
   * fell through to Vazirmatn. Arabic-script text keeps Vazirmatn (rule below). */
  font-family: "Inter", "Vazirmatn", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

html[dir="rtl"] body,
html[lang="fa"] body,
html[lang="fa-AF"] body,
html[lang="ar"] body {
  font-family: "Vazirmatn", "Inter", system-ui, sans-serif;
}

:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  /* Keyboard focus must be visible on every background: a lapis ring with a white halo. */
  outline: 2px solid var(--focus-ring, #2341a0);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.9);
}

:where(.brand-accent, [data-brand-accent="true"]) {
  color: var(--brand-gold-dark);
}

::selection {
  background: var(--brand-gold);
  color: var(--brand-night);
}


/* AVO sound selection in personal Settings */
.settings-sonic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
}
.settings-sonic-row {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  padding: 1rem;
  border: 1px solid var(--brand-lapis);
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand-cream) 62%, white);
}
.settings-sonic-choice { display: flex; gap: .65rem; flex-wrap: wrap; }
.settings-sonic-choice select {
  flex: 1 1 160px;
  min-width: 0;
  padding: .65rem;
  border-radius: 8px;
  border: 1px solid var(--brand-lapis);
  background: white;
  color: var(--brand-night);
}
.settings-sonic-row input[type="range"] { width: 100%; accent-color: var(--brand-lapis); }
.settings-sonic-row output { font-variant-numeric: tabular-nums; }
.settings-sonic-card .form-actions { align-items: center; gap: .8rem; }

/* Emails, phone numbers and links are always written left to right, also inside Dari and
 * Persian forms; otherwise "+93" and "@" jump to the wrong side while typing. */
input:is([type="email"], [type="tel"], [type="url"]),
input[inputmode="tel"],
input[autocomplete="email"],
input[autocomplete="username"] {
  direction: ltr;
}

/* People who ask their device for less motion get (almost) none, everywhere. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Password fields: the show/hide eye sits inside the field (end side), as a clean line icon,
 * not a separate grey box with an emoji. Works in both directions (logical properties). */
.password-field {
  display: block !important;
  position: relative;
}

.password-field input {
  border-radius: inherit;
  padding-inline-end: 52px !important;
  width: 100%;
}

.password-field .password-toggle {
  align-items: center;
  background: transparent !important;
  border: 0 !important;
  border-radius: 12px;
  color: var(--as-text-muted, #5f697d) !important;
  display: inline-flex;
  height: 44px;
  inset-block-start: 50%;
  inset-inline-end: 4px;
  justify-content: center;
  min-height: 0 !important;
  padding: 0;
  position: absolute;
  transform: translateY(-50%);
  width: 44px;
}

.password-field .password-toggle:hover,
.password-field .password-toggle.is-visible {
  background: var(--as-primary-subtle, #e3ecff) !important;
  color: var(--as-primary, #2341a0) !important;
}

.password-field .password-toggle .password-eye-off,
.password-field .password-toggle.is-visible .password-eye {
  display: none;
}

.password-field .password-toggle.is-visible .password-eye-off {
  display: block;
}

/* Elements the code hides (the "or" line and the Google box when Google sign-in is not set up)
 * must stay hidden even where a stylesheet gives them display:flex. */
.auth-divider[hidden],
.google-auth-button[hidden] {
  display: none !important;
}
