/* ==========================================================================
   Bundles prototype: a clickable, Polaris-style (2024+) Shopify admin. It is the "end state" of the process.
   Fictional app "Bundles" by "Oakline Apps"; products by "Aurelle". No Shopify marks, no Shopify green.
   Every selector lives under .e2-proto, so nothing here can leak into the host page.
   Markup: src/_includes/e2/proto.njk   Behaviour: src/assets/js/e2-proto.js

   Sizing: the root fills its parent (height 100%, min 380px, so the parent needs a definite height) and is a size
   container named "e2proto".
     >= 560px   left nav on, desktop control sizes (32px buttons, 36px fields, 40px top bar)
     <  560px   nav off, thumb-sized controls (44px) and a 52px top bar so the save bar buttons can be 44px too
   ========================================================================== */

.e2-proto {
  --e2p-bg: #f1f1f1;
  --e2p-surface: #fff;
  --e2p-nav-bg: #ebebeb;
  --e2p-line: #e3e3e3;
  --e2p-line-soft: #ebebeb;
  --e2p-ink: #303030;
  --e2p-ink-2: #616161;
  --e2p-ink-3: #747474;
  --e2p-field-line: #8a8a8a;
  --e2p-focus: #005bd3;
  --e2p-blue: #1f6feb;
  --e2p-crit: #8e1f0b;
  --e2p-crit-line: #e51c00;
  --e2p-crit-bg: #fff6f5;
  --e2p-top-bg: #1a1a1a;
  --e2p-save-bg: #303030;
  --e2p-ease: cubic-bezier(.2, .8, .2, 1);

  /* Control sizes. Overridden below for narrow containers and coarse pointers. */
  --e2p-ctl: 32px;
  --e2p-field: 36px;
  --e2p-row: 36px;
  --e2p-top-h: 40px;
  --e2p-pad: 16px;
  --e2p-gap: 16px;
  --e2p-nav-w: clamp(148px, 25cqi, 200px);

  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 380px;
  container: e2proto / inline-size;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 12px;
  background: var(--e2p-bg);
  /* A mid-grey ring reads on a white card and on a dark one. The host may clip anything outside it. */
  box-shadow: 0 0 0 1px rgba(128, 128, 128, .28), 0 1px 3px rgba(0, 0, 0, .08);
  color: var(--e2p-ink);
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}
.e2-proto *, .e2-proto *::before, .e2-proto *::after { box-sizing: border-box; }
.e2-proto :where(p, h3, h4, ul, fieldset, figure) { margin: 0; padding: 0; }
.e2-proto :where(ul) { list-style: none; }
.e2-proto [hidden] { display: none !important; }
.e2-proto .e2p-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.e2-proto .e2p-ico { display: block; flex: none; }

/* The browser pane around everything: top bar over (nav + page), save bar and toast layered on top. */
.e2-proto .e2p {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: var(--e2p-top-h) minmax(0, 1fr);
}

