/* auth.css: the signed-out layout (allauth/layouts/entrance.html) and nothing else.
   --brand comes from the client config: the brand field and the light theme's one accent.
   The rest is neutral. Dark follows the OS setting. CSS owns wrapping. */

@font-face {
  font-family: "Epilogue";
  src: url("../fonts/epilogue.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f4f1eb;
  --surface: #efeae2;
  --ink: #201c17;
  --muted: #5b5148;
  --line: #d8d1c6;
  --control: #83766a;
  --field: #fffdfa;
  --action: #22d3ee;
  --action-ink: #041d24;
  --action-hover: #67e8f9;
  --link: #076c82;
  --focus: #065a6e;
  --err: #b3261e;
  --err-bg: #fcefee;
  --font: "Epilogue", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: .625rem;
  --on-brand: #ffffff;  /* primary_color passes 4.5:1 against white (portal.client) */
  --qr-ground: #ffffff; /* scanners need dark modules on light, in both themes */
  --type-title: 500 2rem/1.15 var(--font);
  --type-h2: 500 1.125rem/1.3 var(--font);
  --type-body: 400 1rem/1.5 var(--font);
  --type-small: 400 .9375rem/1.45 var(--font);
  --type-label: 500 .9375rem/1.4 var(--font);
  --type-button: 500 1rem/1.25 var(--font);
  --type-mark: 500 clamp(2.75rem, 9vw, 6rem)/1 var(--font);
  --type-code: 400 .9375rem/1.45 var(--mono);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b0b0c;
    --surface: #161617;
    --ink: #f2f2f2;
    --muted: #a6a6a6;
    --line: #262628;
    --control: #767678;
    --field: #111112;
    --action: #22d3ee;
    --action-ink: #041d24;
    --action-hover: #67e8f9;
    --link: #67e8f9;
    --focus: #67e8f9;
    --err: #ff8f86;
    --err-bg: #2a1514;
  }
}

/* Type and spacing are in rem, so the root tier grows the page on wide screens. */
@media (min-width: 2400px) {
  html { font-size: 125%; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--type-body);
  hyphens: manual;
  -webkit-font-smoothing: antialiased;
}

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

.skip-link {
  position: absolute;
  top: 1rem;
  inset-inline-start: 1rem;
  z-index: 1;
  padding: .75rem 1rem;
  background: var(--bg);
  color: var(--ink);
}
.skip-link:not(:focus) { width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Phone first: the brand field is a band over the form; from 60em it is the left half. */
.entrance { display: grid; min-height: 100vh; min-height: 100dvh; grid-template-rows: auto 1fr; }

.entry-actions { margin-block: 1.5rem; border-top: 1px solid var(--control); }
.entry-actions a { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.125rem; padding: .75rem .25rem; border-bottom: 1px solid var(--line); color: var(--link); text-decoration: none; font-weight: 600; }
.entry-actions a:hover { background: var(--surface); }
[dir="rtl"] .entry-actions a span { transform: rotate(180deg); }

.stage {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--brand);
  color: var(--on-brand);
}

/* A poster-less video stacks over the logo or wordmark: an empty video shows the mark. */
.stage > * { grid-area: 1 / 1; }

/* The intro and its poster are square, the logo in the middle 42%: cover fills any field from a
   16:9 band to a half page; a field narrower than half its height shows it whole instead.
   The phone band shows it at 1.5x, so a logo's small lettering stays readable. */
.stage-media { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; scale: 1.5; }

.stage-logo { display: block; width: min(56%, 24rem); padding-block: 3.5rem; }
.stage-logo svg { display: block; width: 100%; height: auto; }

.stage-wordmark {
  padding-block: 3rem;
  font: var(--type-mark);
  letter-spacing: -.04em;
}

.desk {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0 1rem 1.5rem;
}

.desk-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .25rem 1rem; min-height: 1.5rem; padding-block: .5rem 1.5rem; }
.desk-top a { display: inline-block; padding: .75rem .25rem; }

.desk-body { width: 100%; max-width: 26rem; margin-inline: auto; }

@media (min-width: 60em) {
  .entrance { grid-template-columns: minmax(0, 11fr) minmax(30rem, 9fr); grid-template-rows: none; }
  .stage { position: sticky; top: 0; height: 100vh; height: 100dvh; container-type: size; }
  .stage-media { height: 100%; aspect-ratio: auto; scale: none; }
  .stage-logo { width: min(50%, 30rem); padding: 0; }
  .desk { padding: 1rem 3rem 3rem; }
  .desk-body { align-self: center; }
  .desk-top { min-height: 3rem; padding-block: 0 1rem; }
}

@container (max-aspect-ratio: 1 / 2) {
  .stage-media { object-fit: contain; }
}

/* A working page (suppliers/registration.html): the logo and Sair in one bar in place of the
   brand field, its edges in line with the content column; 3.5rem tall, the Sair target plus
   padding. 15.5rem of a wide logo is about 2.5rem tall, so its small lettering stays readable;
   the logo shrinks first on a narrow phone. */
