/* The customer portal (ADR-0021): a phone in one hand at a till — the code first, big targets, light and dark. The
   card's widgets take the portal's colours through their --loyal-* variables. A portal of the merchant's colour (stage
   7f-4) overrides --accent and --accent-text of both looks from /p/<slug>/theme.css (CardColours, which reads its shades
   against --page of the light look and --surface of the dark one, never against --notice: no accent goes on a notice):
   an accent's new variable would stay the platform's. */

:root {
  color-scheme: light dark;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --positive: #15803d;
  --text: #111827;
  --muted: #4b5563;
  --surface: #ffffff;
  --page: #f3f4f6;
  --line: #d1d5db;
  --notice: #fef3c7;
  --danger: #b91c1c;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* A light accent with dark text on it: links, figures and buttons stay readable on a dark page. */
    --accent: #2dd4bf;
    --accent-text: #042f2e;
    --text: #f9fafb;
    --muted: #9ca3af;
    --surface: #111827;
    --page: #030712;
    --line: #374151;
    --notice: #422006;
    --danger: #f87171;
    --positive: #4ade80;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
}

#portal {
  max-width: 32rem;
  margin: 0 auto;
  padding: env(safe-area-inset-top) max(1rem, env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

[hidden] {
  display: none !important;
}

h1 {
  font-size: 1.5rem;
  margin: 1rem 0 0.75rem;
  overflow-wrap: anywhere;
}

p {
  margin: 0.5rem 0;
}

.lead {
  font-size: 1.05rem;
}

.muted {
  color: var(--muted);
}

.form {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0;
}

label {
  font-weight: 600;
}

input {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  padding: 0.75rem 0.85rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 0.6rem;
}

button:disabled {
  cursor: default;
  opacity: 0.6;
}

.primary {
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border: 0;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.link {
  padding: 0.5rem 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
}

/* A link that looks as a button does: «Открыть MAX». */
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border-radius: 0.6rem;
  text-decoration: none;
}

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

.message:empty {
  display: none;
}

.message {
  color: var(--danger);
}

.captcha {
  min-height: 100px;
}

/* The form of joining: fields with their hints, then the documents to accept, each with its text to read. */
.field {
  display: grid;
  gap: 0.35rem;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* An empty date field is as high as the others (Safari on an iPhone draws it lower). */
input[type="date"] {
  min-height: 3.3rem;
}

.consents {
  display: grid;
  gap: 0.75rem;
  margin: 0.5rem 0 0;
  padding: 0;
  border: 0;
}

.consents legend {
  margin-bottom: 0.5rem;
  padding: 0;
  font-weight: 600;
}

/* A box with its label beside it, and the document's text under the label. */
.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  align-items: start;
}

.consent input {
  width: 1.5rem;
  height: 1.5rem;
  margin: 0.1rem 0 0;
  padding: 0;
  accent-color: var(--accent);
}

.consent label {
  font-weight: 400;
}

.consent details,
.consent .reading,
.consent .hint {
  grid-column: 2;
}

summary {
  padding: 0.25rem 0;
  color: var(--accent);
  cursor: pointer;
}

.document {
  max-height: 50vh;
  overflow: auto;
  margin-top: 0.25rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--surface);
  font-size: 0.95rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The box «Я не робот» in its frame, as high as the box says it is; a task of the box covers the screen while it is
   shown. */
.box {
  display: block;
  width: 100%;
  height: 120px;
  border: 0;
}

.box.challenge {
  position: fixed;
  inset: 0;
  z-index: 10;
  height: 100% !important;
  background: rgb(0 0 0 / 0.4);
}

.bar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.bar h1 {
  margin: 0.75rem 0;
  font-size: 1.25rem;
}

.notice,
.install {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: var(--notice);
}

.install {
  display: grid;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
}

.install p {
  margin: 0;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.tab {
  flex: 1 1 0;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.tab[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.panel {
  display: grid;
  gap: 0.75rem;
}

/* The member's profile: a card per section, as the card's widgets look. */
.profile {
  display: grid;
  gap: 0.75rem;
}

.card {
  display: grid;
  gap: 0.6rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
}

.card h2 {
  margin: 0;
  font-size: 1.15rem;
}

.card p {
  margin: 0;
}

.content,
.fields {
  display: grid;
  gap: 0.6rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
}

.address {
  overflow-wrap: anywhere;
}

.confirmed {
  color: var(--positive);
}

.unconfirmed {
  color: var(--muted);
}

/* What a section says: what it does muted, what it did in green, what went wrong in red. Empty, it takes no room — out
   of the grid, no gap for it — and stays on the page, where a screen reader hears it change. */
.said {
  color: var(--muted);
}

.said.done {
  color: var(--positive);
}

.said.failure {
  color: var(--danger);
}

.card .said:empty {
  position: absolute;
}

.item {
  display: grid;
  gap: 0.25rem;
}

.footer {
  display: grid;
  justify-items: start;
  margin-top: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

loyal-presentation-code,
loyal-member-card,
loyal-points-history {
  --loyal-color-accent: var(--accent);
  --loyal-color-accent-text: var(--accent-text);
  --loyal-color-background: var(--surface);
  --loyal-color-border: var(--line);
  --loyal-color-muted: var(--muted);
  --loyal-color-positive: var(--positive);
  --loyal-color-negative: var(--danger);
  --loyal-radius: 0.75rem;
  --loyal-button-radius: 0.6rem;
  --loyal-qr-size: min(70vw, 260px);
}
