/*
 * YCE Portal — sign-in and launcher.
 *
 * Loads AFTER app.css, which owns the palette, both themes, the buttons, the
 * message states and the browser surfaces. Nothing here redefines a colour:
 * the portal is the first thing an agent sees and FormFlow is the second, so
 * a second palette would be a seam they notice.
 *
 * Only what the portal has and the form does not lives here.
 */

/* The portal is a single centred card at every width, not a stepped form, so
   it gets the sheet treatment sooner than app.css applies it. */
body.portal {
  background: var(--page);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1.15rem;
}
@media (min-width: 40rem) { body.portal { align-items: center; padding: 2rem; } }

body.portal main {
  width: 100%;
  max-width: 27rem;
  margin: 0;
  padding: 1.75rem 1.5rem;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: .9rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04),
              0 12px 32px -12px rgba(15, 23, 42, .12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.portal main {
    box-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 36px -14px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] body.portal main {
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 36px -14px rgba(0, 0, 0, .6);
}

.portal-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.portal-head h1 {
  font-size: 1.3rem;
  line-height: 1.25;
  letter-spacing: -.015em;
  margin: 0;
}
.portal-head #theme-toggle { margin-left: auto; }

p.sub { color: var(--muted); font-size: .925rem; line-height: 1.5; margin: -.9rem 0 1.6rem; }

/* ------------------------------------------------------------- sign in */
a.btn {
  display: block;
  text-align: center;
  background: var(--brand);
  color: var(--brand-ink);
  text-decoration: none;
  padding: .85rem 1rem;
  min-height: var(--tap);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1.05rem;
}
a.btn:hover { filter: brightness(1.07); }

/*
 * Four outcomes land in this one element, and until now all four looked the
 * same: muted grey, indistinguishable from "waiting…". "That number isn't
 * registered" is a dead end needing a manager, and it read as progress.
 *
 * Waiting stays quiet. Everything else gets the weight it has earned.
 */
.status { margin-top: 1.1rem; color: var(--muted); font-size: .925rem; line-height: 1.45; }
.status.err, .status.warn, .status.ok {
  padding: .7rem .85rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
}
/* Not registered: they cannot fix this themselves. */
.status.err  { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-ln); }
/* Expired: annoying, but a reload fixes it. */
.status.warn { background: var(--warn-bg);   color: var(--warn);   border-color: var(--warn-ln); }
.status.ok   { background: var(--ok-bg);     color: var(--ok);     border-color: var(--ok-ln); }

.manual, .qr {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.6;
}
.manual strong { color: var(--ink); }
.manual code {
  display: inline-block;
  margin-top: .4rem;
  padding: .35rem .6rem;
  border-radius: .35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  letter-spacing: .06em;
}
.code-row {
  display: flex;
  align-items: stretch;   /* so the code box and the button match height */
  gap: .5rem;
  margin: .5rem 0 .35rem;
}
/* Reset what .manual code sets, rather than adding to it — stacking the two
   made the code 69px tall beside a 44px button. */
.code-row code {
  margin: 0;
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 .7rem;
}
.code-row button.copy {
  width: auto;
  min-width: 4.5rem;
  flex: none;
  padding: .5rem .8rem;
  font-size: .875rem;
  /* Not shrunk below the tap floor. This is the button an agent reaches for
     when the WhatsApp link did not open — the fallback path, on a phone,
     probably already mildly annoyed. It is not the place to save 8px. */
  min-height: var(--tap);
}


/* The QR is for someone at a desk scanning with their phone. On a phone it is
   an instruction to scan the screen you are holding. */
.qr img {
  width: 170px;
  height: 170px;
  display: block;
  margin: .8rem auto 0;
  padding: .5rem;
  background: #fff;      /* a QR needs a light quiet zone in either theme */
  border-radius: .5rem;
}
@media (max-width: 40rem) { .qr { display: none; } }

details { margin-top: 1.5rem; }
details summary {
  cursor: pointer;
  color: var(--link);
  font-size: .9rem;
  font-weight: 600;
  min-height: var(--tap);
  display: flex;
  align-items: center;
}
.fallback { display: grid; gap: .6rem; margin-top: .5rem; }
.fallback input {
  width: 100%;
  min-height: var(--tap);
  padding: .65rem .75rem;
  border: 1px solid var(--line-firm);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  caret-color: var(--brand);
}
.fallback input:focus { border-color: var(--focus); }

.err {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-ln);
  padding: .7rem .85rem;
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.45;
  margin-bottom: 1.1rem;
}

/* ------------------------------------------------------------ launcher */
.apps { display: grid; gap: .75rem; }
@media (min-width: 34rem) { .apps { grid-template-columns: 1fr 1fr; } }

a.app, div.app {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line-firm);
  border-radius: .7rem;
  padding: 1.05rem 1.1rem;
  background: var(--bg);
}
a.app { border-color: var(--brand); }
a.app:hover { background: var(--brand-dim); }
.app .label { font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; }
.app .blurb { color: var(--muted); font-size: .875rem; margin-top: .2rem; line-height: 1.45; }
/*
 * Planned but not built: visibly inert rather than a link that 404s.
 *
 * NOT opacity. A blanket alpha dimmed the words explaining why the card is
 * inert down to 2.81:1 — it made "Coming soon" the least readable thing on
 * the card. These are not disabled controls, which contrast rules exempt;
 * they are information. So the recession comes from colour and elevation,
 * and every word stays above the floor.
 */
div.app {
  background: var(--surface);
  border-color: var(--line);
  border-style: dashed;
}
div.app .label { color: var(--muted); font-weight: 600; }
div.app .soon {
  font-size: .7rem;
  color: var(--muted);
  margin-top: .5rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 700;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line-firm);
  border-radius: .7rem;
  padding: 1.25rem;
  font-size: .925rem;
  line-height: 1.5;
}

/* The launcher's footer is app.css's, so it matches FormFlow's. Sign out is
   a POST here, so it is a button, drawn as the footer link FormFlow has. */
footer form { margin: 0 0 0 auto; }
footer form button {
  background: none;
  border: 0;
  color: var(--link);
  font: inherit;
  padding: 0;
  width: auto;
  /* min-height:0 used to sit here, deliberately overriding the global
     button rule to keep this looking like a text link. It also made it an
     18px-high target — below WCAG 2.2's 24px AA minimum and well below this
     project's own 44px floor. Same fix as the app's chrome links: extend the
     hit area, leave the type alone. */
  min-height: 0;
  position: relative;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
footer form button::after {
  content: "";
  position: absolute;
  inset: -.85rem -.4rem;
}
footer form button:hover { filter: none; }

