/* The setup frame (spec 6.0; plan 1 Task 7): what every /setup/* page shares (the top bar, the progress rail, the two
   columns of panel and preview, the flash host, the action bar's two places), and the phone's slot rule (R150), which
   /signin and /pricing load it for (/pricing borrows the top bar and the columns too). frame.js builds the header and
   moves the bar; the page owns the rest. Load after controls.css, before the page's own css. Class names carry fr- (the
   frame's parts) or setup- (the layout the page markup names), so nothing meets a page's own or the replica's. */

:root { --fr-top: 68px; --setup-top: clamp(24px, 4.5vh, 44px); }

/* R64: the frame's pages opt in to the safe areas (viewport-fit=cover), so their side gutters keep clear of a notch or
   rounded corner in landscape: base.css's .wrap gutter, or the inset when that is wider. Only the frame's own parts and
   the page's main carry these classes; no other page's .wrap changes. */
.fr > .wrap, .wrap.setup, .wrap.fr-error {
  padding-left: max(clamp(20px, 5vw, 64px), env(safe-area-inset-left));
  padding-right: max(clamp(20px, 5vw, 64px), env(safe-area-inset-right));
}

/* ---------------------------------------------------------------- the header: the top bar, then the rail */
.fr { border-bottom: 1px solid var(--line); }
.fr-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: var(--fr-top); }
.fr-tools { display: flex; align-items: center; gap: var(--s2); min-width: 0; }

/* the help link (R82: no number): "Need help?" in ink and underlined, to the help page; a 44 px target */
.fr-help {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 10px;
  color: var(--ink); font-size: 16px; font-weight: 500; white-space: nowrap;
  text-decoration: underline 1.5px var(--edge-strong); text-underline-offset: .24em; transition: text-decoration-color .2s ease;
}
/* every :hover look sits in @media (hover: hover): a touch screen would keep it after the tap (controls.css, 2026-11-16) */
@media (hover: hover) { .fr-help:hover { text-decoration-color: var(--ink); } }
.fr-help-icon { display: none; }

/* the account menu: a pill with the email and a chevron (a long address gives way with an ellipsis; the panel shows it
   whole); the panel hangs under it, right-aligned */
.fr-acct { position: relative; display: flex; min-width: 0; }
.fr-acct-btn {
  position: relative; display: inline-flex; flex: 0 1 auto; align-items: center; gap: var(--s2); height: 44px; max-width: 320px; min-width: 44px;
  padding: 0 12px 0 16px; margin: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--edge);
  font-family: var(--text); font-size: 16px; font-weight: 600; -webkit-tap-highlight-color: transparent;
  transition: box-shadow .2s ease;
}
.fr-acct-btn[aria-expanded="true"] { box-shadow: inset 0 0 0 1.5px var(--ink); }
@media (hover: hover) { .fr-acct-btn:hover { box-shadow: inset 0 0 0 1.5px var(--ink); } }
.fr-acct-email { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-acct-initial { display: none; }
.fr-chev { flex: none; width: 18px; height: 18px; transition: transform .2s ease; }
[aria-expanded="true"] > .fr-chev { transform: rotate(180deg); }

.fr-acct-panel {
  position: absolute; z-index: 30; top: calc(100% + 10px); right: 0;
  display: grid; gap: var(--s4); width: max-content; min-width: 280px; max-width: min(360px, calc(100vw - 32px)); padding: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m);
  box-shadow: 0 2px 6px rgba(14, 27, 44, .06), 0 28px 56px -24px rgba(30, 24, 12, .38);
}
.fr-acct-panel:focus { outline: none; }
.fr-acct-who { display: grid; gap: 2px; min-width: 0; }
.fr-acct-full { font-size: 17px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.fr-acct-form { display: grid; }
.fr-acct-form .btn-2 { width: 100%; }

/* ---------------------------------------------------------------- the rail */
.fr-rail { padding-top: 6px; padding-bottom: 18px; }
/* the six steps across the width (each a 44 px tall target; the list sits 6 px out so the first tick lines up with the
   wordmark, and the last label with the account pill) */
.fr-steps { list-style: none; display: flex; justify-content: space-between; gap: 4px; margin: 0 -6px; }
.fr-step { display: flex; min-width: 0; }
.fr-step-in {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 6px; border-radius: 10px;
  color: var(--body); font-size: 16px; font-weight: 500; line-height: 1.25; text-decoration: none; white-space: nowrap;
}
.fr-dot {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  font-size: 16px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}
/* done: the kit's green tick, at the rail's size; the label in ink, underlined when it is a link (the step's page) */
.fr-dot.tick::after { width: 16px; height: 16px; }
.is-done .fr-step-in { color: var(--ink); }
a.fr-step-in .fr-label { text-decoration: underline 1.5px var(--edge-strong); text-underline-offset: .24em; transition: text-decoration-color .2s ease; }
@media (hover: hover) { a.fr-step-in:hover .fr-label { text-decoration-color: var(--ink); } }
/* current: the number on a filled ink circle, the label in ink and heavier */
.is-current .fr-dot { background: var(--ink); color: var(--white); }
.is-current .fr-step-in { color: var(--ink); font-weight: 650; }
/* to do: a muted number in an outlined circle, a muted label */
.is-todo .fr-dot { color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--edge-strong); }
.is-todo .fr-step-in { color: var(--muted); }
/* the list takes the focus only when a refresh took away the step link that had it (frame.js): a region, not a control */
.fr-steps[tabindex="-1"]:focus { outline: none; }