.bar {
  --link: var(--on-brand);
  --focus: var(--on-brand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .375rem max(1rem, (100% - 26rem) / 2);
  background: var(--brand);
  color: var(--on-brand);
}
.bar-mark { flex: 0 1 15.5rem; min-width: 0; font: var(--type-h2); }
.bar-mark svg { display: block; width: 100%; height: auto; }
.bar a { display: inline-flex; align-items: center; min-height: 2.75rem; margin-inline-end: -.5rem; padding-inline: .5rem; }
.entrance-bar .desk-body { padding-top: 1.5rem; }
.entrance-bar .desk-top { width: 100%; max-width: 26rem; margin-inline: auto; padding-bottom: 0; }

@media (min-width: 60em) {
  .entrance-bar { grid-template-columns: none; grid-template-rows: auto 1fr; }
  .entrance-bar .desk-body { align-self: start; }
}

/* Copy */

h1 {
  margin: 0 0 .5rem;
  font: var(--type-title);
  letter-spacing: -.025em;
  text-wrap: balance;
}

h2 { margin: 2rem 0 .75rem; font: var(--type-h2); }

/* Tracking breaks the joined letters of Arabic and the head line of Devanagari; their marks
   need taller lines. */
h1:is(:lang(ar), :lang(hi)) { letter-spacing: normal; line-height: 1.4; }

p { margin: 0 0 1rem; text-wrap: pretty; }

.lead { margin-bottom: 2rem; color: var(--muted); }
h1 + .form { margin-top: 1.75rem; }

.aside { margin: 2rem 0 0; color: var(--muted); font: var(--type-small); }

strong { font-weight: 600; overflow-wrap: anywhere; }

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  transition: text-decoration-thickness .15s;
}
a:hover { text-decoration-thickness: 2px; }

code, .key { font: var(--type-code); }

/* Forms. allauth's own pages use bare <p><label><input> and <button>; ours use .field. */

form { margin: 0; }
form + form { margin-top: .75rem; }

.field, .desk-body form > p { margin: 0 0 1.25rem; }

label, legend { display: block; margin-bottom: .5rem; font: var(--type-label); }
fieldset { min-width: 0; padding: 0; border: 0; }
legend { padding: 0; }

/* The public request form's privacy notice: read before the box that says it was read. */
.notice { margin: 2rem 0 1.25rem; color: var(--muted); font: var(--type-small); }
.notice h2 { margin-top: 0; color: var(--ink); }
.notice p { margin-bottom: .75rem; }

input:is([type="email"], [type="password"], [type="text"], :not([type])),
textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 3rem;
  padding: .625rem .875rem;
  border: 1px solid var(--control);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--ink);
  font: inherit;
  transition: border-color .15s;
}
input:hover, textarea:hover { border-color: var(--ink); }
input:focus-visible, textarea:focus-visible { border-color: var(--ink); }
/* allauth sets each field's label as its placeholder too; the visible label already says it. */
input::placeholder { color: transparent; }
:is(input, textarea)[aria-invalid="true"] { border-color: var(--err); }
/* Addresses, codes and phone numbers read left to right in every language; in a right-to-left
   page they keep the form's right edge. */
input:is([type="email"], [type="tel"], [inputmode="tel"], [autocomplete="one-time-code"]) { direction: ltr; }
[dir="rtl"] input:is([type="email"], [type="tel"], [inputmode="tel"], [autocomplete="one-time-code"]) { text-align: right; }

.check { display: flex; align-items: center; gap: .75rem; min-height: 2.75rem; flex-wrap: wrap; }
.check label, p > input[type="checkbox"] + label { display: inline; margin: 0; font: var(--type-body); color: var(--muted); cursor: pointer; user-select: none; }
.check > .errorlist { flex-basis: 100%; margin: 0; }
.check label { flex: 1; padding-block: .5rem; }

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  border: 1.5px solid var(--control);
  border-radius: .375rem;
  background: var(--field);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
input[type="checkbox"]:hover { border-color: var(--ink); }
input[type="checkbox"]:checked {
  border-color: #22d3ee;
  background: #22d3ee url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23041d24' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5 6.5 11.5 12.5 4.5'/%3E%3C/svg%3E") center / .82rem no-repeat;
}

