/* ============================================================
   common.css — shared styles across all app pages
   ============================================================ */

@import url('/css/fonts.css');   /* self-hosted — see scripts/fetch-webfonts.js */

/* THE HANDWRITING FACE, declared here because three surfaces need it and only
   two of them are worksheets. Print Clearly is what a child traces on a
   worksheet, and the shelf/hub/home cards preview those worksheets — a preview
   set in the page font shows different letterforms (a two-storey `a`, a
   different `g`) from the sheet it is a picture of.

   NOT in fonts.css: that file is generated by scripts/fetch-webfonts.js, which
   only knows how to pull from Google Fonts, and this face is not published
   there. It is vendored by hand — public/fonts/README.md records where it came
   from and the exact commands that produced the woff2.

   Declaring a face costs nothing until something uses it: the browser fetches
   the file only when a rule actually asks for the family. worksheet.html and
   kids-worksheet.html still carry their own copies of these two rules; same
   family, same src, so the browser loads one file either way. Folding those two
   into this one is worth doing, but they were mid-edit elsewhere. */
@font-face {
  font-family: 'TraceGuide';
  src: url('/fonts/print-clearly-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'TraceGuideDashed';
  src: url('/fonts/print-clearly-dashed-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

/* Green palette (matches home page) */
:root {
    --green-dark:    #1A2E25;
    --green-primary: #2D4A3E;
    --green-mid:     #1E6644;
    --green-text:    #3D5E4E;
    --green-muted:   #4A6B5A;
    --green-subtle:  #5A7A6A;
    --green-border:  #C8DFD2;
    --green-light:   #EEF7F1;
    --green-pale:    #F5FAF7;
    --green-hover:   #D4EFE2;
    --accent-warm:   #F4A261;
    --accent-cream:  #FEF3E2;
    --accent-gold:   #E9C46A;
    --text-cta:      #E8F5EF;
    /* Uniform height for every clickable control in a Filter & Sort bar
       (filter pills, type pills, sort/date selects, search input, toggle) so
       they line up at the same height across every hub + the All-Content page. */
    --ff-control-h:  34px;

    /* ---- Hub accent, used ONLY by the create interstitials ----------------
       Each top-level hub colors its own "we're making it" waiting state:
       storybooks green, activities purple, games terracotta. Everything else
       in the product stays green — this is deliberately NOT a per-hub theme.
       A parent meets the interstitial at the one moment they are definitely
       looking at the screen and have nothing to do, so it is worth making it
       say which part of the product they are in; repainting the hubs whole
       would just make three products out of one.

       These default to the green ramp, so any surface that does not set a
       hub class keeps exactly the look it has now.

       The ramp has the shape it does because the interstitial needs all of
       it: -dark is the card title, -muted the body copy, -mid the progress
       bar and the pct, -track the bar's groove, -bar-end the light end of the
       bar gradient, -border the banner edge, and the -panel pair is the dark
       gradient the storybook interstitial fills its whole card with.

       CONTRAST IS MEASURED, NOT EYEBALLED. Every ramp clears WCAG AA against
       its own background — -mid carries white button text (>=4.5:1), -dark and
       -muted are ink on white, and the bar clears 3:1 against its track as a
       non-text indicator. Both new ramps sit at or above the green one on
       every axis. If you retune a value, re-measure it; a purple that reads
       well on a designer's monitor can quietly fail on a phone in daylight. */
    --hub-dark:        var(--green-dark);
    --hub-primary:     var(--green-primary);
    --hub-mid:         var(--green-mid);
    --hub-muted:       var(--green-muted);
    --hub-border:      var(--green-border);
    --hub-track:       var(--green-pale);
    --hub-bar-end:     #5DBA80;
    --hub-banner-bg:   #F7FAF8;
    /* The fill behind the drawer progress card AND the coloring banner. It is
       ONE variable because those two sit one above the other in the same
       drawer, and they used to disagree — the banner was already tinted while
       the card was pure white, so the card read as the unfinished one.
       The default is the banner's existing white->near-white gradient, which
       is why charts and the deprecated coloring create page (both green, both
       hub-classless) look exactly as they did.

       A HUB'S WHOLE TREATMENT IS ITS VARIABLES, not a body-level modifier
       class. Ink, groove, note panel, button and sparkle all travel with
       `--hub-surface`, so changing one hub is editing its block and nothing
       else — no component rule knows what a hub chose. Leave one of them
       behind and that row VANISHES rather than merely looking wrong, which is
       why they are one set.

       All three hubs are a light mid tint. The defaults here are that same
       light set, so a hub-classless surface (charts, the deprecated coloring
       create page) keeps the near-white gradient it has always had. The dark
       variant these variables also support is gone from the product but was
       a pure block swap, which is the point of the indirection. */
    --hub-surface:        linear-gradient(180deg, #fff 0%, var(--hub-banner-bg) 100%);
    --hub-panel-a:     var(--green-dark);
    --hub-panel-b:     var(--green-primary);
    --hub-panel-text:  #E8F5EF;
    --hub-panel-sub:   #7ABDA0;
    --hub-panel-meta:  #5A8A72;
    --hub-fill-a:      #52B788;
    --hub-fill-b:      #B7E4C7;
}

/* Storybooks keeps the green it already has. Stated explicitly rather than
   left to the defaults so all three hubs read the same way in this file. */
.hub-storybooks { --hub-surface: #E2F0E8; }

/* Activities — plum. Warm-leaning rather than a blue violet, so it sits with
   the forest green and sand the rest of the product is built from. */
.hub-activities {
    --hub-dark:        #241B33;
    --hub-primary:     #3B2B52;
    --hub-mid:         #5F3D8F;
    --hub-muted:       #61527A;
    --hub-border:      #D8CCE6;
    --hub-track:       #F3EFF9;
    --hub-bar-end:     #A98BD4;
    --hub-banner-bg:   #FAF8FC;
    --hub-surface:     #EDE4F6;
    --hub-panel-a:     #241B33;
    --hub-panel-b:     #3B2B52;
    --hub-panel-text:  #F1EAF9;
    --hub-panel-sub:   #B49BD8;
    --hub-panel-meta:  #8A72A8;
    --hub-fill-a:      #8B62C4;
    --hub-fill-b:      #D6C4EC;
}

/* THESE MUST BE DECLARED ON THE HUB ELEMENT, NOT ONLY ON :root.
   A custom property whose value contains var() is SUBSTITUTED AT THE ELEMENT
   WHERE IT IS DECLARED, and the resolved value is what inherits. Declared once
   on :root, `--hub-bar-a: var(--hub-mid)` therefore froze to root's GREEN and
   inherited that green into every hub — the plum and terracotta progress bars
   came out green while `--hub-mid` itself read correctly on the same element,
   which is what makes this hard to spot. Repeating the selector list is the
   fix: on :root these resolve to the green defaults that hub-classless
   surfaces want, and on each hub element they resolve to that hub's ramp.

   It was invisible while activities and games were dark, because those blocks
   happened to redeclare every one of these locally. Add a hub and it must be
   added here too. Pinned by tests/unit/hubAccentVars.test.js. */
:root,
.hub-storybooks,
.hub-activities,
.hub-games {
    --hub-surface-border: var(--hub-border);
    --hub-ink-title:      var(--hub-dark);
    --hub-ink-body:       var(--hub-muted);
    --hub-bar-a:          var(--hub-mid);
    --hub-bar-b:          var(--hub-bar-end);
    --hub-note-bg:        rgba(0, 0, 0, 0.04);
    --hub-ink-note:       var(--hub-dark);
    --hub-ink-fact:       var(--hub-muted);
    --hub-btn-bg:         var(--hub-track);
    --hub-btn-bg-hover:   var(--hub-border);
    --hub-btn-ink:        var(--hub-dark);
    --hub-btn-border:     var(--hub-border);
    --hub-sparkle:        var(--hub-bar-end);
}

/* Games — terracotta. The warm end of the palette the product already owns
   (--accent-warm is a light tint of the same hue), which is why it reads as
   ours rather than borrowed. Deliberately redder and much darker than the
   Community surface's amber (#F59E0B) so the two are not confusable. */
.hub-games {
    --hub-dark:        #33201A;
    --hub-primary:     #543429;
    --hub-mid:         #9C4A2A;
    --hub-muted:       #7A5347;
    --hub-border:      #E8D3C8;
    --hub-track:       #FBF2ED;
    --hub-bar-end:     #D98B5F;
    --hub-banner-bg:   #FEF9F6;
    --hub-surface:     #F8E4D8;
    --hub-panel-a:     #33201A;
    --hub-panel-b:     #543429;
    --hub-panel-text:  #FBEFE8;
    --hub-panel-sub:   #D9A183;
    --hub-panel-meta:  #B07A5C;
    --hub-fill-a:      #C4632F;
    --hub-fill-b:      #EFBE9A;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Shared kid-attribution line on content cards (contentCardMenu.attributionHtml):
   "Made for X", "Shared with Y", "Created by Z". One look across every hub. */
.cc-attr { display: block; font-size: 0.78rem; line-height: 1.4; color: var(--green-subtle, #5a7a6a); }
.cc-attr-by { font-style: italic; opacity: 0.9; }

/* Base body */
body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
}

/* Gradient background */
body.gradient-bg {
    background: linear-gradient(160deg, var(--green-dark) 0%, var(--green-primary) 55%, var(--green-mid) 100%);
}

/* ---- App header / nav bar ---- */
.header {
    background: white;
    padding: 15px 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-left: auto;
    margin-right: auto;
}

.nav-brand {
    font-family: 'Lora', serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--green-primary);
    text-align: center;
}

.nav-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.nav-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-brand-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Lora', serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--green-primary);
    text-decoration: none;
}

/* Clicking the brand link focuses it, and the browser draws its default focus
   ring — which reads as an unwanted border around the logo. Suppress it ONLY
   for pointer focus: :focus-visible is the browser's own signal for "focus that
   deserves a ring", so keyboard users keep theirs and can still see where they
   are. A bare `outline: none` would take it from them too. */
.nav-brand-home:focus:not(:focus-visible) {
    outline: none;
}

.nav-brand-home img {
    height: 32px;
    width: auto;
}

/* Tengo's own mark on its signed-in pages (nav.js, menu: 'assistant') — the
   same "Tengo / BY MOM LABS" the signed-out pages show (assistant-public.css
   .pap-brand-name), in the assistant's purple and pink. */
.nav-brand-home--tengo { letter-spacing: 0; gap: 10px; color: var(--pa-purple-text, #4A2A7A); }
.nav-brand-home--tengo img { height: 34px; }
.nav-brand-tengo { display: inline-flex; flex-direction: column; font-family: 'Lora', serif; font-weight: 600;
    font-size: 1.1rem; line-height: 1.05; }
.nav-brand-tengo small { font-family: 'DM Sans', sans-serif; font-size: .6rem; font-weight: 800;
    letter-spacing: .14em; text-transform: uppercase; color: var(--pa-pink, #D6336C); margin-top: 2px; }
.nav-brand-beta { font-family: 'DM Sans', sans-serif; font-size: .58rem; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; line-height: 1; color: #fff; padding: 3px 7px; border-radius: 999px;
    background: linear-gradient(135deg, var(--pa-pink, #EC4899), var(--pa-blue, #3B82F6)); }

.nav-button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: auto;
    margin-top: 0;
}

.nav-button.primary {
    background: linear-gradient(135deg, var(--green-primary) 0%, var(--green-mid) 100%);
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-button.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 102, 68, 0.35);
}

/* ---- User avatar dropdown ---- */
.nav-user-menu {
    position: relative;
}

.nav-avatar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--green-pale);
    border: 1px solid var(--green-border);
    border-radius: 20px;
    padding: 5px 12px 5px 5px;
    cursor: pointer;
    width: auto;
    margin-top: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--green-primary);
    transition: background 0.2s;
}

.nav-avatar-btn:hover {
    background: var(--green-hover);
    transform: none;
    box-shadow: none;
}

.nav-avatar-initial {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, var(--green-primary) 0%, var(--green-mid) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.nav-avatar-caret {
    font-size: 16px;
    color: var(--green-mid);
}

.nav-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: white;
    border: 1px solid var(--green-border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(45, 74, 62, 0.12);
    min-width: 160px;
    z-index: 200;
    overflow: hidden;
}

.nav-dropdown.open {
    display: block;
}

.nav-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    font-size: 14px;
    color: var(--green-text);
    cursor: pointer;
    text-decoration: none;
    margin: 0;
    transition: background 0.15s;
}

.nav-dropdown-item:hover {
    background: var(--green-pale);
    transform: none;
    box-shadow: none;
}

.nav-dropdown-divider {
    height: 1px;
    background: var(--green-border);
    margin: 4px 0;
}

.nav-dropdown-tier {
    padding: 2px 16px 8px;
    font-size: 0.78rem;
    color: var(--green-muted);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}
.nav-dropdown-tier > .nav-dropdown-tier-label { font-style: italic; }
/* The assistant menu names the family being viewed instead of a tier, in the
   same quiet italic the tier line used; "Switch family" opens the full-screen
   picker (openHouseholdPicker in nav.js) for somebody in more than one. */
#navHousehold { font-style: italic; font-weight: normal; }
.nav-switch-family {
    width: auto; margin: 0 0 0 -4px; padding: 2px 4px; border: 0; background: none; cursor: pointer;
    font-size: 0.78rem; font-weight: 600; color: var(--green-mid); text-decoration: underline;
    border-radius: 4px;
}
.nav-switch-family:hover { background: var(--green-light, #f0faf4); }
.hh-picker {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgba(34, 24, 52, 0.55);
}
.hh-picker-card {
    position: relative; width: 100%; max-width: 460px; max-height: 100%; overflow-y: auto;
    background: #fff; border-radius: 20px; padding: 28px 24px 22px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
.hh-picker-card h2 { margin: 0 0 4px; font-size: 1.35rem; color: var(--green-dark); }
.hh-picker-sub { margin: 0 0 18px; color: var(--green-muted); font-size: 0.92rem; }
.hh-picker-close {
    position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; margin: 0; padding: 0;
    border: 0; border-radius: 50%; background: none; cursor: pointer;
    font-size: 1.6rem; line-height: 1; color: var(--green-muted);
}
.hh-picker-close:hover { background: var(--green-light, #f0faf4); }
.hh-picker-list { display: grid; gap: 10px; }
.hh-picker-row {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    width: 100%; margin: 0; min-height: 56px; padding: 12px 16px; cursor: pointer; text-align: left;
    background: #fff; border: 1.5px solid var(--green-border); border-radius: 14px;
}
.hh-picker-row:hover:not(:disabled) { background: var(--green-pale, #f8f5fc); border-color: var(--green-mid); }
.hh-picker-row.is-current { background: var(--green-light, #f3eefa); border-color: var(--green-mid); }
.hh-picker-row:disabled { opacity: 0.6; cursor: default; }
.hh-picker-name { font-weight: 700; font-size: 1rem; color: var(--green-dark); }
.hh-picker-role { font-size: 0.82rem; color: var(--green-muted); }
.hh-picker-error { margin: 14px 0 0; color: #b42318; font-size: 0.9rem; }
.nav-dropdown-tier-account {
    color: var(--green-mid);
    font-weight: 600;
    text-decoration: none;
    font-style: normal;
    white-space: nowrap;
    padding: 2px 4px;
    margin-left: -4px;
    border-radius: 4px;
}
.nav-dropdown-tier-account:hover { background: var(--green-light, #f0faf4); text-decoration: underline; }
/* Account-link gold-dot active marker — mirrors .nav-dropdown-item--active
   so the visual cue is the same wherever the user is in the menu. */
.nav-dropdown-tier-account--active {
    position: relative;
    padding-left: 18px;
}
.nav-dropdown-tier-account--active::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d4a017;
    box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.18);
}

.nav-dropdown-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--green-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 8px 16px 4px;
    margin-top: 2px;
}

/* A TOOL THAT IS NOT BUILT YET. Rendered as a <span>, so it cannot be clicked
   or focused into — the disabled look is not what stops it, the absence of an
   href is. Dimmed rather than hidden, so the menu says what is coming. */
.nav-dropdown-item--soon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  opacity: 0.55;
  cursor: default;
}
.nav-dropdown-item--soon:hover { background: none; }
.nav-soon {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.8;
}

/* ---- White content card ---- */
.container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
    margin: 0 auto;
}

h1 {
    color: var(--green-dark);
    margin-bottom: 30px;
    text-align: center;
    font-size: 28px;
    font-family: 'Lora', serif;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--green-text);
    font-weight: 500;
    font-size: 14px;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
textarea.form-input,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--green-border);
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
textarea.form-input:focus,
select:focus {
    outline: none;
    border-color: var(--green-mid);
    box-shadow: 0 0 0 3px rgba(30, 102, 68, 0.1);
}

button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--green-primary) 0%, var(--green-mid) 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(30, 102, 68, 0.3);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---- Error & loading states ---- */
.error {
    padding: 12px;
    margin-bottom: 20px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 5px;
    color: #c33;
    display: none;
    font-size: 14px;
}

.error.visible {
    display: block;
}

.loading {
    text-align: center;
    color: var(--green-mid);
    font-weight: 600;
}

/* ---- OAuth / divider ---- */
.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px;
    border: 2px solid var(--green-border);
    border-radius: 5px;
    background: white;
    color: var(--green-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-top: 0;
}

.oauth-btn:hover {
    border-color: var(--green-muted);
    box-shadow: 0 2px 8px rgba(45, 74, 62, 0.1);
    transform: none;
}

.oauth-btn svg {
    flex-shrink: 0;
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    color: #bbb;
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--green-border);
}

/* ---- Modal ---- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.visible {
    display: block;
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: var(--green-dark);
    font-size: 20px;
    font-family: 'Lora', serif;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: auto;
    margin-top: 0;
    line-height: 1;
    flex-shrink: 0;
}

.close-btn:hover {
    color: var(--green-dark);
    transform: none;
    box-shadow: none;
}

/* THE DIALOG HEADER WITH ITS CLOSE × — title and × in ONE row, which is what
   puts the × in the corner: vertically centred on the title and right-aligned
   to the content edge BY CONSTRUCTION, rather than placed by offsets. An
   earlier cut hung the × from a zero-height sticky anchor; the sticky offset
   pushed it 16px below the title, onto the end of the subtitle, on both
   dialogs that used it — measured, and reported as "poorly positioned".

   `.modal-header` is the existing row (the home and storybooks modals). The
   `--sticky` modifier adds what a SCROLLING card needs: the share dialog and
   `.fm-modal-inner` are their own scroll containers, so a header that scrolled
   with the content would take the × with it at exactly the moment it was
   wanted. The row is pinned with a white background and BLED INTO THE CARD'S
   PADDING, so its resting place and its pinned place are the same place and
   nothing jumps when the card starts to scroll. That needs the card's padding,
   so the HOST declares --modal-pad-top / --modal-pad-x beside its own padding;
   without them the row still lays out correctly and only the pin is off.

   Pair it with a backdrop tap and Escape in the host's script: the × is the
   visible way out, not the only one. */
.modal-header.modal-header--sticky {
    position: sticky;
    /* NEGATIVE, and that is the fix rather than a hack. A sticky offset is
       measured from the scroll container's CONTENT box — its padding is honoured
       as an inset — so `top: 0` pins the row one padding-width below the card's
       edge, which put the × 28px low. It is also what sank the first cut: its
       anchor's `top: 16px` landed 16px below the content top, i.e. under the
       title. Cancelling the padding pins the row where it already rests. */
    top: calc(-1 * var(--modal-pad-top, 0px));
    z-index: 3;
    background: #fff;
    gap: 12px;
    margin: calc(-1 * var(--modal-pad-top, 0px)) calc(-1 * var(--modal-pad-x, 0px)) 0;
    padding: var(--modal-pad-top, 0px) var(--modal-pad-x, 0px) 4px;
}
/* Specific enough to beat a host's own `h3 { margin }` (the chooser's
   `.fm-modal h3` loads after this file). The 4px under the title is the row's
   padding now, so it travels with the pinned bar. */
.modal-header.modal-header--sticky > h2,
.modal-header.modal-header--sticky > h3 {
    margin: 0;
    min-width: 0;
}
/* The × reuses .close-btn's glyph as a 36px circle with a 44px HIT AREA from
   an ::after — the touch minimum, without a 44px circle out-shouting the title
   beside it. Weight 400: the bold default drew a heavy ✖ rather than a ×. Ink
   #6b7280 rather than .close-btn's #999, which is 2.8:1 on white, under the 3:1
   a control needs. The negative margin is OPTICAL: it puts the glyph, not the
   hover circle, on the content edge that the Copy and Send buttons end at. */
.modal-header.modal-header--sticky > .close-btn {
    position: relative;
    flex: none;
    width: 36px;
    height: 36px;
    margin-right: -8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 400;
    color: #6b7280;
    background: transparent;
}
.modal-header.modal-header--sticky > .close-btn::after {
    content: '';
    position: absolute;
    inset: -4px;
}
.modal-header.modal-header--sticky > .close-btn:hover,
.modal-header.modal-header--sticky > .close-btn:focus-visible {
    background: #f0f2f1;
    color: var(--green-dark);
}
.modal-header.modal-header--sticky > .close-btn:focus-visible {
    outline: 2px solid var(--green-mid, #2d6a4f);
    outline-offset: 2px;
}

.modal-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
}

.modal-story {
    color: var(--green-text);
    line-height: 1.8;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.modal-rating {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--green-border);
}

.rating-btn {
    background: var(--green-pale);
    border: 2px solid var(--green-border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 18px;
    line-height: 1;
    width: auto;
    margin-top: 0;
}

.rating-btn.selected {
    background: var(--green-light);
    border-color: var(--green-mid);
}

.stories-remaining {
    font-size: 12px;
    color: var(--green-muted);
}

.stories-remaining.limit-near {
    color: #e67e22;
    font-weight: 600;
}

.stories-remaining.limit-reached {
    color: #c33;
    font-weight: 600;
}

.user-info {
    font-size: 13px;
    color: var(--green-muted);
}

/* ---- Active nav item ---- */
.nav-dropdown-item--active {
    position: relative;
    padding-left: 28px;
}
/* Small gold dot to the left of the active item — calmer marker than a
   background highlight or bold weight, and keeps the active row visually
   the same shape as the others so the menu reads as a flat list. */
.nav-dropdown-item--active::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d4a017;
    box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.18);
}

/* ---- App switcher bar ---- */
.app-switcher {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: -8px auto 16px;
    max-width: 100%;
    padding: 0 16px;
}

.app-switcher-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 18px;
    border-radius: 20px;
    background: rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: 1.5px solid rgba(255,255,255,0.28);
    transition: background 0.18s, border-color 0.18s;
    white-space: nowrap;
}

.app-switcher-tab:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

.app-switcher-tab--active {
    background: white;
    color: var(--green-primary);
    border-color: white;
}

.app-switcher-tab--active:hover {
    background: white;
}

/* ---- Mobile nav ---- */
@media (max-width: 600px) {
    .header {
        grid-template-columns: 1fr auto;
        padding: 12px 16px;
    }

    .nav-brand {
        display: none;
    }

    .nav-button.primary {
        display: none;
    }

    .stories-remaining {
        display: none;
    }
}


/* ---- Feature flag visual indicators (admin mode) ---- */
.feature-preview::after {
    content: 'Preview';
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: rgba(66,160,247,.2);
    color: #4ab0f7;
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 6px;
    vertical-align: middle;
}

.feature-in-dev::after {
    content: 'Dev';
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: rgba(255,160,50,.15);
    color: #f0a030;
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ============================================================
   Create-flow generation interstitials — shared Mom Labs flask
   "working…" mark. Every create surface (storybooks, coloring,
   activities, games) shows the flask image while generating, with
   this gentle float/pulse so it still reads as loading.
   ============================================================ */
@keyframes gen-flask-float {
    0%, 100% { transform: translateY(0) scale(1);     }
    50%      { transform: translateY(-6px) scale(1.06); }
}

/* The two rows every create interstitial carries, injected by
   public/js/coloring-interstitial.js (the shared create-interstitial module).
   ONE definition, here, because these rows render into four different host
   shapes — the drawer progress cards on activities + games, the storybook
   interstitial, the coloring banner and the charts banner — and the whole point
   of the exercise was that those four had drifted apart.

   .ci-note  — can I walk away or not. Never optional; a waiting state that
               doesn't answer it leaves the parent guessing.
   .ci-fact  — the rotating "Did you know?" about the thing being made.

   Do NOT restyle these per host. If one surface needs a tweak, it belongs
   here, guarded by that host's class. */
/* INK IS SET, NOT INHERITED. These two rows were the only things in a drawer
   progress card with no color of their own, so they took whatever body carried
   — and activities/games load neither index.css nor any body color, which made
   the "Did you know?" fact render pure black directly under body copy in muted
   green. It read as unstyled, because it was. The dark-panel overrides further
   down are more specific and still win on the storybook interstitial. */
.ci-note {
    background: var(--hub-note-bg);
    color: var(--hub-ink-note);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 18px auto 0;
    max-width: 380px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.45;
    text-align: left;
}
.ci-fact {
    color: var(--hub-ink-fact);
    margin: 12px auto 0;
    max-width: 380px;
    text-align: left;
}
.ci-fact-label {
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.6;
    margin-bottom: 4px;
}
/* min-height holds the card's height steady across facts of different lengths —
   without it the whole interstitial jumps every rotation. */
.ci-fact-text {
    font-size: 0.85rem;
    line-height: 1.45;
    min-height: 2.9em;
}
.ci-icon,
.ci-icon-img {
    flex: none;
}
.ci-icon-img {
    width: 18px;
    height: 18px;
    vertical-align: -3px;
}

/* No .sb-interstitial override any more. That panel used to be dark green and
   needed white ink forced onto these two rows; it is a light tint now, like
   every other create surface, so the hub variables above are already right and
   an override here would put white text on a pale card. */

/* ============================================================
   Card rails — the shared one-row (or two-row) horizontal scroller
   every hub content section uses. See public/js/card-rail.js for
   the why; in short, these replaced wrapping grids with a
   "Show more" that grew the page by however many cards were
   hidden. A rail is the same height whether it holds four cards
   or forty.

   Lives HERE rather than in activity-sheets.css because
   storybooks/index.html loads common.css but not that file, and
   all three hubs have to behave the same.

   Archives are deliberately NOT rails — an archive is a surface
   you scan looking for one thing, which a wrapping grid does
   better than a one-row scroller.
   ============================================================ */
.card-rail-wrap {
    position: relative;
}

/* .card-rail.card-rail — the class doubled on purpose, to raise specificity
   without !important. dashboard.css loads AFTER common.css on the storybooks
   hub, so its `.stories-grid { grid-template-columns: repeat(auto-fill,
   minmax(240px,1fr)) }` beat a single-class rule here and kept stretching the
   cards to 275px. Doubling wins on specificity while staying overridable by
   anything genuinely more specific. */
.card-rail.card-rail {
    display: grid;
    /* Beats an explicit `grid-template-columns` from whatever class the element
       already carries (e.g. .stories-grid on the storybooks hub) — with columns
       still declared, grid-auto-flow:column has nothing to flow into. */
    grid-template-columns: none;
    grid-auto-flow: column;
    /* Exactly THREE cards per view, at any rail width — a share of the
       scrollport rather than a fixed pixel width, so the count is the thing
       that stays constant as the window resizes.
       NOTE: on a card whose cover is square, width IS height. Three-up makes
       each card wider, which makes a square cover taller. See the aspect note
       on .story-card-image if the cards need to come back down. */
    grid-auto-columns: calc((100% - 2 * 16px) / 3);
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    /* Room for the cards' own shadow, which a tight overflow box clips. */
    padding: 6px 2px 14px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.card-rail::-webkit-scrollbar { display: none; }
.card-rail > * { scroll-snap-align: start; min-width: 0; }
/* Invisible filler that completes a short final page — see applyPageBoundaries
   in card-rail.js. It occupies a grid cell and nothing else. */
.card-rail-pad { visibility: hidden; pointer-events: none; }

/* One card and a half-width column is worse than one card and empty space:
   a rail narrower than a card would otherwise squash it. */
/* Two-up on a tablet, one-up on a phone: a third of a 380px screen is not a
   card, it's a stripe. */
@media (max-width: 900px) {
    .card-rail.card-rail { grid-auto-columns: calc((100% - 16px) / 2); }
}
@media (max-width: 560px) {
    .card-rail.card-rail { grid-auto-columns: 86%; }
}

.card-rail-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--green-border, #C8DFD2);
    background: #fff;
    color: var(--green-dark, #1A2E25);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    z-index: 4;
    display: none;            /* card-rail.js shows these only when it scrolls */
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
/* Re-state the centring transform on every interactive state: common.css has a
   global `button:hover { transform: translateY(-2px) }` that would otherwise
   wipe it and drop the arrow half its height mid-hover. */
.card-rail-nav:hover {
    transform: translateY(-50%);
    background: var(--green-mid, #1E6644);
    color: #fff;
    box-shadow: 0 4px 12px rgba(30, 102, 68, 0.25);
}
.card-rail-nav:active { transform: translateY(-50%); }
.card-rail-nav[disabled] {
    transform: translateY(-50%);
    opacity: 0.3;
    cursor: default;
}
.card-rail-nav[disabled]:hover {
    transform: translateY(-50%);
    background: #fff;
    color: var(--green-dark, #1A2E25);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.card-rail-wrap--scrollable .card-rail-nav { display: inline-flex; }
.card-rail-prev { left: -14px; }
.card-rail-next { right: -14px; }
/* On a narrow screen there is no margin to hang an arrow in, so tuck them
   inside the rail rather than off the edge of the viewport. */
@media (max-width: 900px) {
    .card-rail-prev { left: 0; }
    .card-rail-next { right: 0; }
}


/* ============================================================
   Archive panels — shared across every hub that shows archived
   content (storybooks, activities, games, /content.html).
   ONE definition lives here; these class names were previously
   defined twice, differently, in dashboard.css and coloring.css,
   which is why each hub's archive looked different. Do NOT
   re-add them to a page-level stylesheet.

   Markup contract each hub follows:
     <div class="archived-section">
       <button class="archived-toggle" onclick="…">
         📥 Archived (n) <span class="archived-arrow">▶</span>
       </button>
       <div class="archived-body" style="display:none;">
         <div class="arch-filter-bar">…selects…</div>
         <div class="…-grid"></div>
       </div>
     </div>
   Collapsed arrow is ▶, expanded is ▼. Hide the whole section
   (display:none) when there's nothing archived.
   ============================================================ */
.archived-section {
    margin-top: 2.5rem;
    border-top: 2px dashed #e8e4f7;
    padding-top: 1rem;
}

.archived-toggle {
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    color: #8074a8;
    cursor: pointer;
    padding: 0.4rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* Hubs sit this inside grid/flex containers that stretch children;
       keep it hugging its label the way a heading would. */
    width: auto;
    margin: 0;
}

.archived-toggle:hover {
    color: #4a3f6b;
}

.archived-arrow {
    font-size: 0.8em;
    line-height: 1;
}

.archived-body {
    margin-top: 0.75rem;
}

.archived-card {
    opacity: 0.65;
    transition: opacity 0.2s;
}

.archived-card:hover {
    opacity: 0.9;
}

/* Archived cards carry the same shell as their live twin, but nothing on them
   opens the item — the card shells set cursor:pointer for their linked state,
   so override it here. Two classes to outrank the shell's own rule (this file
   loads before the page stylesheets). */
.shelf-card.archived-card,
.content-card.archived-card,
.activity-card.archived-card,
.story-card.archived-card {
    cursor: default;
}

/* No image/preview overrides here on purpose. An archived card renders its
   thumbnail through the SAME card renderer as its live twin — same source
   image, same JSON preview (crossword grid, word-search letters, flashcard
   emoji grid, sentence chips), same object-fit — so the only difference
   between the two states is the dimming above plus the corner type icon and
   the Unarchive/Delete menu. An archive-only object-fit:contain rule used to
   live here; it made archived thumbnails letterbox while live ones cropped. */

/* Filter row inside an archive panel. Scrolls sideways rather than
   wrapping on narrow screens — much of the audience is on iPad/iPhone. */
.arch-filter-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin: 0.75rem 0 1rem;
    align-items: center;
    overflow-x: auto;
}

.arch-filter-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #6b7280;
    flex-shrink: 0;
}

/* Archive CARD contents. Every hub's archive card shows the same three things
   in the same order: a corner type ICON (never a text pill — the hubs used to
   render "🧩 Jigsaw" / "👤 Kent" pills, which read as chrome once the card is
   archived), then "Created on <date>", then the shared attribution line
   ("Made for …" via contentCardMenu.attributionHtml). The icon is absolutely
   positioned, so the card shell it sits in must be position:relative — .story-card,
   .activity-card and .content-card all are. */
.arch-type-icon {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 6;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    pointer-events: none;
}

.arch-card-created {
    font-size: 0.75rem;
    color: var(--green-muted, #6b8f78);
    margin-top: 4px;
}

.arch-filter-select {
    padding: 0.35rem 0.65rem;
    border: 1px solid #d0c8e8;
    border-radius: 6px;
    font-size: 0.82rem;
    background: #fff;
    color: #4a3f6b;
    cursor: pointer;
    width: auto;
    flex-shrink: 0;
}

/* ── Price badges on the games hub's "turn it on" shelves ──────────────────
   Most of these games generate no AI, so they cost nothing; Find Me charges a
   one-time family unlock. A parent scanning the page should be able to tell
   which switches spend coins without opening anything, so every such shelf
   carries one of these two badges — never neither. */
.game-price {
  display: inline-flex; align-items: center; gap: 4px;
  vertical-align: middle; margin-left: 8px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.04em;
  text-transform: uppercase; line-height: 1.6;
}
.game-price-free { background: #E6F7EE; color: #1E7A4F; }
.game-price-coins { background: #FFF4D6; color: #8A5A00; text-transform: none; letter-spacing: 0; }

/* ── Shelves ────────────────────────────────────────────────────────────────
   ONE definition of a shelf heading, shared by the activities/games hubs and the
   storybooks hub. Lived in activity-sheets.css, which storybooks does not load,
   so the storybook shelves had grown their own smaller heading — exactly the
   drift the archive-panel contract exists to prevent.

   common.css loads before every page stylesheet, so the per-hub overrides that
   were already here (.freebies-sec, .ttt-shelf-section) still win. */
.shelf-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.shelf-header .shelf-title {
  margin: 0;
  font-family: 'Lora', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--green-dark);
}

/* Count bubble, riding alongside the shelf title.
   It sat in the far-right slot the activities hub uses for "View all →", which
   put the number a whole shelf-width away from the words it counts — on a wide
   screen you had to look twice to pair them. Next to the title it reads as one
   phrase: "Bedtime (9)".

   Sized in `em` so it scales with the heading rather than needing a second
   number kept in step, and `translateY` because a small pill next to a large
   serif heading sits visually low when baseline-aligned. */
.shelf-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6em;
    margin-left: 0.5em;
    padding: 0.15em 0.5em;
    border-radius: 999px;
    background: var(--green-light, #EEF7F1);
    color: var(--green-mid, #1E6644);
    font-family: inherit;
    font-size: 0.62em;
    font-weight: 700;
    line-height: 1.4;
    vertical-align: middle;
    transform: translateY(-0.12em);
}

.story-shelf { margin: 0 0 26px; }

/* THE EMPTY "Generate for your child" PICKER — see public/js/kid-picker-empty.js.
   Lives here rather than in create.css because only common.css is loaded by all
   three create drawers; create.css is storybooks' alone. Dashed rather than
   solid, and pale rather than coloured in, because this is an invitation in the
   middle of a form somebody is already filling in — it has to read as a gap
   waiting to be filled, not as an error and not as a second Generate button. */
.kid-picker-empty {
    border: 1.5px dashed var(--green-border, #c8dfd2);
    border-radius: 10px;
    background: var(--green-pale, #f5faf7);
    padding: 14px 16px;
    margin: 2px 0 4px;
    text-align: center;
}

.kid-picker-empty .kpe-lead {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--green-primary, #2d4a3e);
}

.kid-picker-empty .kpe-sub {
    margin: 0 0 12px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--green-subtle, #5a7a6a);
}

.kid-picker-empty .kpe-cta {
    display: inline-block;
    padding: 9px 20px;
    border-radius: 999px;
    background: var(--green-mid, #1e6644);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
}

.kid-picker-empty .kpe-cta:hover { filter: brightness(1.08); }

.kid-picker-empty .kpe-cta:focus-visible,
.kid-picker-empty .kpe-alt-link:focus-visible {
    outline: 2px solid var(--accent-gold, #e9c46a);
    outline-offset: 2px;
}

/* The second route, for somebody whose kids are not their own. Quiet on
   purpose: it is the less common path, and giving it a second button would
   make the two look evenly weighted when they are not. The rule above it is a
   separator rather than decoration — it says "or, a different thing". */
.kid-picker-empty .kpe-alt {
    margin: 12px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--green-border, #c8dfd2);
    font-size: 12px;
    line-height: 1.5;
    color: var(--green-subtle, #5a7a6a);
}

.kid-picker-empty .kpe-alt-link {
    color: var(--green-mid, #1e6644);
    font-weight: 600;
    text-decoration: underline;
    white-space: nowrap;
}

/* A picture that could not be fetched (see the delegated error handler in
   js/kids-mode.js). It lives HERE rather than in kids.css because the handler
   is in kids-mode.js, which all 19 kids pages load, while kids.css is loaded
   by exactly one of them — a rule the JS can reach but the page cannot is how
   this ships looking fine on the one page somebody tested. The element keeps its place and its box — game code holds
   references to these — and only its look changes: the inline SVG placeholder
   is line art on cream, so `object-fit: cover` would crop it to nothing on a
   tall tile. `contain` keeps the whole glyph visible at any tile shape, and the
   cream fill behind it means a partially-covered tile still reads as a card
   rather than a hole. */
img.kids-img-missing {
    /* `contain`, because the placeholder is line art on cream and `cover` would
       crop the glyph away on a tall or wide tile. The breathing room around it
       is part of the SVG rather than padding here — a percentage padding has to
       be re-guessed for every surface that shows one, and this rule is shared by
       all 19 kids pages. */
    /* scale-down, NOT contain: it resolves to whichever of `none` and `contain`
       is smaller, so the bear is never drawn LARGER than its own 647x498 and
       therefore never pixelates — which is the whole reason a 64px icon was not
       good enough here. `contain` would happily stretch it across a coloring
       stage. Cream behind it so a partly-covered tile still reads as a card. */
    object-fit: scale-down !important;
    background: #F3EFE4;
}

/* ── Scroll back through ideas already generated ──────────────────────────
   Rendered by public/js/field-history.js beside a prompt field on the
   storybooks, activities and games hubs. Here because all three load
   common.css, and three private copies is the drift the archive-panel contract
   already exists to prevent.

   ONE SEGMENTED PILL, not three things in a row. The first version was a
   button, a counter and a button in a flex row with gaps and three different
   font sizes, and the arrows and the number visibly failed to line up. Every
   cell is now the same height in the same flex container, centred both ways, so
   there is nothing left that CAN misalign. */
.field-history {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #ddd8d0;
    border-radius: 999px;
    overflow: hidden;
    background: #fff;
    /* The row it sits in is right-aligned by the wrapper below, not by
       justify-content here — a pill that stretches has gaps inside it. */
    line-height: 1;
}
/* [hidden] must beat `display: inline-flex`, or a one-entry history shows an
   empty pill. */
.field-history[hidden] { display: none; }

.field-history-btn {
    /* common.css sets `button { width: 100% }`, which would put one chevron on a
       line of its own. The same trap create-drawer-phone.css and the trial promo
       row both document. */
    width: auto;
    min-width: 30px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    margin: 0;
    border: 0;
    background: transparent;
    color: #5a5a68;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}
.field-history-btn:hover:not(:disabled) { background: #f2f0ec; }
.field-history-btn:disabled { opacity: 0.35; cursor: default; }

.field-history-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    min-width: 34px;
    border-left: 1px solid #efece7;
    border-right: 1px solid #efece7;
    font-size: 11px;
    line-height: 1;
    color: #7a7a86;
    /* "10/12" must not be wider than "1/2" by enough to shift the chevrons. */
    font-variant-numeric: tabular-nums;
}

/* The control belongs to the field above it, so it hangs off its right edge
   rather than floating in the middle of the form. */
.form-group > .field-history { float: right; margin-top: 4px; }
.form-group > .field-history + * { clear: both; }
