/* Layout: the three chrome modes (DESIGN_SPEC §2) plus the narrow-screen collapse the design left open.
   Shell     .ef-app--shell     cream sidebar 252px + floating white main panel
   First run .ef-app--firstrun  dark "Getting started" aside 272px + main panel
   Funnel    .ef-app--onb       dark aside minmax(240px,32%) + centred column, no top bar
   Bare      .ef-app--bare      auth / org creation (funnel look, no step list) */

.ef-app { height: 100vh; height: 100dvh; background: var(--bg-app); }

/* Static first paint (index.html) until the router mounts its chrome over it. */
.ef-boot { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: var(--text-muted); }
.ef-boot__mark { width: 44px; height: 44px; }
.ef-boot .ef-btn__spin { width: 16px; height: 16px; }

/* Mock mode (?mock=1): a small fixed ribbon so demo data is never taken for real data. */
html[data-mock]::after {
  content: attr(data-mock-label); position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 1000;
  padding: 3px 12px; border-radius: 0 0 8px 8px; background: var(--orange); color: var(--ink);
  font: 500 11px var(--font-mono); letter-spacing: .04em; text-transform: uppercase; pointer-events: none;
}
.ef-app--shell, .ef-app--firstrun { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.ef-app--firstrun { grid-template-columns: var(--sidebar-w-firstrun) minmax(0, 1fr); }

/* ── Sidebar (normal) ───────────────────────────────────────────────────── */
.ef-sidebar { display: flex; flex-direction: column; gap: 18px; padding: 18px 14px 16px; min-height: 0; overflow-y: auto; background: var(--bg-app); }
.ef-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; text-decoration: none; color: inherit; }
.ef-brand__mark { flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; }
.ef-brand__mark--32 { width: 32px; height: 32px; }
.ef-brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.ef-brand__name { font: 600 15px var(--font-sans); color: var(--ink); }
.ef-brand__by { display: flex; align-items: center; gap: 4px; font: 400 12px var(--font-sans); color: var(--text-muted); }
.ef-brand__by img { height: 10px; width: auto; position: relative; top: 1px; }