/* Visible focus on every control. 0,3,0 on purpose: it has to beat the host's ".e2 :focus-visible" ring. */
.e2-proto .e2p :focus-visible { outline: 2px solid var(--e2p-focus); outline-offset: 2px; }
.e2-proto .e2p-top :focus-visible, .e2-proto .e2p-savebar :focus-visible { outline-color: #fff; }
.e2-proto .e2p .e2p-input:focus-visible, .e2-proto .e2p .e2p-select:focus-visible { outline-offset: -1px; }
.e2-proto .e2p .e2p-choice > input:focus-visible { outline: 0; }

/* ---------- Top bar (dark, slim) ---------- */
.e2-proto .e2p-top {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding-inline: 12px;
  background: var(--e2p-top-bg);
  color: #e3e3e3;
}
.e2-proto .e2p-search {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 auto; min-width: 0; max-width: 400px; margin-inline: auto;
  height: calc(var(--e2p-top-h) - 14px);
  padding-inline: 10px;
  border-radius: 8px;
  background: #303030;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
  color: #b5b5b5;
  font-size: 12px; line-height: 16px;
}
.e2-proto .e2p-search .e2p-ico { width: 16px; height: 16px; }
.e2-proto .e2p-store { display: flex; align-items: center; gap: 8px; flex: none; font-size: 12px; font-weight: 550; line-height: 16px; color: #e3e3e3; }
.e2-proto .e2p-avatar {
  width: 24px; height: 24px; border-radius: 6px;
  background: #c9c9c9; color: #1a1a1a;
  font-size: 11px; line-height: 24px; font-weight: 650; text-align: center;
}

/* ---------- Contextual save bar: slides in over the top bar ---------- */
.e2-proto .e2p-savebar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  height: var(--e2p-top-h);
  display: flex; align-items: center; gap: 12px;
  padding-inline: 12px;
  background: var(--e2p-save-bg);
  color: #fff;
  transform: translateY(-100%);
  visibility: hidden;
  transition: transform .22s var(--e2p-ease), visibility 0s linear .22s;
}
.e2-proto .e2p-savebar.is-open {
  transform: none; visibility: visible;
  transition: transform .22s var(--e2p-ease), visibility 0s;
}
.e2-proto .e2p-savebar__msg { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.e2-proto .e2p-savebar__actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------- Body: nav + page ---------- */
.e2-proto .e2p-body { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.e2-proto .e2p-main {
  min-width: 0; min-height: 0;
  overflow-x: hidden; overflow-y: auto;
  padding: var(--e2p-pad);
  scroll-padding: var(--e2p-pad);
  scrollbar-width: thin; scrollbar-color: #c9c9c9 transparent;
}
.e2-proto .e2p-page { display: flex; flex-direction: column; gap: var(--e2p-gap); width: 100%; max-width: 660px; margin-inline: auto; }
.e2-proto .e2p-screen:not([data-screen^="skeleton"]) { animation: e2p-in .2s var(--e2p-ease) both; }
@keyframes e2p-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Left nav (App Bridge style: the app lives under "Apps" with its own sub-items) ---------- */
.e2-proto .e2p-nav {
  display: none; flex-direction: column; gap: 4px;
  padding: 8px; overflow-y: auto;
  background: var(--e2p-nav-bg);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, .05);
  scrollbar-width: thin;
}
.e2-proto .e2p-nav__list { display: flex; flex-direction: column; gap: 2px; }
.e2-proto .e2p-nav__item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 32px; margin: 0; padding: 0 8px;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--e2p-ink); font: inherit; font-weight: 450; text-align: left;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.e2-proto .e2p-nav__item .e2p-ico { width: 20px; height: 20px; color: var(--e2p-ink-2); }
.e2-proto .e2p-nav__item[aria-disabled="true"] { cursor: default; }
.e2-proto .e2p-nav__item[aria-current="page"] { background: #fff; font-weight: 650; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 1px 1px rgba(0, 0, 0, .05); }
.e2-proto .e2p-nav__group { margin: 12px 0 2px; padding: 0 8px; color: var(--e2p-ink-2); font-size: 12px; line-height: 16px; font-weight: 550; }
.e2-proto .e2p-nav__app { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 8px; font-weight: 550; }
.e2-proto .e2p-nav__app > .e2p-ico:last-child { width: 16px; height: 16px; margin-left: auto; color: var(--e2p-ink-2); }
.e2-proto .e2p-nav__appicon {
  display: grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 6px;
  background: linear-gradient(140deg, #8a9bff, #4357e0);
  color: #fff;
}
.e2-proto .e2p-nav__appicon .e2p-ico { width: 14px; height: 14px; }
.e2-proto .e2p-nav__sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 0 17px; padding-left: 10px; border-left: 1px solid #d1d1d1; }
.e2-proto .e2p-nav__sub .e2p-nav__item { min-height: 28px; }

@container e2proto (min-width: 560px) {
  .e2-proto .e2p-body { grid-template-columns: var(--e2p-nav-w) minmax(0, 1fr); }
  .e2-proto .e2p-nav { display: flex; }
}

/* ---------- Page header ---------- */
.e2-proto .e2p-head { display: flex; align-items: center; gap: 8px; min-height: var(--e2p-ctl); }
.e2-proto .e2p-title { flex: 0 1 auto; min-width: 0; border-radius: 4px; font-size: 20px; line-height: 28px; font-weight: 650; letter-spacing: -.01em; color: var(--e2p-ink); }

/* ---------- Buttons ---------- */
.e2-proto .e2p-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--e2p-ctl); margin: 0; padding: 0 12px;
  border: 0; border-radius: 8px;
  font: inherit; font-weight: 550; line-height: 20px; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background-color .12s ease, box-shadow .12s ease;
}
.e2-proto .e2p-btn--primary {
  color: #fff;
  background: linear-gradient(180deg, rgba(48, 48, 48, 0) 63.53%, rgba(255, 255, 255, .15) 100%), #303030;
  box-shadow: inset 1px 0 0 rgba(0, 0, 0, .8), inset -1px 0 0 rgba(0, 0, 0, .8), inset 0 -1px 0 rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .25);
}
/* On the dark save bar: Discard is the quiet one, Save is the one filled button. */
.e2-proto .e2p-btn--bar-2 { color: #fff; background: rgba(255, 255, 255, .14); }
.e2-proto .e2p-btn--bar-1 { color: #1a1a1a; background: #fff; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .18); }
.e2-proto .e2p-btn[aria-disabled="true"] { cursor: default; }
.e2-proto .e2p-btn--bar-2[aria-disabled="true"] { opacity: .5; }
.e2-proto .e2p-btn[data-loading] .e2p-btn__label { opacity: 0; }
.e2-proto .e2p-btn[data-loading]::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: e2p-spin .6s linear infinite;
}
@keyframes e2p-spin { to { transform: rotate(360deg); } }

.e2-proto .e2p-icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: var(--e2p-ctl); height: var(--e2p-ctl); margin: 0 0 0 -6px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--e2p-ink-2);
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}

