/* TheBridge — the door and the account page. Its own stylesheet; nothing borrowed. */
:root {
  --bg: #f4f7f7; --surface: #fff; --surface-2: #fafafa; --text: #242424; --muted: #616161;
  --line: #e1e1e1; --accent: #007b77; --accent-pressed: #00625f; --danger: #c4314b;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; }
button, input, select { font: inherit; }
.hidden, [hidden] { display: none !important; }

.door { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; }
/* The language, before anyone signs in (door.js renderLanguagePicker): the header's globe and the language's own
   name, over a native list. Top corner on the reading side's end, so it moves across for a right-to-left page. */
.door-language { position: fixed; top: 16px; inset-inline-end: 16px; z-index: 2; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 13px; border: 1px solid #dce5e4; border-radius: 10px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.door-language svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.door-language select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.door-language:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.door-language[aria-busy="true"] { opacity: .6; cursor: progress; }
.card { width: min(448px, 100%); min-height: 410px; padding: 48px 44px 42px; border: 1px solid #dce5e4; border-radius: 24px; background: var(--surface); box-shadow: 0 24px 70px rgb(39 39 42 / 9%); }
.card.wide { width: min(980px, 100%); min-height: 0; padding: 32px 36px 36px; }
/* A lockup, not text: it reads left to right in every language, as the shell's does (an Arabic page kept the
   logo crop's right edge and wrote "BridgeThe"). */
.brand { display: flex; align-items: center; justify-content: center; gap: 11px; min-height: 56px; margin-bottom: 20px; direction: ltr; unicode-bidi: isolate; }
.brand-crop { display: block; width: 62px; height: 56px; overflow: hidden; flex: 0 0 62px; }
.brand-crop img { display: block; width: auto; max-width: none; height: 56px; }
/* TheBridge's wordmark, as in the shell (process/theme.css): BR Slate "The", BR Turquoise "Bridge",
   at the BridgeRoads logo's medium weight (customer, 2026-10-23: the heavy black read as a different brand). */
.wordmark { display: inline-flex; align-items: baseline; color: #5a5b5d; font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.wordmark b { font: inherit; }
.wordmark b:last-child { color: #00a995; }
.card h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -.035em; line-height: 1.18; text-wrap: balance; }
.card h2 { margin: 24px 0 8px; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; opacity: .8; }
.copy { max-width: 330px; margin: 0 0 14px; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.error { display: block; margin: 0 0 12px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); font-size: 13px; }
.notice { margin: 0 0 12px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); font-size: 13px; }

label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
input[type=text], input[type=number], input[type=email], select { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); white-space: nowrap; cursor: pointer; }
.button:hover { background: var(--surface-2); }
.button:disabled { opacity: .55; cursor: wait; }
.button.primary { width: 100%; margin-top: 12px; color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.button.primary:hover { background: var(--accent-pressed); }
.button.small { min-height: 30px; padding: 0 10px; font-size: 12px; }
.button.link { border: 0; background: none; color: var(--muted); text-decoration: underline; min-height: 32px; margin-top: 10px; width: 100%; }
.microsoft { display: grid; grid-template-columns: 21px minmax(0, 1fr) 21px; align-items: center; gap: 12px; width: 100%; min-height: 48px; margin-top: 12px; padding: 0 14px; border: 1px solid #8c8c8c; border-radius: 2px; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 18%); color: #1f1f1f; font-size: 15px; font-weight: 600; cursor: pointer; }
.microsoft svg { width: 21px; height: 21px; }

/* Which organisation? The one column is the card's width, never the longest name's: a long company
   name wraps inside its button, and a tag is never squeezed or split (Sam, 2026-11-03: a long name
   with its "owner" tag pushed every button past the card's right edge). A tag that has no room left
   beside the name goes under it. */
.choices { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 8px; }
.choices .button { width: 100%; min-width: 0; flex-wrap: wrap; justify-content: flex-start; text-align: left; min-height: 52px; padding-block: 10px; white-space: normal; }
.choices .choice-name { flex: 1 1 10em; min-width: 0; overflow-wrap: anywhere; }
.choices .tag { flex: none; margin-left: 0; white-space: nowrap; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 3px; background: rgba(127, 127, 127, .18); font-size: 11px; }

/* Account page */
.account-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.account-nav a { color: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid rgba(127, 127, 127, .25); vertical-align: top; }
tr.review td { background: rgba(255, 193, 7, .12); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.row input, .row select { flex: 1 1 200px; width: auto; min-height: 36px; }
.row .button { min-height: 36px; }
.policy label { display: flex; gap: 8px; align-items: center; font-weight: 400; color: var(--text); }
.policy input[type=number] { width: 90px; min-height: 32px; display: inline-block; margin: 0 6px; }
ul.list { padding-left: 1.2em; font-size: 13px; }
ul.list li { margin-bottom: 4px; }

/* An invitation: more room than the sign-in card, the address on its own line, and a note set
   apart from the words (video review 2026-10-28). */
.card.invite { width: min(560px, 100%); padding: 52px 56px 48px; }
.card.invite h1 { margin-bottom: 14px; }
.card.invite .copy { max-width: none; margin: 18px 0 8px; }
.invite-lead { margin: 0 0 18px; font-size: 17px; line-height: 1.5; }
.invite-for { display: grid; gap: 2px; margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--bg); overflow-wrap: anywhere; }
.invite-for span { color: var(--muted); font-size: 13px; }
.invite-for strong { font-size: 16px; font-weight: 600; }
.invite-notice { display: block; margin: 16px 0 0; padding: 12px 14px; border-left: 4px solid var(--accent); border-radius: 8px; font-size: 14px; line-height: 1.45; }
.card.invite .button.primary { margin-top: 18px; }
@media (max-width: 520px) { .card.invite { padding: 36px 24px 32px; } }

/* Sign-in and Account on a phone (Sam's approved mobile design, 2026-11-21). Below 640px only:
   the field is 48px, the language button and "Use a Different Email or Mobile" are 44px rows,
   and the Account page's tables become one card per row (the page was 506px wide on a 390px phone). */
@media (max-width: 640px) {
  input:not([type=checkbox]):not([type=radio]), select, textarea { min-height: 48px; font-size: 16px; }
  .door-language { min-height: 44px; }
  .button.link { min-height: 44px; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
  th, td { border: 0; padding: 2px 0; overflow-wrap: anywhere; }
  td .button.small { min-height: 44px; margin: 6px 6px 0 0; }
  .row input, .row select, .row .button { min-height: 44px; }
}


/* The code step on a phone: six boxes drawn on the one code field, so one-time-code autofill, paste and
   the numeric keyboard all keep working exactly as before (approved mobile design, 2026-11-21).
   The field is exactly as wide as its text can be (the left pad plus six digit steps, the last digit's
   letter-spacing included), so the text never scrolls and nothing sticks out past the boxes.
   That makes the field wider than the boxes it draws: past the sixth box there is an empty tail (the left pad
   and the last gap). Where the card's content is narrower than the whole field but still holds the boxes (a
   390px iPhone: 308px for a 327px field over 304px of boxes), the field used to widen the card to the
   screen's right edge, with the 20px gutter left only on the left (live check 2026-12-03). The negative right
   margin, never below zero, lets only that empty tail run into the card's padding, so the card keeps both
   gutters. It also fills the line exactly, so a right-to-left page puts the field where a left-to-right one
   does instead of pushing the card off the left edge. Each narrower size below does the same with its own width. */
@media (max-width: 640px) {
  #code { box-sizing: border-box; width: calc((44px - 1ch) / 2 + 312px); margin-right: min(0px, 100% - ((44px - 1ch) / 2 + 312px)); max-width: none; height: 56px; min-height: 56px;
    padding: 0 0 0 calc((44px - 1ch) / 2); border: 0; border-radius: 10px; box-shadow: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 24px; font-weight: 600; letter-spacing: calc(52px - 1ch);
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='304' height='56'%3E%3Crect x='0.5' y='.5' width='43' height='55' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='52.5' y='.5' width='43' height='55' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='104.5' y='.5' width='43' height='55' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='156.5' y='.5' width='43' height='55' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='208.5' y='.5' width='43' height='55' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='260.5' y='.5' width='43' height='55' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3C/svg%3E") 0 0 / 304px 56px no-repeat; outline-offset: 4px; caret-color: var(--accent);
    /* The digits fill the boxes left to right in every language, Arabic included (door.js sets dir=rtl). */
    direction: ltr; text-align: left; }
  #code-back { min-height: 44px; white-space: normal; overflow-wrap: anywhere; } /* wraps rather than pushing the page sideways where the font runs wide */
}
/* A narrow phone scales the digits and boxes together so all six fit. */
@media (max-width: 380px) {
  #code { width: calc((36px - 1ch) / 2 + 258px); margin-right: min(0px, 100% - ((36px - 1ch) / 2 + 258px)); height: 48px; min-height: 48px; padding-left: calc((36px - 1ch) / 2); font-size: 20px;
    letter-spacing: calc(43px - 1ch); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='251' height='48'%3E%3Crect x='0.5' y='.5' width='35' height='47' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='43.5' y='.5' width='35' height='47' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='86.5' y='.5' width='35' height='47' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='129.5' y='.5' width='35' height='47' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='172.5' y='.5' width='35' height='47' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='215.5' y='.5' width='35' height='47' rx='10' fill='white' stroke='%23d0d5dd'/%3E%3C/svg%3E") 0 0 / 251px 48px no-repeat; }
}
/* A phone card keeps the 16-20px gutters of the mobile design, which leaves room for the six code boxes. */
@media (max-width: 640px) { .card { padding: 36px 20px 32px; } }
@media (max-width: 340px) {
  #code { width: calc((32px - 1ch) / 2 + 228px); margin-right: min(0px, 100% - ((32px - 1ch) / 2 + 228px)); height: 44px; min-height: 44px; padding-left: calc((32px - 1ch) / 2); font-size: 18px;
    letter-spacing: calc(38px - 1ch); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='222' height='44'%3E%3Crect x='0.5' y='.5' width='31' height='43' rx='8' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='38.5' y='.5' width='31' height='43' rx='8' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='76.5' y='.5' width='31' height='43' rx='8' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='114.5' y='.5' width='31' height='43' rx='8' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='152.5' y='.5' width='31' height='43' rx='8' fill='white' stroke='%23d0d5dd'/%3E%3Crect x='190.5' y='.5' width='31' height='43' rx='8' fill='white' stroke='%23d0d5dd'/%3E%3C/svg%3E") 0 0 / 222px 44px no-repeat; }
}
