/* @mostly-tiny/ui — shared app-chrome kit (AppHeader + AccountMenu + SignInButton).
   Layout-only; every value resolves to a design-system token, so the chrome
   retints per product via --accent (same discipline as components.css / app.css).

   Hand-authored — NOT part of the generated _ds_bundle.js. Shipped to apps as
   web/_kit/forge-kit.css by `mt-install-kit`. Pairs with forge-kit.jsx. */

/* ── AppHeader — the shared top bar (replaces per-app ap-top / db-topbar) ── */
.forge-appheader {
  position: relative; z-index: 40; height: 60px; display: flex; align-items: center; gap: 18px;
  padding: 0 24px; background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.forge-appheader--sticky { position: sticky; top: 0; }
.forge-appheader__brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--fg); }
.forge-appheader__nav { display: flex; gap: 4px; margin-left: 10px; }
.forge-appheader__nav a,
.forge-appheader__nav button {
  font-size: 13.5px; font-weight: 500; color: var(--fg-muted); text-decoration: none;
  padding: 7px 12px; border-radius: var(--radius-pill); transition: all .12s var(--ease-out);
  border: none; background: transparent; cursor: pointer; font-family: inherit;
}
.forge-appheader__nav a:hover,
.forge-appheader__nav button:hover { color: var(--fg); background: var(--bg-chip); }
.forge-appheader__nav a[data-on="true"],
.forge-appheader__nav button[data-on="true"] { color: var(--accent); background: var(--accent-bg-soft); }
.forge-appheader__actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* ── AccountMenu — avatar trigger + dropdown (composed from DS Avatar + Menu) ── */
.forge-account { position: relative; }
.forge-account__trigger {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; border: none;
  background: transparent; font-family: inherit; padding: 3px 6px 3px 3px;
  border-radius: var(--radius-pill); transition: background var(--dur-fast, .12s) var(--ease-out);
}
.forge-account__trigger:hover { background: var(--bg-chip); }
.forge-account__email { font-size: 13px; color: var(--fg-muted); }

/* The DS .forge-menu supplies the panel chrome; the kit only positions it. */
.forge-account__menu { position: absolute; top: calc(100% + 8px); min-width: 230px; z-index: 50; }
.forge-account__menu--end { right: 0; }
.forge-account__menu--start { left: 0; }
/* open upward — for triggers anchored to the bottom of a panel (e.g. a sidebar foot) */
.forge-account__menu--up { top: auto; bottom: calc(100% + 8px); }

/* Identity header inside the menu (distinct from the trigger email so the
   responsive rule below never hides it). */