.ef-orgswitch { position: relative; }
.ef-orgswitch__btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--a18); border-radius: var(--r-pill); background: #fff; text-align: left; box-shadow: var(--sh-card); }
.ef-orgswitch__btn:hover { border-color: var(--a28); }
.ef-orgswitch__avatar { flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--on-dark); display: grid; place-items: center; font: 600 13px var(--font-sans); }
.ef-orgswitch__text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ef-orgswitch__name { font: 600 14px var(--font-sans); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ef-orgswitch__status { display: flex; align-items: center; gap: 6px; font: 400 12px var(--font-sans); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ef-orgswitch__chev { color: var(--text-muted); }

.ef-nav { display: flex; flex-direction: column; gap: 2px; }
.ef-nav__item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; font: 500 14px var(--font-sans); color: var(--ink); text-align: left; text-decoration: none; }
.ef-nav__item:hover { background: var(--a12); color: var(--ink); }
.ef-nav__item[aria-current="page"] { background: #fff; box-shadow: var(--sh-nav-current); }
.ef-nav__icon { width: 18px; display: grid; place-items: center; color: var(--text); }
.ef-nav__label { flex: 1; }
.ef-nav__count { font: 500 12px var(--font-sans); color: var(--text-muted); }

.ef-sideevents { display: flex; flex-direction: column; gap: 2px; }
.ef-sideevents__label { font: 500 12px var(--font-sans); color: var(--text-muted); padding: 0 10px 6px; }
.ef-sideevents__item { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 10px; font: 400 14px var(--font-sans); color: var(--ink); text-decoration: none; }
.ef-sideevents__item:hover { background: var(--a12); color: var(--ink); }
.ef-sideevents__item[aria-current="page"] { background: #fff; box-shadow: var(--sh-nav-current); }
.ef-sideevents__name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ef-sideevents__empty { padding: 0 10px; font: 400 13px var(--font-sans); color: var(--text-muted); }

.ef-sidefoot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.ef-readonly-box { padding: 14px; border-radius: var(--r-box); background: var(--a12); font: 400 13px/1.45 var(--font-sans); color: var(--text-strong); }
.ef-user { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.ef-user__avatar { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--orange); display: grid; place-items: center; font: 500 12px var(--font-sans); color: var(--ink); }
.ef-user__name { font: 500 14px var(--font-sans); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Dark asides (first run + funnel) ───────────────────────────────────── */
.ef-dark-aside { position: relative; overflow: hidden; background: var(--ink); color: var(--on-dark-2); display: flex; flex-direction: column; min-height: 0; }
.ef-dark-aside > * { position: relative; }
/* The glow is painted as a background layer, not a positioned element: an element hanging past the
   bottom edge made the aside's own scroll area taller, so a scrollable aside always showed a
   scrollbar. The background cannot overflow; the aside only scrolls when its content does. */
.ef-dark-aside { background: var(--glow) right -190px bottom -200px / 380px 380px no-repeat, var(--ink); }
.ef-dark-aside__glow { display: none; }
.ef-firstrun-aside { padding: 26px 22px 22px; gap: 26px; overflow-y: auto; }
.ef-onb-aside { padding: 24px 28px 20px; gap: 16px; overflow-y: auto; }
.ef-dark-aside__brand { display: flex; align-items: center; gap: 10px; }
.ef-dark-aside__name { font: 600 15px var(--font-sans); color: var(--on-dark); }
.ef-onb-aside .ef-dark-aside__name { font-size: 16px; }
.ef-dark-aside__h2 { font: var(--fw-heading) 20px/1.25 var(--font-display); letter-spacing: -.01em; color: var(--on-dark); }
.ef-onb-aside .ef-dark-aside__h2 { font-size: 19px; line-height: 1.2; }
.ef-dark-aside__steplabel { font: 400 13px var(--font-sans); color: var(--text-faint); margin-top: 6px; }
.ef-dark-aside__note { margin-top: auto; font: 400 13px/1.5 var(--font-sans); color: var(--text-faint); }
.ef-dark-aside__note b { color: var(--on-dark); }
.ef-dark-aside__kb { display: inline-block; margin-bottom: 10px; font: 500 12px var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--orange-light); }
.ef-dark-aside__kb:hover { color: var(--on-dark); }
/* The way out of the funnel: Help, Settings, the org picker, Sign out (every dark aside). */
.ef-dark-aside__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.ef-dark-aside__note + .ef-dark-aside__foot { margin-top: 0; }
.ef-dark-aside__links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.ef-dark-aside__links .ef-dark-aside__kb { margin-bottom: 0; }
.ef-dark-aside__link { padding: 0; border: 0; background: none; font: 500 13px var(--font-sans); color: var(--on-dark-2); text-decoration: none; cursor: pointer; }
.ef-dark-aside__link:hover, .ef-dark-aside__link:focus-visible { color: var(--on-dark); text-decoration: underline; text-underline-offset: 3px; }
.ef-dark-aside__org { display: flex; flex-direction: column; gap: 4px; font: 400 12px var(--font-sans); color: var(--text-faint); }
.ef-dark-aside__select { max-width: 100%; padding: 6px 8px; border: 1px solid var(--dark-3); border-radius: 8px; background: var(--dark-2); font: 500 13px var(--font-sans); color: var(--on-dark); }

.ef-steps { display: flex; flex-direction: column; gap: 2px; }
.ef-onb-aside .ef-steps { gap: 4px; }
.ef-steps__item { display: flex; gap: 12px; align-items: center; min-height: 38px; padding: 0 10px; border-radius: 10px; }
.ef-onb-aside .ef-steps__item { min-height: 33px; border-radius: 12px; }
.ef-steps__dot { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 500 11px var(--font-sans); border: 1px solid var(--dark-3); color: var(--text-faint); }
.ef-onb-aside .ef-steps__dot { width: 26px; height: 26px; font-size: 12px; }
.ef-steps__label { font: 500 13px var(--font-sans); color: var(--text-faint-dark); }
.ef-onb-aside .ef-steps__label { font-size: 14px; }
.ef-steps__item.is-done .ef-steps__dot { background: var(--orange-light); color: var(--ink); border: 0; }
.ef-steps__item.is-done .ef-steps__label { color: var(--on-dark); }
.ef-steps__item[aria-current="step"] { background: var(--dark-2); }
.ef-steps__item[aria-current="step"] .ef-steps__dot { background: var(--orange); color: var(--ink); border: 0; }
.ef-steps__item[aria-current="step"] .ef-steps__label { color: var(--on-dark); }
.ef-onb-compact { display: none; }

/* ── Main panel + top bar ───────────────────────────────────────────────── */
.ef-main { margin: 8px 8px 8px 0; background: var(--bg-card); border: 1px solid var(--a14); border-radius: var(--r-panel); overflow: auto; box-shadow: var(--sh-panel); min-height: 0; position: relative; }
.ef-topbar { position: sticky; top: 0; z-index: var(--z-sticky); height: var(--topbar-h); display: flex; align-items: center; gap: 16px; padding: 0 28px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--a08); backdrop-filter: saturate(1.2) blur(6px); }
.ef-menu-btn { display: none; flex-shrink: 0; width: 40px; height: 40px; border: 1px solid var(--a18); border-radius: 10px; background: #fff; place-items: center; color: var(--ink); }
.ef-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font: 500 14px var(--font-sans); color: var(--text-muted); }
.ef-crumbs__item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ef-crumbs__item a, .ef-crumbs__item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ef-crumbs__item a { color: var(--text-muted); text-decoration: none; }
.ef-crumbs__item a:hover { color: var(--ink); text-decoration: underline; }
.ef-crumbs__item:last-child > span { color: var(--ink); }
.ef-crumbs__sep { color: var(--a28); }
.ef-topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.ef-content { max-width: var(--content-max); margin: 0 auto; padding: 28px 36px 120px; display: flex; flex-direction: column; gap: 24px; }
.ef-content > * { animation: ef-rise var(--t-rise) ease; }

/* ── Funnel (onboarding) ────────────────────────────────────────────────── */
.ef-app--onb, .ef-app--bare { display: grid; grid-template-columns: minmax(240px, 32%) minmax(0, 1fr); background: #fff; }
.ef-onb-main { overflow: auto; display: flex; justify-content: center; padding: 48px 40px 120px; min-height: 0; }
.ef-onb-col { width: 100%; max-width: var(--onb-max); flex-shrink: 0; align-self: flex-start; display: flex; flex-direction: column; gap: 22px; animation: ef-rise var(--t-rise) ease; }
.ef-onb-col--narrow { max-width: 460px; }
.ef-onb-steplabel { font: 500 13px var(--font-sans); color: var(--text-muted); }
.ef-onb-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 16px; padding-top: 8px; padding-right: 60px; /* clear the fixed support launcher, bottom-right */ }
.ef-onb-actions--end { justify-content: flex-end; }

/* ── Drawer scrim (narrow) ──────────────────────────────────────────────── */
.ef-scrim { display: none; }

/* ── Narrow screens: sidebar becomes an off-canvas drawer ───────────────── */
@media (max-width: 960px) {
  .ef-app--shell, .ef-app--firstrun { grid-template-columns: minmax(0, 1fr); }
  .ef-sidebar, .ef-firstrun-aside {
    position: fixed; z-index: var(--z-drawer); inset: 0 auto 0 0; width: min(300px, 86vw);
    transform: translateX(-105%); transition: transform .2s ease; visibility: hidden;
    box-shadow: 0 16px 40px rgba(22,17,11,.2);
  }
  .ef-app.is-drawer-open .ef-sidebar, .ef-app.is-drawer-open .ef-firstrun-aside { transform: none; visibility: visible; }
  .ef-app.is-drawer-open .ef-scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); background: rgba(13,15,28,.35); }
  .ef-main { margin: 0; border-radius: 0; border: 0; box-shadow: none; }
  .ef-menu-btn { display: grid; }
  .ef-topbar { padding: 0 16px; gap: 10px; }
  .ef-content { padding: 20px 16px 104px; gap: 20px; }
  .ef-crumbs__item:not(:last-child) { display: none; }
}
@media (max-width: 640px) {
  .ef-topbar .ef-search { width: auto; flex: 1; }
  .ef-topbar__right { flex: 1; justify-content: flex-end; }
  .ef-crumbs { display: none; }
}

