/*
  The identity is Mandu's —the People & Payroll product whose credentials
  this page delivers— and the values come from the platform's real preset
  (`packages/ui/src/styles/theme-mandu.css`), copied verbatim: this page is
  vanilla with no dependencies by security decision, so coherence with
  the brand is maintained by copying values, not by importing the package. If the preset
  changes, this is updated by hand; it is the price of letting no
  dependency in here.

  That the page looks like Mandu is not cosmetic: whoever opens it arrived from an
  email, and having the email, the page and the product they already know share
  an identity is part of the defense against impersonation.

  No remote fonts: the CSP forbids any external origin, and besides, a
  slow font is a page that flickers with a secret inside.
*/
:root {
  --page: hsl(40 30% 91%);
  --paper: hsl(44 40% 98%);
  --text: hsl(165 22% 9%);
  --subdued: hsl(183 16% 33%);
  --line: hsl(155 18% 78%);
  --brand: hsl(180 100% 14%);        /* --mandu-teal */
  --brand-hover: hsl(180 80% 20%);
  --on-brand: hsl(44 40% 96%);
  --brand-detail: hsl(79 60% 67%);   /* --mandu-lima */
  --field: hsl(42 24% 88%);
  --bad: hsl(8 78% 38%);
  --bad-soft: hsl(8 70% 96%);
  --bad-border: hsl(8 55% 82%);
  --ok: hsl(150 65% 22%);
  --ok-soft: hsl(140 40% 94%);
  --ok-border: hsl(140 30% 76%);
  --shadow: 0 1px 2px rgb(22 42 36 / 0.06), 0 4px 16px rgb(22 42 36 / 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: hsl(160 16% 7%);
    --paper: hsl(160 14% 10%);
    --text: hsl(43 24% 92%);
    --subdued: hsl(150 8% 62%);
    --line: hsl(160 12% 18%);
    --brand: hsl(79 60% 67%);        /* --mandu-lima: in dark the brand inverts */
    --brand-hover: hsl(79 60% 58%);
    --on-brand: hsl(160 16% 8%);
    --brand-detail: hsl(180 100% 14%);
    --field: hsl(160 12% 13%);
    --bad: hsl(0 70% 68%);
    --bad-soft: hsl(0 60% 60% / 0.08);
    --bad-border: hsl(0 60% 60% / 0.25);
    --ok: hsl(140 45% 62%);
    --ok-soft: hsl(140 45% 55% / 0.08);
    --ok-border: hsl(140 45% 55% / 0.25);
    --shadow: none;
  }
}

* { box-sizing: border-box; }

/*
  **`hidden` has to always win.** The attribute only applies `display: none`
  from the browser stylesheet, so any author `display` —the `flex`
  of `.notice`, the `block` of the error— overrides it and the "hidden" element is drawn
  anyway: that is how an empty red box appeared below the code button. This
  whole page works by showing and hiding sections with `hidden`, so
  this reset is not cosmetic: it is the contract `app.js` depends on.
*/
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  padding: 3rem 1rem;
  background: var(--page);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, 'Segoe UI', sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.card {
  width: 100%;
  max-width: 26rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* ── Header ───────────────────────────────────────────────────────────────── */

.header {
  text-align: center;
  margin-bottom: 1.75rem;
}

/* The logo inherits the brand color: teal in light, lime in dark — the same
   contract that `currentColor` fulfills across the platform. It lives in the footer, so
   it carries no margin: `.footer`'s `padding-top` separates it. */
.logo {
  color: var(--brand);
}

/* Signature size, not header size: it accompanies without competing with the title. */
.logo svg {
  width: 7rem;
  height: auto;
  display: block;
}

h1 {
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--subdued);
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.375rem;
}

/* The programmatic focus on step change needs no ring: it is not a control. */
section:focus-visible { outline: none; }

p { margin: 0 0 1rem; }

.step-indicator {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--subdued);
}

/* ── Fields ───────────────────────────────────────────────────────────────── */

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin: 1rem 0 0.375rem;
}