.check input[type="checkbox"]#id_remember {
  width: 2.5rem;
  height: 1.375rem;
  border-radius: 999px;
  border: 1px solid var(--control);
  background: var(--surface);
  background-image: none;
}
.check input[type="checkbox"]#id_remember::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: var(--muted);
  transition: translate .18s cubic-bezier(.22, 1, .36, 1), background-color .15s ease;
}
.check input[type="checkbox"]#id_remember:checked {
  border-color: #22d3ee;
  background: #22d3ee;
  background-image: none;
}
.check input[type="checkbox"]#id_remember:checked::after {
  translate: 1.125rem 0;
  background: #041d24;
}
.check:has(#id_remember:checked) label { color: var(--ink); }

.help { margin: .5rem 0 0; color: var(--muted); font: var(--type-small); }
/* Lone links and the remember row are 44px tall: suppliers sign in on phones. */
.help > a, .aside > a:only-child { display: inline-flex; align-items: center; min-height: 2.75rem; }
.check { min-height: 2.75rem; flex-wrap: wrap; }
.check > .errorlist { flex-basis: 100%; margin: 0; }
.check label { flex: 1; padding-block: .75rem; }
.help ul { margin: 0; padding-inline-start: 1.25rem; }

.errorlist { margin: .5rem 0 0; padding: 0; list-style: none; color: var(--err); font: var(--type-small); }
.errorlist li { display: flex; gap: .5rem; }
.errorlist li::before {
  content: "";
  flex: none;
  width: 1rem;
  height: 1rem;
  margin-top: .2rem;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0Zm-.9 3.5.2 6h1.4l.2-6H7.1Zm.9 7.6a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0Zm-.9 3.5.2 6h1.4l.2-6H7.1Zm.9 7.6a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.alert, .messages {
  margin: 0 0 1.5rem;
  padding: .75rem 1rem;
  border: 1px solid color-mix(in oklab, var(--err) 40%, transparent);
  border-radius: .375rem;
  background: var(--err-bg);
}
.alert .errorlist { margin: 0; color: var(--ink); }
.alert .errorlist li::before { color: var(--err); }
.messages { list-style: none; border-color: var(--line); background: var(--surface); }
.messages > [data-intent="error"] { color: var(--err); }

button, .button {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 3rem;
  padding: .5rem 1.25rem;
  border: 1px solid var(--action);
  border-radius: var(--radius);
  background: var(--action);
  color: var(--action-ink);
  font: var(--type-button);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, translate .1s;
}
button:hover, .button:hover { border-color: var(--action-hover); background: var(--action-hover); }
button:active, .button:active { translate: 0 1px; }

:is(button, .button).secondary { border-color: var(--control); background: transparent; color: var(--ink); }
:is(button, .button).secondary:hover { border-color: var(--ink); background: var(--surface); }

.actions { display: grid; gap: .75rem; margin-top: 1.5rem; }
.form > button, .desk-body form > button { margin-top: 1.75rem; }

/* TOTP enrolment: the QR on white in both themes (scanners need dark on light), the key in full. */
.steps { margin: 0 0 1.5rem; padding-inline-start: 1.25rem; }
.steps li { margin-bottom: .75rem; padding-inline-start: .25rem; }
.qr { display: block; box-sizing: border-box; width: 11rem; margin: .75rem 0 0; padding: .625rem; border-radius: .5rem; background: var(--qr-ground); }
.qr img { display: block; width: 100%; height: auto; }
.key {
  display: block;
  margin-top: .5rem;
  padding: .625rem .875rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
  overflow-wrap: anywhere;
  user-select: all;
}

/* Recovery codes: two columns of one-time codes, selectable as a block. */
.codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem 1.5rem;
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
  list-style: none;
  font: var(--type-code);
  font-variant-numeric: tabular-nums;
  user-select: all;
}

/* The supplier's registration page (suppliers/registration.html): facts, one line per document,
   and the select and file inputs at the width of the text inputs. */
select, input[type="file"] {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 3rem;
  padding: .625rem .875rem;
  border: 1px solid var(--control);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--ink);
  font: inherit;
}
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .25rem 1rem; margin: 0 0 1.5rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.doc-lines { margin: 0 0 2rem; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.doc-lines > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .25rem 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--line);
}
.doc-state { font: var(--type-label); }
.doc-lines > :is([data-state="missing"], [data-state="rejected"], [data-state="expired"]) .doc-state { color: var(--err); }
.doc-more { grid-column: 1 / -1; color: var(--muted); font: var(--type-small); overflow-wrap: anywhere; }
.reason { white-space: pre-line; overflow-wrap: anywhere; }

/* The language selector (_language.html): label, list and button on one line, 44px targets. */
.language { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.language label { margin: 0; color: var(--muted); font: var(--type-small); }
.language select, .language button { width: auto; min-height: 2.75rem; }
.language select { padding: .375rem .625rem; }
.language button { padding: .375rem .875rem; font: var(--type-small); }

/* The RFQ invitation page (procurement/answer/page.html): the items table, its price inputs and
   the bid receipt. contain: inline-size keeps the table's width out of the page's: the page never
   scrolls sideways; a table wider than the column scrolls inside this named, focusable region. */
.table-scroll {
  contain: inline-size;
  width: 100%;
  margin: 0 0 1.5rem;
  overflow-x: auto;
}
.table-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grid caption { margin-bottom: .5rem; font: var(--type-label); text-align: start; }
.grid :is(th, td) { padding: .5rem 0; padding-inline-end: .5rem; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.grid th { font: var(--type-label); }
.grid [data-kind="num"] { text-align: end; white-space: nowrap; }
.grid input { min-width: 6.5rem; min-height: 2.75rem; text-align: end; }
.files { padding-inline-start: 1.25rem; overflow-wrap: anywhere; }

@media (forced-colors: active) {
  input[type="checkbox"] { appearance: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
