/*
 * Phylax sign-in styling.
 *
 * Rodauth emits Bootstrap-flavoured class names (form-group, form-control,
 * btn btn-primary) but ships no CSS, which is why the pages render as raw
 * HTML. Rather than pull in a whole framework for four form controls, this
 * styles exactly the markup Rodauth produces.
 *
 * This is the one screen every user of every connected application sees, and
 * often the only part of the estate they ever look at. It should read as
 * deliberate and trustworthy: a login page that looks broken teaches people
 * not to trust the thing asking for their password.
 *
 * Per-client instances will re-skin this via the custom properties below.
 * Keep colour and type decisions in :root so a client theme is a short
 * override rather than a fork.
 */

:root {
  --ink: #16202b;
  --ink-soft: #5a6672;
  --paper: #eef1f4;
  --card: #ffffff;
  --line: #d5dbe1;
  --accent: #2f5d8a;
  --accent-ink: #ffffff;
  --danger: #a8322a;
  --focus: #2f5d8a;
  --radius: 4px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e4e9ed;
    --ink-soft: #94a2ae;
    --paper: #131a21;
    --card: #1b242d;
    --line: #2b3742;
    --accent: #6ea8dc;
    --accent-ink: #0f1620;
    --danger: #e0736a;
    --focus: #6ea8dc;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  /* Column, explicitly. Rodauth renders the form and its footer links as
     sibling top-level elements, so the default row direction strings them
     across the page instead of stacking them. */
  flex-direction: column;
  align-items: center;
  padding: clamp(1.5rem, 8vh, 5rem) 1.25rem 3rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* The card. Rodauth renders a bare form, so the form itself is the card and
   any following content (footer links) sits beneath it in the same column. */
body > * {
  width: 100%;
  max-width: 25rem;
}

form.rodauth {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem 1.5rem;
  margin: 0 0 1.5rem;
}

.form-group { margin-bottom: 1.1rem; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  font-size: 0.97rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.form-control:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 0.65rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover { filter: brightness(1.08); }

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

/* Footer links ("Forgot Password?" and friends). Presented as quiet options,
   not as calls to action competing with the sign-in button. */
.rodauth-login-form-footer-links-heading,
h2 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
}

.rodauth-links,
ul.rodauth-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rodauth-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.92rem;
}

.rodauth-links a:hover { text-decoration: underline; }

.rodauth-links a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Flash messages: Rodauth reports both errors and notices through these. */
.flash-error, .alert-danger, .field_error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.flash-notice, .alert-notice, .alert-success {
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Masthead supplied by the layout. */
.phylax-masthead {
  margin: 0 0 1.25rem;
}

.phylax-masthead .service {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.phylax-masthead .tagline {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.phylax-footnote {
  margin: 1.75rem 0 0;
  font-size: 0.76rem;
  color: var(--ink-soft);
}

/*
 * The launcher (TW #1983): the authenticated landing, and the screen a client
 * is shown to demonstrate that several apps are one system. Same tokens as
 * the sign-in card — one product, not a second look. Everything below is
 * token-driven, so the existing dark-scheme block covers it with no extra
 * rules, and a per-client re-skin carries the launcher for free.
 */

.launcher-greeting {
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* Quiet section label, matching the footer-links heading treatment. */
.launcher-heading {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
}

.launcher-tiles {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* The anchor IS the card, so the whole tile is clickable — no bare links. */
.launcher-tile-link {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 120ms ease;
}

.launcher-tile-link:hover { border-color: var(--accent); }

.launcher-tile-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.launcher-tile-label {
  display: block;
  font-size: 0.97rem;
  font-weight: 600;
}

.launcher-tile-meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* Empty state: same card language — a designed answer, not leftover text. */
.launcher-empty {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  margin: 0 0 1.5rem;
}

.launcher-empty h1 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
}

.launcher-empty p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* Sign out: quieter than the tiles, but unmistakably a control — the
   ghost-quiet version failed in a live demo (nobody could find the way out).
   Separated by a rule line so it reads as the screen's exit, with the honest
   one-liner about site sessions right beside it. */
.launcher-signout {
  margin-top: 0.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.btn-signout {
  width: auto;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
}

.btn-signout:hover { border-color: var(--accent); }

.launcher-signout-note {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
