/* The sign-in page (/login), the join page (/join/<code>) and the account page (/account). They
   stand outside the app shell, and are drawn with the shared kit from styles.css (.card .btn
   .field .input .banner .pill .meta .lead .h1 .h3 .err-detail) and its tokens. What is here is
   only what those pages need on top: .lg-* is shared by all three, .jn-* is the join page's,
   .ac-* the account page's. No colors of its own
   (but for Google's and GitHub's, on their buttons, which are theirs to say), and no bare
   element selectors. Every state has an icon or words as well as its tint. */

/* ── all three pages ─────────────────────────────────────────────────────────────────────── */

.lg-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: -.01em;
  color: var(--ink);
}

.lg-panel { display: flex; flex-direction: column; gap: var(--sp-3); }
.lg-explain { display: flex; flex-direction: column; gap: var(--sp-2); }
.lg-explain .lead { font-size: 15px; }
.lg-form { display: flex; flex-direction: column; gap: var(--sp-3); }
/* Otherwise the iOS keyboard scrolls a focused field to the very edge of what's visible, with
   its label above the screen. */
.lg-form .input { scroll-margin-block: var(--sp-5); }
.lg-code { letter-spacing: .14em; font-weight: 600; }

.lg-sep {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-top: var(--sp-1);
  color: var(--ink-3);
  font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase;
}
.lg-sep::before, .lg-sep::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }

/* A message: an icon and words. The icon carries the kind (a circled i, a warning triangle, a
   circled tick), so the tint is never the only signal. */