.forge-account__head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; }
.forge-account__head-text { display: flex; flex-direction: column; min-width: 0; }
.forge-account__head-name { font-size: 13px; font-weight: var(--weight-semibold, 600); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forge-account__head-email { font-size: 12px; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forge-account__head-plan { margin-left: auto; }

/* ── Responsive — collapse the nav + trigger email on narrow screens ── */
@media (max-width: 640px) {
  .forge-appheader__nav { display: none; }
  .forge-account__email { display: none; }
}

/* ── SignupSurvey — post-signup onboarding modal ──────────────────────────────
   Fullscreen scrim + centered card. Tokens only (themes per product DS). */
.forge-survey {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: color-mix(in srgb, var(--fg) 45%, transparent);
}
.forge-survey__card {
  width: 100%; max-width: 440px; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-elev, var(--bg)); color: var(--fg);
  border: 1px solid var(--hairline); border-radius: var(--radius-card, 14px);
  box-shadow: var(--shadow-lg); padding: 24px;
}
.forge-survey__title { margin: 0; font-size: 18px; font-weight: var(--weight-semibold, 600); color: var(--fg); }
.forge-survey__body { margin: 0 0 6px; font-size: 13.5px; line-height: 1.5; color: var(--fg-muted); }
.forge-survey__label { font-size: 12.5px; font-weight: 500; color: var(--fg); margin-top: 4px; }
.forge-survey__input,
.forge-survey__select {
  width: 100%; box-sizing: border-box; font-family: inherit; font-size: 14px;
  padding: 9px 11px; color: var(--fg);
  background: var(--bg-input, var(--bg)); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm, 8px); transition: border-color .12s var(--ease-out);
}
.forge-survey__input:focus,
.forge-survey__select:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.forge-survey__error { margin: 2px 0 0; font-size: 12.5px; color: var(--danger, #c0392b); }
.forge-survey__actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.forge-survey__skip {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 13.5px; color: var(--fg-muted); padding: 8px 10px; border-radius: var(--radius-pill);
}
.forge-survey__skip:hover { color: var(--fg); background: var(--bg-chip); }

/* ── PlanCards — shared pricing grid (marketing pricing + in-app upgrade) ──── */
.forge-plans-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.forge-billtoggle { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: var(--radius-pill); background: var(--bg-chip); }
.forge-billtoggle button { border: none; background: transparent; padding: 8px 18px; border-radius: var(--radius-pill); font-family: var(--font-sans, inherit); font-size: 13px; font-weight: 600; color: var(--fg-muted); cursor: pointer; transition: all .16s var(--ease-out, ease); }
.forge-billtoggle button[data-on="true"] { background: var(--bg-elev, var(--bg)); color: var(--fg); box-shadow: var(--shadow-xs, 0 1px 2px rgba(10,10,26,.06)); }
.forge-billtoggle__save { color: var(--good, var(--accent)); font-weight: 600; }
.forge-plans { width: 100%; display: grid; grid-template-columns: repeat(var(--forge-plan-cols, 3), 1fr); gap: 16px; align-items: start; }
.forge-plan { background: var(--bg-elev, var(--bg)); border: 1px solid var(--border, var(--hairline)); border-radius: var(--radius-card, 16px); box-shadow: var(--shadow-soft, 0 1px 3px rgba(10,10,26,.06)); padding: 26px; display: flex; flex-direction: column; gap: 16px; position: relative; }
.forge-plan--featured { border-color: color-mix(in srgb, var(--accent) 40%, transparent); box-shadow: 0 1px 3px rgba(10,10,26,.04), 0 18px 44px color-mix(in srgb, var(--accent) 16%, transparent); }
.forge-plan--current { opacity: .92; }
.forge-plan__tag { position: absolute; top: -11px; left: 26px; padding: 4px 11px; border-radius: var(--radius-pill); background: var(--accent); color: var(--accent-fg, #fff); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.forge-plan__name { font-family: var(--font-display, inherit); font-size: 17px; font-weight: 600; }
.forge-plan__price { display: flex; align-items: baseline; gap: 4px; }
.forge-plan__amt { font-family: var(--font-display, inherit); font-size: 42px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.forge-plan__per { font-size: 13px; color: var(--fg-subtle, var(--fg-muted)); }
.forge-plan__desc { font-size: 13px; color: var(--fg-muted); line-height: 1.5; margin: 0; min-height: 38px; }
.forge-plan__feats { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.forge-plan__feats li { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--fg); line-height: 1.4; }
.forge-plan__feats svg { color: var(--accent); flex: none; margin-top: 1px; }
/* highlight a differentiating feature (e.g. Flows on Pro/Team). Selector matches
   the `.forge-plan__feats li` specificity so the accent colour actually wins. */
.forge-plan__feats li.forge-plan__feat--hl { color: var(--accent); font-weight: 600; }
.forge-plan__cta { margin-top: auto; padding-top: 4px; }

/* chips — small caveat/status pills under the price */
.forge-plan__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.forge-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 600; line-height: 1; }
.forge-chip svg { flex: none; }
.forge-chip--muted { background: var(--bg-chip); color: var(--fg-muted); }
.forge-chip--accent { background: var(--accent-bg-soft); color: var(--accent); }
.forge-chip--good { background: var(--good-soft); color: color-mix(in srgb, var(--good) 64%, var(--fg)); }
.forge-chip--warning { background: color-mix(in srgb, #e0a216 18%, transparent); color: color-mix(in srgb, #b07d00 60%, var(--fg)); }

/* CTA loading spinner (immediate feedback while onSelect is pending) */
.forge-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: forge-spin .6s linear infinite; }
@keyframes forge-spin { to { transform: rotate(360deg); } }

/* ── UpgradeDialog — modal wrapper ─────────────────────────────────────────── */
.forge-upgrade { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; }
/* Plain dim — NO backdrop-filter: the blur re-rasterizes on every parent re-render
   (the Builder re-renders frequently), which reads as a flicker. */
.forge-upgrade__scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--fg) 52%, transparent); animation: forge-fade .14s var(--ease-out, ease) both; }
.forge-upgrade__panel { position: relative; width: 100%; max-width: 920px; max-height: 90vh; overflow: auto; background: var(--bg, #fff); border: 1px solid var(--border, var(--hairline)); border-radius: var(--radius-card, 16px); box-shadow: var(--shadow-lg); padding: 32px 28px; animation: forge-pop .16s var(--ease-out, ease) both; }
@keyframes forge-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes forge-pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.forge-upgrade__close { position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 32px; height: 32px; border: none; border-radius: var(--radius-pill); background: var(--bg-chip); color: var(--fg-muted); cursor: pointer; }
.forge-upgrade__close:hover { color: var(--fg); }
.forge-upgrade__title { font-family: var(--font-display, inherit); font-size: 22px; font-weight: 600; text-align: center; margin: 0 0 24px; letter-spacing: -0.02em; }
@media (max-width: 860px) { .forge-plans { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .forge-plans { grid-template-columns: 1fr; } }

/* ── Endorsement — shared "A Mostly Tiny product" footer line ─────────────── */
.forge-endorse { display: inline-flex; align-items: center; gap: 8px; }
.forge-endorse__link { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.forge-endorse__link:hover { color: var(--fg); }
.forge-endorse__link strong { color: var(--fg-muted); font-weight: 600; }
.forge-endorse__tail { color: inherit; }

/* ── Footer — shared marketing footer template (window.ForgeKit.Footer) ───── */
.forge-footer { border-top: 1px solid var(--hairline); background: var(--bg-elev); }
.forge-footer__inner { display: grid; grid-template-columns: 1.7fr repeat(var(--forge-footer-cols, 3), 1fr); gap: 32px; padding: 48px 32px 32px; max-width: 1160px; margin: 0 auto; }
.forge-footer__tag { font-size: 13px; color: var(--fg-muted); max-width: 24em; margin: 14px 0 0; line-height: 1.5; }
.forge-footer__col { display: flex; flex-direction: column; gap: 10px; }
.forge-footer__h { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-subtle); margin-bottom: 14px; }
.forge-footer__col a { font-size: 13.5px; color: var(--fg-muted); text-decoration: none; cursor: pointer; transition: color .12s; }
.forge-footer__col a:hover { color: var(--fg); }
.forge-footer__base { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 32px; border-top: 1px solid var(--hairline); font-size: 12.5px; color: var(--fg-subtle); max-width: 1160px; margin: 0 auto; }
.forge-footer__meta { display: inline-flex; align-items: center; gap: 16px; }
.forge-footer__ver { font-size: 11px; }
@media (max-width: 720px) { .forge-footer__inner { grid-template-columns: 1fr; } }

/* ── LangSwitcher — footer locale dropdown (window.ForgeKit.LangSwitcher) ──── */
.forge-langswitch { position: relative; }
.forge-langswitch__trigger { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line, var(--hairline)); border-radius: 999px; background: var(--card, var(--bg-elev)); color: var(--fg); font: inherit; font-size: 13px; line-height: 1; cursor: pointer; }
.forge-langswitch__flag { font-size: 15px; }
.forge-langswitch__caret { font-size: 9px; opacity: .55; transition: transform .15s; }
.forge-langswitch__menu { position: absolute; bottom: calc(100% + 8px); right: 0; min-width: 180px; background: var(--card, var(--bg-elev)); border: 1px solid var(--line, var(--hairline)); border-radius: 14px; box-shadow: 0 1px 3px rgba(10,10,26,0.06), 0 12px 32px rgba(10,10,26,0.12); padding: 6px; z-index: 50; }
.forge-langswitch__opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; text-decoration: none; color: var(--fg); font-size: 13.5px; }
.forge-langswitch__opt:hover { background: var(--bone, rgba(0,0,0,0.04)); }
.forge-langswitch__opt[aria-selected="true"] { background: var(--bone, rgba(0,0,0,0.04)); font-weight: 600; }
.forge-langswitch__opt-name { flex: 1; }
.forge-langswitch__opt [data-forge-icon], .forge-langswitch__opt svg { color: var(--accent, currentColor); }