/* "{n} of 6 done" and the 4 px bar, filled in the tick's green (never blue: R19) */
.fr-progress { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.fr-bar { position: relative; flex: 1; min-width: 0; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.fr-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: var(--ok); transition: width .6s cubic-bezier(.2, .7, .2, 1); }
.fr-count { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* the one-line form, for narrow windows only (below 820 px, R63: under it the six steps across no longer keep their
   targets apart) */
.fr-now { display: none; }
.fr-all {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 6px; margin: 0 -6px 0 0;
  border: 0; border-radius: 10px; background: none; color: var(--ink); cursor: pointer;
  font-family: var(--text); font-size: 16px; font-weight: 600; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.fr-all-label { text-decoration: underline 1.5px var(--edge-strong); text-underline-offset: .24em; transition: text-decoration-color .2s ease; }
@media (hover: hover) { .fr-all:hover .fr-all-label { text-decoration-color: var(--ink); } }

@media (max-width: 819.98px) {
  .fr-rail { padding-top: 2px; padding-bottom: 14px; }
  .fr-now { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
  .fr-now-text { min-width: 0; font-size: 16px; font-weight: 650; line-height: 1.3; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* "All steps" opens the full list, one step a line, between the line and the bar */
  .fr-rail:not(.is-open) .fr-steps { display: none; }
  /* the hairlines keep to the content edges; each step reaches 6 px out to the left so its tick lines up with the text */
  .fr-steps { flex-direction: column; justify-content: flex-start; gap: 0; margin: 4px 0 6px; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .fr-step { margin-left: -6px; }
  .fr-progress { margin-top: 2px; }
  /* setup finished (no step current, R119): the line above already reads "6 of 6 done"; the bar alone below it */
  .fr-rail.is-finished .fr-count { display: none; }
}

/* ---------------------------------------------------------------- the two columns */
.setup { padding-top: var(--setup-top); padding-bottom: 64px; }
.setup-main { width: 100%; max-width: 560px; min-width: 0; }
/* R74: every setup step's heading is one size, set here once (this selector outranks base.css's h1.title; a page's
   own heading rule sets no size) */
.panel[data-step] h1.title { font-size: clamp(30px, 3.4vw, 40px); }
/* regions that take focus for the screen reader (the flash host, a heading after a swap) are not controls: no ring */
.setup [tabindex="-1"]:focus { outline: none; }
/* the flash host: the server's one-time notice, above the panel */
.setup-main > [data-flash]:empty { display: none; }
.setup-main > [data-flash]:not(:empty) { margin-bottom: var(--s4); }
/* the preview (the phone or the Excel window): only where the phone model fits (ui.js phoneFits(), the same query) */
.setup-preview { display: none; }
/* R150: the phone's slot ([data-phone]), one rule for every page with a phone: the setup steps, /pricing, and /signin
   (which loads this file for it). Shown only where the phone model fits. */
[data-phone] { display: none; }

@media (min-width: 980px) and (min-height: 700px) {
  /* the panel keeps 560 px where it can; the preview column never gets under 320 px (a phone model needs it), so at
     980 the panel gives way a little (about 510 px) */
  .setup { display: grid; grid-template-columns: minmax(0, 560px) minmax(320px, 1fr); column-gap: clamp(40px, 5vw, 96px); align-items: start; }
  .setup-preview { display: block; position: sticky; top: 24px; min-width: 0; }
  /* R150: at scroll 0 the slot's bottom sits at least 16 px above the window's bottom. --preview-top is where the
     preview column starts: under the frame's header (the top bar and the rail, 166.8 px at every size the phone shows,
     measured) and main's top padding. /signin and /pricing have shorter headers and keep the same size, for one look. */
  :root { --preview-top: calc(167px + var(--setup-top)); }
  [data-phone] { display: block; position: relative; height: min(78vh, 760px, calc(100vh - var(--preview-top) - 16px)); }
}

/* ---------------------------------------------------------------- the action bar (R53: its contents are the page's) */
.actionbar { display: grid; justify-items: start; gap: 10px; }
/* until frame.js has put it in its place, it is not drawn (no jump at load) */
.actionbar:not([data-placed]) { visibility: hidden; }
@media (min-width: 600px) {
  /* moved into the panel by frame.js: to its end, or right after the page's barAnchor (R73); a page may set its own gap */
  .panel .actionbar { margin-top: var(--s6); }
}
@media (max-width: 599.98px) {
  /* fixed to the bottom edge, on the ground, under a hairline; frame.js pads main by its height. Its content keeps clear
     of the home indicator and (R64) of the side insets; its ground still runs edge to edge */
  .actionbar {
    position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; justify-items: stretch;
    padding: 12px max(clamp(20px, 5vw, 64px), env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(clamp(20px, 5vw, 64px), env(safe-area-inset-left));
    background: var(--ground); border-top: 1px solid var(--line); box-shadow: 0 -10px 24px -18px rgba(30, 24, 12, .28);
  }
  /* an on-screen keyboard is open: in the flow after the page, so it covers nothing */
  .actionbar.is-static { position: static; box-shadow: none; }
  /* the top bar: the help link as a question-mark icon button, the account as its initial in a circle (both 44 × 44) */
  :root { --fr-top: 64px; }
  .fr-tools { gap: 6px; margin-right: -2px; }
  .fr-help { display: none; }
  .fr-help-icon {
    display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%;
    color: var(--ink); background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--edge); transition: box-shadow .2s ease;
  }
  @media (hover: hover) { .fr-help-icon:hover { box-shadow: inset 0 0 0 1.5px var(--ink); } }
  .fr-help-glyph { width: 20px; height: 20px; }
  .fr-acct-btn { width: 44px; padding: 0; justify-content: center; background: none; box-shadow: none; }
  .fr-acct-btn[aria-expanded="true"] { box-shadow: none; }
  @media (hover: hover) { .fr-acct-btn:hover { box-shadow: none; } }
  /* the email stays the button's text (its accessible name), drawn nowhere */
  .fr-acct-email { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .fr-acct-btn .fr-chev { display: none; }
  .fr-acct-initial {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
    background: var(--ink); color: var(--white); font-family: var(--display); font-size: 19px; font-weight: 700; line-height: 1;
    transition: box-shadow .2s ease;
  }
  .fr-acct-btn[aria-expanded="true"] .fr-acct-initial { box-shadow: 0 0 0 3px var(--ground), 0 0 0 4.5px var(--edge-strong); }
  @media (hover: hover) { .fr-acct-btn:hover .fr-acct-initial { box-shadow: 0 0 0 3px var(--ground), 0 0 0 4.5px var(--edge-strong); } }
  .fr-acct-panel { right: -2px; min-width: 0; width: min(320px, calc(100vw - 40px)); }
}

/* ---------------------------------------------------------------- no answer, on a page with the top bar alone */
.fr-error { padding-top: var(--s5); }

/* R272: a Windows contrast theme drops box-shadow, so the frame's outlined parts get a real edge (controls.css has the
   kit's): the account pill (on a phone its initial's circle), the help icon, the rail's numbered circles */
@media (forced-colors: active) {
  .fr-acct-btn, .fr-help-icon, .is-todo .fr-dot, .is-current .fr-dot { border: 1.5px solid ButtonText; }
  @media (max-width: 599.98px) { .fr-acct-btn { border: 0; } .fr-acct-initial { border: 1.5px solid ButtonText; } }
}