.lg-msg {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 14px; line-height: 1.45;
}
.lg-msg svg {
  flex: 0 0 auto; width: 17px; height: 17px; margin-top: 2px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.lg-msg-err { background: var(--warn-soft); color: var(--warn); }
.lg-msg-ok { background: var(--ok-soft); color: var(--ok); }

/* A button that is asking "are you sure": its words change too. One that is about to destroy
   something fills with the warning color, as the app's other deletes do when they ask. */
.lg-armed { color: var(--accent); font-weight: 700; border-color: var(--accent); }
.btn.lg-armed.lg-destroys { background: var(--warn); border-color: var(--warn); color: var(--ground); }
.btn.lg-armed.lg-destroys .ac-ico { color: inherit; }

/* Google's and GitHub's buttons. Each mark is the provider's own file or drawing, 20 high as
   Google asks, and never recolored by a theme.
   Google's G must sit on white, or on #131314 in a dark theme, with Google's outline and text
   colors (developers.google.com/identity/branding-guidelines), so that button takes those
   instead of the kit's surface. GitHub's mark is black or white only. */
.lg-mark { flex: 0 0 auto; width: auto; height: 20px; }
.btn > svg.lg-mark { width: 20px; }
.lg-mark-github { fill: #000; }
[data-lum="dark"] .lg-mark-github { fill: #fff; }
.btn.lg-google, .btn.lg-google:active { gap: 10px; background: #fff; border-color: #747775; color: #1f1f1f; }
[data-lum="dark"] .btn.lg-google, [data-lum="dark"] .btn.lg-google:active { background: #131314; border-color: #8e918f; color: #e3e3e3; }
.btn.lg-google[disabled] { color: rgba(31, 31, 31, .38); }
[data-lum="dark"] .btn.lg-google[disabled] { color: rgba(227, 227, 227, .38); }
.btn.lg-google[disabled] .lg-mark { opacity: .38; }

.lg-spin {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: lg-rot .7s linear infinite;
}
@keyframes lg-rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .lg-spin { animation-duration: 2.4s; } }

/* ── the sign-in page ───────────────────────────────────────────────────────────────────── */

/* With the keyboard up, the foot padding is dead space above the keys. */
body[data-kb="1"] .lg-page { padding-bottom: var(--sp-3); }

/* A column, so the wordmark sits at the top while the controls stay centered. Both lay out
   against the same 420px measure. */
.lg-page {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--sp-5) + var(--safe-top));
  padding-bottom: calc(var(--sp-6) + var(--sa-bottom));
  padding-left: max(var(--sp-4), var(--sa-left));
  padding-right: max(var(--sp-4), var(--sa-right));
}
/* margin: auto, not justify-content: center. A centered flex item taller than its scroller has
   its top clipped out of reach, which is what the iOS keyboard does to a form. */
.lg-wrap {
  width: 100%;
  max-width: 420px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
/* Where the wordmark sits: top left, on the same measure as everything below it, with its
   height held so filling it moves nothing. */
.lg-brand {
  flex: 0 0 auto;
  width: 100%;
  max-width: 420px;
  margin: 0 auto var(--sp-4);
  min-height: 26px;
}
.lg-stack { display: flex; flex-direction: column; gap: var(--sp-2); }
/* The sign-in screen's line saying what this is (login.html #signin-what): the page's own voice, above the ways in. */
.lg-what { margin: 0 0 var(--sp-2); font-size: 18px; line-height: 1.4; font-weight: 500; color: var(--ink); text-wrap: pretty; }
/* Held back until the page knows what it is (login.html, data-wait). Everything keeps its
   place while unseen, so it appears where it will stay. The two boxes themselves are held,
   not only what is in them: the column re-centers as its screens are chosen, and a box that
   counts as shown counts as moving. */
.lg-page[data-wait] > .lg-brand, .lg-page[data-wait] > .lg-wrap { visibility: hidden; animation: lg-held 0s 4s forwards; }
.lg-page[data-wait] > .lg-wrap > noscript { visibility: visible; }
/* The wait ends by itself after four seconds: a script that is slow to arrive, or never does,
   must not leave a blank page. A delay, not a duration, so it holds with reduced motion too. */
@keyframes lg-held { to { visibility: visible; } }
/* The script couldn't be fetched (login.html): only the words saying so, and a way to try again. */
.lg-page[data-failed] > .lg-wrap > :not(#no-script) { display: none; }
.lg-failed { display: flex; flex-direction: column; gap: var(--sp-3); }
.lg-failed[hidden] { display: none; }

/* The ways in (login.html #p-signin), as Lexicommons' sign-in page lays them out: a quiet line
   saying what this is, then each way as one button among alike ones (Google's keeps its own
   colors, above), a little raised so it reads as something to press. */
.lg-ways { display: flex; flex-direction: column; gap: var(--sp-3); }
.lg-ways form { margin: 0; }
.lg-ways-title { margin: 0; color: var(--ink-2); font-size: 14px; font-weight: 500; line-height: 1.3; }
.btn.lg-way {
  min-height: 52px; margin-bottom: 3px;
  border-width: 2px; border-radius: var(--r-md);
  box-shadow: 0 3px 0 var(--line-strong);
  transition: transform 70ms var(--ease-out), box-shadow 70ms var(--ease-out);
}
.btn.lg-way.lg-google { border-width: 1px; }
.btn.lg-way:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line-strong); }
.lg-mark-key { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn > svg.lg-mark-key { width: 22px; height: 22px; }
/* The one way forward once a form is open: making the account. */
.btn.lg-go { min-height: 52px; font-size: 16px; font-weight: 700; }

/* Making an account with a passkey: a row that opens the form under it. */
.lg-new > summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  min-height: var(--tap);
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  list-style: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lg-new > summary::-webkit-details-marker { display: none; }
.lg-new > summary svg {
  flex: 0 0 auto; width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  color: var(--ink-3); transition: rotate var(--dur-fast) var(--ease-out);
}
.lg-new[open] > summary svg { rotate: 90deg; }
.lg-new > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.lg-new > .lg-form { padding: var(--sp-1) 0 var(--sp-2); }

/* On a phone the ways sit low, in a thumb's reach, with the wordmark at the top; on a wide
   screen the page stays centered. */
@media (max-width: 600px) {
  body[data-login-page] .lg-wrap { margin: 0 auto; flex: 1 0 auto; }
  body[data-login-page] #p-signin { flex: 1 0 auto; }
  body[data-login-page] #p-signin > .lg-ways { margin-top: auto; }
}

/* ── the join page (/join/<code>) ───────────────────────────────────────────────────────── */

/* A trip's name is whatever its people typed, up to 80 characters, with or without spaces. */
.jn-name { overflow-wrap: anywhere; }
/* Join, signed out: the largest control on the page, so a friend opening the link sees what to
   press before anything else. */
.btn.jn-join { min-height: 52px; font-size: 17px; }
/* Signing in instead: a line of words under Join, its link a full thumb's height. */
.jn-have { text-align: center; font-size: 14px; }
.jn-link {
  display: inline-flex; align-items: center; min-height: var(--tap);
  padding: 0 var(--sp-1);
  color: var(--accent); font-weight: 650; text-decoration: none;
}

/* ── the account page ───────────────────────────────────────────────────────────────────── */

/* The shell's body is one fixed screen with its own scroller inside. This page is an ordinary
   document that scrolls, so the browser itself keeps a focused field above the keyboard. */
body[data-account-page] {
  display: block;
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

.ac-page {
  box-sizing: border-box;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--sp-5) + var(--safe-top)) max(var(--sp-4), var(--sa-right))
           calc(var(--sp-6) + var(--sa-bottom)) max(var(--sp-4), var(--sa-left));
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.ac-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
/* The wordmark's own shape (818.87 x 140), so the row is the right height before the drawing arrives. */
.ac-brand { flex: 0 0 auto; width: 170px; min-height: calc(170px * 140 / 818.87); }
.ac-brand svg { display: block; width: 100%; height: auto; }

.ac-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
.ac-col { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
/* Wide enough for two: who you are and leaving on the left, the ways in on the right. */
@media (min-width: 900px) {
  .ac-page { max-width: 1040px; }
  .ac-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

.ac-card { display: flex; flex-direction: column; gap: var(--sp-3); }
.ac-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
/* A field with its button beside it, the button dropping below when there's no room. */
.ac-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); }
.ac-inline .field { flex: 1 1 200px; min-width: 0; }

.ac-ways { display: flex; flex-direction: column; }
.ac-way {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--line);
}
.ac-way:first-child { border-top: 0; padding-top: 0; }
.ac-ico {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  color: var(--ink-2);
}
.ac-way-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ac-way-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-weight: 650; }
.ac-way-label { overflow-wrap: anywhere; }
/* At 320 a row's middle is about 150 px: its pill ("On one device only") wraps rather than run past it. */
.ac-way-title > * { min-width: 0; max-width: 100%; }
.ac-way-title .pill { white-space: normal; }

/* The button that deletes the account: the warning color and a bin, never the accent. */
.btn.ac-destroy { color: var(--warn); }
.btn.ac-destroy .ac-ico { width: 18px; height: 18px; margin-top: 0; color: inherit; }

/* What goes and what stays when an account is deleted: each line starts with its own mark. */
.ac-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.ac-list-row { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.ac-list-row .ac-ico { width: 18px; height: 18px; margin-top: 2px; }

/* ── AI apps: how to connect one (#ai-apps) ─────────────────────────────────────────────
   A button that opens and folds it (aria-expanded): open while nothing is connected, "Connect
   another app" once something is. The address and Claude Code's line are code, wrapping anywhere at 320 rather than running
   off the card; each Copy sits beside what it copies. Tokens only. */
.ac-connect { border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.ac-connect-sum {
  display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); width: 100%;
  padding: 0; border: 0; background: none; text-align: left;
  font: inherit; font-weight: 650; color: var(--accent); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ac-connect-sum::before {
  content: ""; width: 8px; height: 8px; margin: 0 4px 0 2px; flex: 0 0 auto;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
  transition: transform .15s;
}
.ac-connect-sum[aria-expanded="true"]::before { transform: rotate(45deg); }
.ac-connect-sum:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.ac-connect-body[hidden] { display: none; }
.ac-connect-body { display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-2); }
.ac-label { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.ac-sub { margin: var(--sp-3) 0 0; font-size: 15px; font-weight: 650; color: var(--ink); }
/* A code box or an ask beside its Copy while the row holds both at a readable width; on a narrow
   screen or with larger text, Copy goes under it and the text keeps the row (the address breaks
   only after its "://", never inside a word: account.js). */
.ac-copyrow { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-2); }
.ac-code {
  flex: 1 1 calc(26ch + 26px); min-width: 0; padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  font: 13.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere; user-select: all;
}
.ac-code .ac-word { white-space: nowrap; }
.ac-copy { flex: 0 0 auto; min-width: 76px; }
.ac-asks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.ac-asks li {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-2); padding: 10px 12px;
  border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line);
}
.ac-ask { flex: 1 1 13em; min-width: 0; font-size: 14.5px; line-height: 1.45; color: var(--ink); }
.ac-ask::before { content: "“"; }
.ac-ask::after { content: "”"; }