input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  margin-bottom: 1rem;
  background: var(--field);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  font: inherit;
}

input::placeholder { color: var(--subdued); opacity: 0.7; }

/*
  The six-digit code: a single input treated as what it holds. The six
  boxes of shadcn `input-otp` were evaluated and discarded: in vanilla
  they require their own JS to paste, navigate and announce, and every new line here
  runs with a secret in memory. A single input keeps pasting,
  `autocomplete="one-time-code"` and the screen reader for free.
*/
input.code {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, monospace;
  font-size: 1.375rem;
  letter-spacing: 0.45em;
  text-align: center;
  padding: 0.75rem;
  font-variant-numeric: tabular-nums;
}

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

/* ── Buttons ──────────────────────────────────────────────────────────────── */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--brand);
  color: var(--on-brand);
  border: 0;
  border-radius: 0.5rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

button:hover { background: var(--brand-hover); }

button svg { width: 1rem; height: 1rem; flex: none; }

/* The step's action takes the full width: on this page there is always just one
   thing to do, and the button says so with its size. */
button.primary { width: 100%; }

button.small {
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
  background: transparent;
  color: var(--subdued);
  border: 1px solid var(--line);
}

button.small:hover { background: var(--field); color: var(--text); }

/* ── Notices (success, error, final states) ───────────────────────────────── */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem;
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  margin-bottom: 1.25rem;
}

.notice svg { width: 1.125rem; height: 1.125rem; flex: none; margin-top: 0.125rem; }

.notice p { margin: 0; }
.notice .help { margin-top: 0.125rem; }

.notice-title { font-weight: 600; font-size: 0.9375rem; }

.notice-error {
  border-color: var(--bad-border);
  background: var(--bad-soft);
}
.notice-error svg, .notice-error .notice-title { color: var(--bad); }

.notice-ok {
  border-color: var(--ok-border);
  background: var(--ok-soft);
}
.notice-ok svg, .notice-ok .notice-title { color: var(--ok); }

/* The code error arrives with structure inside (title + list + paragraph). */
.notice ul { margin: 0.375rem 0 0.5rem; padding-left: 1.125rem; }
.notice li { margin-bottom: 0.25rem; font-size: 0.875rem; }
.notice strong { display: block; font-size: 0.9375rem; color: var(--bad); }

/*
  The code error carries no icon and `app.js` gives it three direct children
  (title, list, paragraph): with the generic `.notice` flex-row they ended up as
  three columns. Here the layout is block and the children stack.
*/
#code-error { display: block; margin-top: 0; }
#code-error p { margin: 0; font-size: 0.875rem; }

/* ── The credentials: one bordered row per datum, like the platform's `Item`s.
      It is what the person came looking for and each value has its
      place, not a run-on definition. ───────────────────────────────────────── */

.items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
}

.item {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  background: var(--field);
}

.item dt {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--subdued);
  margin-bottom: 0.25rem;
}

.item dd {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.item-actions { display: inline-flex; gap: 0.375rem; }

/* Monospaced for what has to be copied without mistakes: telling 0 from O
   matters when pasting into an SFTP client. */
.mono {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, monospace;
  font-size: 0.9375rem;
  word-break: break-all;
}

.masked { letter-spacing: 0.1em; }
.help { font-size: 0.875rem; color: var(--subdued); }
.bad { color: var(--bad); }
.ok { color: var(--ok); font-weight: 500; }

/* ── Footer ───────────────────────────────────────────────────────────────── */

/* The footer is the brand signature: no text, no icon, just the centered logo.
   `.footer svg` deliberately carries no dimensions of its own — `.logo svg` sets them, and
   a rule here would shrink the logo again to the size of the icon it had before. */
.footer {
  display: flex;
  justify-content: center;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

#loading { text-align: center; margin: 1rem 0 0; }

@media (max-width: 420px) {
  body { padding: 1rem 0.75rem; }
  .card { padding: 1.5rem 1.25rem; }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 0.15s; }
}