/* "Try it" hint: a pulsing blue dot on the corner of the primary action and a small tooltip beside it. */
.e2-proto .e2p-cta { position: relative; flex: none; margin-left: auto; }
.e2-proto .e2p-hint { position: absolute; inset: 0; pointer-events: none; }
.e2-proto .e2p-hint__dot {
  position: absolute; top: -4px; right: -4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--e2p-blue);
  box-shadow: 0 0 0 2px var(--e2p-bg);
}
/* The ring is a growing box-shadow, not a scaled copy: a shadow never adds to the scrollable overflow of the page area. */
.e2-proto .e2p-hint__dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  animation: e2p-pulse 1.8s ease-out infinite;
}
@keyframes e2p-pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 111, 235, .55); } 80%, 100% { box-shadow: 0 0 0 13px rgba(31, 111, 235, 0); } }
.e2-proto .e2p-hint__tip {
  position: absolute; top: 50%; right: calc(100% + 10px); transform: translateY(-50%);
  padding: 4px 8px; border-radius: 8px;
  background: #1a1a1a; color: #fff;
  font-size: 12px; line-height: 16px; font-weight: 550; white-space: nowrap;
}
.e2-proto .e2p-hint__tip::after {
  content: ''; position: absolute; top: 50%; left: 100%; margin-top: -4px;
  border: 4px solid transparent; border-left-color: #1a1a1a;
}

/* ---------- Cards, metrics, list ---------- */
.e2-proto .e2p-card {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: var(--e2p-pad);
  border-radius: 12px; background: var(--e2p-surface);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .07), inset 0 0 0 1px var(--e2p-line);
}
.e2-proto .e2p-card__title { font-size: 14px; line-height: 20px; font-weight: 650; color: var(--e2p-ink); }
.e2-proto .e2p-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: var(--e2p-pad) var(--e2p-pad) 12px; }
.e2-proto .e2p-card--list { gap: 0; padding: 0; }
.e2-proto .e2p-aside { color: var(--e2p-ink-2); font-size: 12px; line-height: 16px; }

