*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 20rem;
  min-height: 100%;
  background: var(--color-page);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--color-ink);
  background: var(--color-page);
  font-family: var(--font-ar);
  font-size: 1rem;
  line-height: 1.6;
  text-align: start;
}

html[lang="en"] body,
html[dir="ltr"] body {
  font-family: var(--font-en);
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
input,
select {
  min-height: var(--control-height);
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
}

input,
select,
textarea {
  padding: var(--space-3) var(--space-4);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-muted);
  opacity: 1;
}

a {
  color: var(--color-primary-blue);
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* V27.4 — mobile viewport contract for every page, including login. */
@media (max-width: 48rem) {
  html,
  body {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    touch-action: pan-y;
  }

  #login-screen {
    min-height: min(100dvh, 100%);
    max-height: 100dvh;
    margin: 0 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: max(var(--space-6), env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}