/* ── Event routes: the design's phone bar (← · event name · ☰) ──────────── */
.ef-evbar__back, .ef-evbar__title, .ef-drawer-tools { display: none; }
@media (max-width: 640px) {
  .ef-topbar--event { height: 52px; padding: 0 12px; gap: 4px; }
  .ef-topbar--event .ef-topbar__crumbs, .ef-topbar--event .ef-topbar__right { display: none; }
  .ef-evbar__back { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; font: 500 18px var(--font-sans); color: var(--ink); text-decoration: none; }
  .ef-evbar__title { display: block; flex: 1; min-width: 0; text-align: center; font: 600 15px var(--font-sans); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ef-topbar--event .ef-menu-btn { order: 1; width: 44px; height: 44px; border: 0; background: none; font: 500 18px var(--font-sans); }
  .ef-drawer-tools { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
  .ef-drawer-tools .ef-search { width: auto; }
  .ef-drawer-tools > :last-child { align-self: flex-start; }
}

/* ── Narrow screens: funnel aside collapses to a compact header ─────────── */
@media (max-width: 860px) {
  .ef-app--onb, .ef-app--bare { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .ef-onb-aside { padding: 14px 16px; gap: 10px; overflow: hidden; }
  .ef-onb-aside .ef-dark-aside__intro, .ef-onb-aside .ef-steps, .ef-onb-aside .ef-dark-aside__note, .ef-onb-aside .ef-dark-aside__glow { display: none; }
  .ef-onb-compact { display: flex; flex-direction: column; gap: 8px; }
  .ef-onb-compact__label { font: 500 13px var(--font-sans); color: var(--on-dark-2); }
  .ef-onb-compact__track { height: 4px; border-radius: var(--r-bar); background: var(--dark-3); overflow: hidden; }
  .ef-onb-compact__fill { display: block; height: 100%; background: var(--orange); border-radius: var(--r-bar); }
  /* Help, Settings and Sign out stay on phones: one row under the progress. */
  .ef-onb-aside .ef-dark-aside__foot { margin-top: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
  .ef-onb-aside .ef-dark-aside__org { flex-direction: row; align-items: center; gap: 8px; }
  .ef-onb-main { padding: 24px 16px 104px; }
}

/* Done onboarding steps link back (dark aside). */
.ef-steps__link { color: inherit; text-decoration: none; }
.ef-steps__link:hover .ef-steps__label, .ef-steps__link:focus-visible .ef-steps__label { color: var(--on-dark); text-decoration: underline; text-underline-offset: 3px; }

/* ── Front page (sign in / sign up): dark pitch panel + form ────────────── */
.ef-app--front { display: grid; grid-template-columns: minmax(240px, 32%) minmax(0, 1fr); background: #fff; }
.ef-front-aside { padding: 24px 28px 20px; gap: 20px; overflow-y: auto; background: var(--glow) right -240px bottom -260px / 520px 520px no-repeat, var(--ink); }
.ef-front-aside .ef-dark-aside__name { font-size: 16px; }
.ef-front__hero { display: flex; flex-direction: column; gap: 22px; max-width: 480px; margin: calc(max(120px, 24vh) - 100px) 0 auto; }
.ef-front__eyebrow { line-height: 16px; margin: 0 0 8px; white-space: nowrap; }
.ef-front__h1 { font: var(--fw-heading) 32px/1.08 var(--font-display); letter-spacing: -.025em; color: var(--on-dark); text-wrap: balance; }
.ef-front__lead { font: 400 16px/1.5 var(--font-sans); color: #B9BBC8; margin-top: 14px; text-wrap: pretty; }
.ef-front__steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.ef-front__step { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: start; }
.ef-front__num { width: 28px; height: 28px; border-radius: 50%; border: 1px solid #383E62; display: grid; place-items: center; font: 500 12px var(--font-sans); color: var(--orange-light); }
.ef-front__steptitle { font: 600 16px var(--font-sans); color: var(--on-dark); padding-top: 3px; }
.ef-front__stepsub { font: 400 14px/1.45 var(--font-sans); color: #9A9CAD; text-wrap: pretty; }
.ef-front__privacy { display: flex; gap: 8px; align-items: center; margin: 0; font: 400 13px/1.4 var(--font-sans); color: #B9BBC8; flex-shrink: 0; }
.ef-front__privacyicon { flex-shrink: 0; color: var(--orange-light); }
.ef-front__by { display: flex; align-items: center; gap: 6px; font: 400 13px var(--font-sans); color: var(--text-faint); }
.ef-front__by img { height: 12px; width: auto; position: relative; top: 1px; }
.ef-front-main { display: flex; flex-direction: column; padding: 24px 40px 120px; overflow: auto; min-height: 0; }
.ef-front-main__top { display: flex; justify-content: flex-end; }
.ef-front-col { width: 100%; max-width: 380px; margin: calc(max(120px, 24vh) - 60px) auto auto; animation: ef-rise var(--t-rise) ease; }
.ef-front-stack, .ef-front-form { gap: 18px; }
.ef-front__title { font: var(--fw-heading) 26px/1.2 var(--font-display); letter-spacing: -.02em; color: var(--ink); }
.ef-front__sub { font: 400 14px var(--font-sans); color: var(--text-muted); margin-top: 6px; }
.ef-input.ef-input--front { border-radius: 12px; box-shadow: none; font-size: 14px; }
.ef-input.ef-input--front:focus-visible { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,133,0,.18); }
.ef-front__labelrow { display: flex; justify-content: space-between; align-items: baseline; }
.ef-front__forgot { padding: 0; border: 0; background: none; font: 400 13px var(--font-sans); color: var(--text-muted); text-decoration: underline; cursor: pointer; }
.ef-front__forgot:hover { color: var(--ink); }
.ef-btn--block { width: 100%; }
.ef-front-form .ef-btn--primary { min-height: 46px; font-size: 13px; }
.ef-front__switch { margin: 0; font: 400 13px/1.5 var(--font-sans); color: var(--text-muted); text-align: center; }
.ef-front__switch a { color: var(--ink); }
@media (max-width: 860px) {
  .ef-app--front { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .ef-front-aside { padding: 14px 16px; gap: 10px; overflow: hidden; }
  .ef-front__hero, .ef-front__by { display: none; }
  .ef-front-main { padding: 16px 16px 104px; }
  .ef-front-col { margin-top: 24px; }
}