.e2-proto .e2p-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--e2p-gap); }
.e2-proto .e2p-metric { gap: 2px; }
.e2-proto .e2p-metric__label { color: var(--e2p-ink-2); }
.e2-proto .e2p-metric__row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.e2-proto .e2p-metric__value { font-size: 20px; line-height: 28px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.e2-proto .e2p-trend { color: #0c5132; font-size: 12px; line-height: 16px; font-weight: 550; }
.e2-proto .e2p-trend > [aria-hidden] { margin-right: 1px; }
/* margin-top:auto pins the sparkline to the bottom of the card, so the two cards line up even if one value wraps. */
.e2-proto .e2p-spark { display: block; width: 100%; height: 30px; margin-top: auto; padding-top: 6px; overflow: visible; }
.e2-proto .e2p-spark__fill { fill: rgba(31, 111, 235, .09); }
.e2-proto .e2p-spark__line { fill: none; stroke: #2c6ecb; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

.e2-proto .e2p-list { margin: 0 1px 1px; }
.e2-proto .e2p-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px calc(var(--e2p-pad) - 1px);
  border-top: 1px solid var(--e2p-line-soft);
}
.e2-proto .e2p-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.e2-proto .e2p-row__meta { color: var(--e2p-ink-2); font-size: 12px; line-height: 16px; }
.e2-proto .e2p-row--new { animation: e2p-new-row 1.8s ease-out both; }
@keyframes e2p-new-row { from { background-color: #e6f1ff; } to { background-color: rgba(230, 241, 255, 0); } }
.e2-proto .e2p-thumb {
  width: 40px; height: 40px; border-radius: 8px;
  background: linear-gradient(135deg, var(--a, #ffe2cc), var(--b, #ffc09a));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.e2-proto .e2p-thumb--sm { width: 32px; height: 32px; border-radius: 6px; }

/* Badges (Polaris tones). */
.e2-proto .e2p-badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 8px;
  font-size: 12px; line-height: 16px; font-weight: 550; white-space: nowrap;
  background: #e3e3e3; color: #303030;
}
.e2-proto .e2p-badge--success { background: #cdfee1; color: #0c5132; }
.e2-proto .e2p-badge--info { background: #e0f0ff; color: #00527c; }

/* ---------- Forms ---------- */
.e2-proto .e2p-form { display: flex; flex-direction: column; gap: var(--e2p-gap); }
.e2-proto .e2p-field { display: flex; flex-direction: column; gap: 4px; }
.e2-proto .e2p-label { font-weight: 500; color: var(--e2p-ink); }
.e2-proto .e2p-input, .e2-proto .e2p-select {
  width: 100%; min-height: var(--e2p-field); margin: 0; padding: 6px 12px;
  border: 1px solid var(--e2p-field-line); border-radius: 8px;
  background-color: #fff; color: var(--e2p-ink);
  font: inherit; line-height: 20px;
  -webkit-appearance: none; appearance: none;
  transition: border-color .12s ease, background-color .12s ease;
}
.e2-proto .e2p-input::placeholder { color: var(--e2p-ink-3); opacity: 1; }
.e2-proto .e2p-select {
  padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23616161' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4-4 4 4M6 12l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 20px;
}
.e2-proto .e2p-field.is-error .e2p-input { border-color: var(--e2p-crit-line); background-color: var(--e2p-crit-bg); }
.e2-proto .e2p-field.is-error .e2p-input:focus-visible { outline-color: var(--e2p-crit-line); }
.e2-proto .e2p-error { display: flex; align-items: flex-start; gap: 4px; color: var(--e2p-crit); }
.e2-proto .e2p-error .e2p-ico { width: 16px; height: 16px; margin-top: 2px; color: var(--e2p-crit-line); }
.e2-proto .e2p-help { color: var(--e2p-ink-2); font-size: 12px; line-height: 16px; }

/* Checkbox and radio rows. The whole row is the label, so a click anywhere on it toggles. The real input is invisible but
   centred on the drawn box and 44px wide, as tall as the row: native semantics and keyboard, and a 44px target (UX law R5). */
.e2-proto .e2p-choice {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: var(--e2p-row); margin-inline: -8px; padding: 6px 8px;
  border-radius: 8px; cursor: pointer;
}
.e2-proto .e2p-choice > input { position: absolute; top: 0; left: -6px; width: 44px; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.e2-proto .e2p-box, .e2-proto .e2p-radio {
  display: grid; place-items: center; flex: none;
  width: 16px; height: 16px;
  border: 1px solid var(--e2p-field-line); background: #fff;
  pointer-events: none;   /* the transparent input above it takes the click */
  transition: background-color .12s ease, border-color .12s ease;
}
.e2-proto .e2p-box { border-radius: 4px; }
.e2-proto .e2p-box .e2p-ico { width: 14px; height: 14px; stroke: #fff; stroke-width: 2; opacity: 0; }
.e2-proto .e2p-radio { border-radius: 50%; }
.e2-proto .e2p-choice > input:checked + .e2p-box { background: #303030; border-color: #303030; }
.e2-proto .e2p-choice > input:checked + .e2p-box .e2p-ico { opacity: 1; }
.e2-proto .e2p-choice > input:checked + .e2p-radio { border-color: #303030; background: radial-gradient(circle, #fff 0 3px, #303030 3.5px); }
.e2-proto .e2p-choice > input:focus-visible + .e2p-box, .e2-proto .e2p-choice > input:focus-visible + .e2p-radio {
  outline: 2px solid var(--e2p-focus); outline-offset: 2px;
}
.e2-proto .e2p-choice__text { display: flex; flex-direction: column; min-width: 0; }
.e2-proto .e2p-choice__help { color: var(--e2p-ink-2); font-size: 12px; line-height: 16px; }
.e2-proto .e2p-plist { display: flex; flex-direction: column; }
.e2-proto .e2p-prow { min-height: max(var(--e2p-row), 52px); }
.e2-proto .e2p-prow__text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.e2-proto .e2p-prow__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.e2-proto .e2p-prow__vendor { color: var(--e2p-ink-2); font-size: 12px; line-height: 16px; }
.e2-proto .e2p-prow__price { flex: none; font-weight: 550; font-variant-numeric: tabular-nums; }
.e2-proto .e2p-fieldset { display: flex; flex-direction: column; min-width: 0; border: 0; }

/* ---------- Skeleton page (Polaris SkeletonPage shapes) ---------- */
.e2-proto .e2p-sk { display: block; flex: none; border-radius: 6px; background: #e3e3e3; animation: e2p-sk 1.1s ease-in-out infinite alternate; }
@keyframes e2p-sk { from { opacity: 1; } to { opacity: .5; } }
.e2-proto .e2p-sk--icon { width: var(--e2p-ctl); height: var(--e2p-ctl); border-radius: 8px; margin-left: -6px; }
.e2-proto .e2p-sk--title { width: 38%; max-width: 190px; height: 28px; border-radius: 8px; }
.e2-proto .e2p-sk--label { width: 22%; height: 12px; }
.e2-proto .e2p-sk--field { width: 100%; height: var(--e2p-field); border-radius: 8px; }
.e2-proto .e2p-sk--head { width: 28%; height: 14px; }
.e2-proto .e2p-sk--thumb { width: 32px; height: 32px; border-radius: 6px; }
.e2-proto .e2p-sk--line { width: 100%; height: 12px; }
.e2-proto .e2p-sk--short { width: 45%; }
.e2-proto .e2p-sk--half { width: 60%; }
.e2-proto .e2p-sk-row { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.e2-proto .e2p-sk-row--sm { min-height: 36px; }
.e2-proto .e2p-sk-lines { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-width: 0; }

/* ---------- Toast ---------- */
.e2-proto .e2p-toasts {
  position: absolute; left: 0; right: 0; bottom: 16px; z-index: 12;
  display: flex; justify-content: center; padding-inline: 12px;
  pointer-events: none;
}
.e2-proto .e2p-toast {
  max-width: 100%;
  padding: 10px 18px; border-radius: 999px;
  background: #1a1a1a; color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  font-size: 13px; line-height: 20px; font-weight: 550; text-align: center;
  animation: e2p-toast-in .22s var(--e2p-ease) both;
}
.e2-proto .e2p-toast.is-leaving { animation: e2p-toast-out .18s ease-in both; }
@keyframes e2p-toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes e2p-toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Hover (only where there is a real hover, so a tap does not leave a row or button stuck highlighted) ---------- */
@media (hover: hover) {
  .e2-proto .e2p-nav__item:not([aria-current="page"]):not([aria-disabled="true"]):hover { background: rgba(0, 0, 0, .05); }
  .e2-proto .e2p-btn--primary:hover { background: linear-gradient(180deg, rgba(26, 26, 26, 0) 63.53%, rgba(255, 255, 255, .15) 100%), #1a1a1a; }
  .e2-proto .e2p-btn--bar-2:hover { background: rgba(255, 255, 255, .22); }
  .e2-proto .e2p-btn--bar-1:hover { background: #e3e3e3; }
  .e2-proto .e2p-icon-btn:hover { background: rgba(0, 0, 0, .06); color: var(--e2p-ink); }
  .e2-proto .e2p-input:hover, .e2-proto .e2p-select:hover { border-color: var(--e2p-ink-2); }
  .e2-proto .e2p-choice:hover { background: #f7f7f7; }
}
.e2-proto .e2p-btn--primary:active { background: #1a1a1a; box-shadow: inset 0 2px 1px rgba(0, 0, 0, .6); }
.e2-proto .e2p-icon-btn:active { background: rgba(0, 0, 0, .1); }

/* ---------- Narrow containers and touch: 44px targets (UX law R5), tighter gutters ---------- */
@container e2proto (max-width: 559px) {
  .e2-proto .e2p { --e2p-ctl: 44px; --e2p-field: 44px; --e2p-row: 44px; --e2p-top-h: 52px; }
  /* Destructive-ish Discard stays 24px+ away from the one filled Save. */
  .e2-proto .e2p-savebar__actions { gap: 24px; }
}
@container e2proto (max-width: 419px) {
  .e2-proto .e2p { --e2p-pad: 12px; --e2p-gap: 12px; }
  .e2-proto .e2p-store__name { display: none; }
  .e2-proto .e2p-metric__value { font-size: 18px; line-height: 24px; }
}
@container e2proto (max-width: 359px) {
  .e2-proto .e2p-metric__value { font-size: 17px; }
  .e2-proto .e2p-metric__row { column-gap: 6px; }
}
/* Too narrow for value and trend side by side: stack them in both cards so the two stay the same height. */
@container e2proto (max-width: 299px) {
  .e2-proto .e2p-metric__row { display: block; }
}
/* No room left of the button for the tooltip without covering the title: keep just the pulsing dot. */
@container e2proto (max-width: 279px) {
  .e2-proto .e2p-hint__tip { display: none; }
}
@media (pointer: coarse) {
  .e2-proto .e2p { --e2p-ctl: 44px; --e2p-field: 44px; --e2p-row: 44px; --e2p-top-h: 52px; }
  .e2-proto .e2p-savebar__actions { gap: 24px; }
  /* 16px stops iOS zooming the page when a field takes focus. */
  .e2-proto .e2p-input, .e2-proto .e2p-select { font-size: 16px; }
}

/* ---------- Reduced motion: nothing slides, pulses or spins ---------- */
@media (prefers-reduced-motion: reduce) {
  .e2-proto *, .e2-proto *::before, .e2-proto *::after { animation: none !important; transition: none !important; }
  .e2-proto .e2p-hint__dot::after { display: none; }
  .e2-proto .e2p-btn[data-loading]::after { display: none; }
  .e2-proto .e2p-btn[data-loading] .e2p-btn__label { opacity: 1; }
}