/* Kilometers or miles, under the name (account.js paintUnits). */
.ac-units { margin-top: var(--sp-4); }
.ac-units-label { margin: 0 0 var(--sp-2); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ac-units-row { flex-wrap: wrap; overflow: visible; }
.ac-units .meta { margin-top: var(--sp-2); }

/* The assistant's month on the plan card, for the host: one line, then each trip they host with what
   it used (never per person). The amounts line up at the right; a narrow row puts them under the name. */
.ac-ai { display: flex; flex-direction: column; gap: var(--sp-2); }
.ac-ai[hidden] { display: none; }
.ac-ai-trips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ac-ai-trips[hidden] { display: none; }
/* Where a row is too narrow for both, the amounts go under the name, still at the right edge. */
.ac-ai-trips li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px var(--sp-3);
  padding: 8px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.ac-ai-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; color: var(--ink); font-weight: 600; }
.ac-ai-n { flex: 0 0 auto; margin-left: auto; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Where it goes: a town in another country's money, offered under the card's message (trip-people.js
   offerCurrencyOf). Words, then one button; nothing is added unless it is pressed. */
.ac-cur-offer { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); }
.ac-cur-offer[hidden] { display: none; }
.ac-cur-offer .meta { margin: 0; color: var(--ink); }

/* Your picture: your face at 96, and beside it the way to draw it (js/account-picture.js). */
.ac-pic { display: flex; align-items: center; gap: 16px; }
.ac-pic-main { display: grid; justify-items: start; gap: 8px; min-width: 0; }
/* The pad's circle on its way up into the face (320 ms), above the sheet that is leaving. */
.ac-pic-fly { position: fixed; z-index: 70; border-radius: 50%; overflow: hidden; transform-origin: 0 0; pointer-events: none; }
.ac-pic-fly > svg { display: block; width: 100%; height: 100%; }
