/* Rashad step guide ("stepper"), theme kit component, 2026-10-24. The look of Taqyeem's journeys
   (C:\RashadERP\taqyeem\evaluation\templates\evaluation\_flow.html): a row of step buttons, a check when a step is done,
   the current step filled with the accent, a dashed circle for a step that is not ready yet (the reason on hover and
   focus), a "Step N of M - <name> · <context>" line with the next suggested action, and a show/hide button.
   Works with kit v1 and v2 (tokens --accent, --accent-soft, --line, --surface, --ink, --muted, --soft, --amber) and has
   fallbacks for older service variables. No framework dependency. RTL: logical properties only.
   Sticky since 2026-10-24 (v2): the bar stays under the service's top bar while the page scrolls, in a compact look.
   Markup: templates/django/_stepper.html (the same file works as a Jinja2 template). Docs: docs\theme-2026-10-23\STEPPER.md
   COPY this file into the service's own static folder, like the rest of the kit. */
.rsteps { --rs-accent: var(--accent, var(--primary, #15803d)); --rs-soft: var(--accent-soft, var(--primary-soft, #e7f5ec));
  --rs-line: var(--line, var(--border, #d9e0dc)); --rs-surface: var(--surface, #fff); --rs-ink: var(--ink, var(--text, #14201b));
  --rs-muted: var(--muted, #56665e); --rs-on: var(--on-accent, #fff); --rs-amber: var(--amber, #b45309);
  --rs-amber-soft: var(--amber-soft, #fef3c7);
  margin: 0 0 16px; padding: 12px 14px 10px; border-radius: var(--radius, 14px); background: var(--rs-surface);
  border: 1px solid var(--rs-line); box-shadow: var(--shadow-sm, 0 2px 8px -4px rgba(10, 30, 20, .25));
  /* sticky (2026-10-24): the bar stays in view under the service's own top bar. rashad-stepper.js measures that bar and sets
     --rs-top (its bottom edge) and --rs-z (just under its z-index, so the top bar's drop-downs still open over the steps). */
  position: sticky; top: var(--rs-top, 0px); z-index: var(--rs-z, 9); transition: box-shadow .15s; }

/* while stuck (rashad-stepper.js adds .is-stuck): a compact bar with a solid background and a stronger shadow. The script
   keeps the space the full bar takes in the page (margin-bottom), so the content under it does not jump. Screen only. */
@media screen {
  .rsteps.is-stuck { padding: 6px 12px 5px; background: var(--rs-solid, var(--rs-surface));
    border-start-start-radius: 0; border-start-end-radius: 0; border-top-color: transparent;
    box-shadow: 0 10px 22px -12px rgba(10, 30, 20, .45), 0 1px 0 var(--rs-line); }
  .rsteps.is-stuck .rsteps-where { flex-wrap: nowrap; gap: 4px 10px; font-size: 13px; line-height: 1.35; min-width: 0; }
  .rsteps.is-stuck .rsteps-where > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rsteps.is-stuck .rsteps-pos { flex: 0 0 auto; max-width: 55%; }
  .rsteps.is-stuck .rsteps-next { flex: 0 10 auto; }
  .rsteps.is-stuck .rsteps-ctx { flex: 0 100 auto; }
  .rsteps.is-stuck .rsteps-toggle { flex: none; padding: 2px 9px; }
  .rsteps.is-stuck .rsteps-list { margin-top: 5px; }
  .rsteps.is-stuck .rsteps-step::before { top: 11px; inset-inline-start: calc(-50% + 15px); inset-inline-end: calc(50% + 15px); }
  .rsteps.is-stuck .rsteps-link { gap: 2px; padding-bottom: 2px; }
  .rsteps.is-stuck .rsteps-n { width: 25px; height: 25px; font-size: 12px; }
  .rsteps.is-stuck .rsteps-step.is-current .rsteps-n { box-shadow: 0 0 0 3px var(--rs-soft); }
  .rsteps.is-stuck .rsteps-title { font-size: 11.5px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    overflow: hidden; }
  .rsteps.is-stuck .rsteps-hint, .rsteps.is-stuck .rsteps-note, .rsteps.is-stuck .rsteps-tag { display: none; }
}

/* the "where are we" line: always shown, also when the steps are hidden */
.rsteps-where { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13.5px; line-height: 1.45; }
.rsteps-pos { font-weight: 700; color: var(--rs-ink); }
.rsteps-pos .rsteps-of { color: var(--rs-muted); font-weight: 600; }
.rsteps-ctx { color: var(--rs-muted); overflow-wrap: anywhere; }
.rsteps-next { color: var(--rs-ink); }
.rsteps-next a { font-weight: 600; }
.rsteps-next.is-all-done { color: var(--green, #047857); font-weight: 600; }
.rsteps-toggle { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px solid var(--rs-line); border-radius: 999px; background: transparent; color: var(--rs-muted);
  font: 600 12.5px/1.3 inherit; font-family: inherit; cursor: pointer; white-space: nowrap; }
.rsteps-toggle:hover { color: var(--rs-accent); border-color: var(--rs-accent); }
.rsteps-toggle:focus-visible, .rsteps-link:focus-visible { outline: 0; box-shadow: var(--focus, 0 0 0 3px color-mix(in srgb, var(--rs-accent) 35%, transparent)); }
.rsteps-count { font-variant-numeric: tabular-nums; }

/* the step buttons */
.rsteps-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 0;
  grid-template-columns: repeat(var(--rs-n, 5), minmax(0, 1fr)); }
.rsteps.is-hidden .rsteps-list { display: none; }
.rsteps-step { position: relative; min-width: 0; }
.rsteps-step::before { content: ""; position: absolute; top: 16px; height: 3px; border-radius: 3px; background: var(--rs-line);
  inset-inline-start: calc(-50% + 20px); inset-inline-end: calc(50% + 20px); }
.rsteps-step:first-child::before { display: none; }
.rsteps-step.is-done::before, .rsteps-step.is-current::before { background: var(--rs-accent); }
.rsteps-link { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px; padding: 0 4px 4px;
  color: var(--rs-ink); text-decoration: none; border-radius: 12px; }
a.rsteps-link:hover { text-decoration: none; color: var(--rs-ink); }
a.rsteps-link:hover .rsteps-n { box-shadow: 0 0 0 4px var(--rs-soft); }
.rsteps-n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--rs-surface); color: var(--rs-muted); border: 2px solid var(--rs-line); position: relative; z-index: 1;
  transition: box-shadow .15s; font-variant-numeric: tabular-nums; }
.rsteps-step.is-done .rsteps-n { background: var(--rs-soft); color: var(--rs-accent); border-color: var(--rs-accent); }
.rsteps-step.is-current .rsteps-n { background: var(--rs-accent); color: var(--rs-on); border-color: var(--rs-accent); box-shadow: 0 0 0 4px var(--rs-soft); }
.rsteps-step.is-next .rsteps-n { border-color: var(--rs-accent); color: var(--rs-accent); }
.rsteps-step.is-locked .rsteps-n { border-style: dashed; }
.rsteps-step.is-locked .rsteps-link { cursor: help; }
.rsteps-step.is-locked .rsteps-title { color: var(--rs-muted); }
.rsteps-title { font-size: 12.5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.rsteps-step.is-current .rsteps-title { color: var(--rs-accent); }
.rsteps-note { font-size: 11px; color: var(--rs-muted); line-height: 1.25; overflow-wrap: anywhere; }
.rsteps-tag { font-size: 10.5px; font-weight: 600; padding: 0 7px; border-radius: 999px; line-height: 1.7;
  background: var(--soft, rgba(127, 127, 127, .12)); color: var(--rs-muted); }
.rsteps-step.is-done .rsteps-tag { background: var(--rs-soft); color: var(--rs-accent); }
.rsteps-step.is-next .rsteps-tag { background: var(--rs-accent); color: var(--rs-on); }
.rsteps-step.is-locked .rsteps-tag { background: var(--rs-amber-soft); color: var(--rs-amber); }

/* the current step's hint under the buttons */
.rsteps-hint { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--soft, rgba(127, 127, 127, .08));
  border-inline-start: 4px solid var(--rs-accent); font-size: 13px; color: var(--rs-ink); }
.rsteps-hint.is-locked { border-inline-start-color: var(--rs-amber); }
.rsteps.is-hidden .rsteps-hint { display: none; }
.rsteps .rs-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* many steps or a narrow screen: the row scrolls sideways (the current step is scrolled into view by rashad-stepper.js) */
@media (max-width: 1100px) {
  .rsteps-list { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 104px; overflow-x: auto;
    padding-bottom: 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .rsteps-step { scroll-snap-align: center; }
}
@media (max-width: 720px) {
  .rsteps { padding: 10px 12px 8px; }
  .rsteps-list { grid-auto-columns: 92px; }
  .rsteps-note { display: none; }
  .rsteps-where { font-size: 13px; }
  .rsteps-toggle .rsteps-tlabel { display: none; }   /* only the counter "4/11" and the arrow */
  /* stuck on a phone: one line plus a short row of buttons, never more than a quarter of the screen */
  .rsteps.is-stuck { padding: 5px 10px 3px; max-height: 25vh; overflow-y: auto; }
  .rsteps.is-stuck .rsteps-list { grid-auto-columns: 78px; padding-bottom: 3px; }
  .rsteps.is-stuck .rsteps-title { -webkit-line-clamp: 1; }
  .rsteps.is-stuck .rsteps-ctx { display: none; }
}
@media print { .rsteps-toggle, .rsteps-list, .rsteps-hint { display: none !important; }
  .rsteps { box-shadow: none; position: static; margin-bottom: 16px !important; } }
@media (prefers-reduced-motion: reduce) { .rsteps-n { transition: none; } }

/* step pager (2026-10-24): Back / Next buttons at the bottom of a step's page (partial _step_pager.html). On a phone it
   sticks to the bottom of the screen while the page content scrolls. */
.rspager { --rs-accent: var(--accent, var(--primary, #15803d)); --rs-line: var(--line, var(--border, #d9e0dc));
  --rs-surface: var(--surface, #fff); --rs-ink: var(--ink, var(--text, #14201b)); --rs-muted: var(--muted, #56665e);
  --rs-on: var(--on-accent, #fff); --rs-amber: var(--amber, #b45309); --rs-amber-soft: var(--amber-soft, #fef3c7);
  display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; margin: 20px 0 8px; padding: 12px 0 0;
  border-top: 1px solid var(--rs-line); }
.rspager-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 7px 16px; max-width: 46%;
  border-radius: var(--radius-sm, 10px); border: 1px solid var(--rs-line); background: var(--rs-surface); color: var(--rs-ink);
  text-decoration: none; line-height: 1.25; }
a.rspager-btn:hover { text-decoration: none; border-color: var(--rs-accent); color: var(--rs-accent); }
.rspager-next { margin-inline-start: auto; background: var(--rs-accent); border-color: var(--rs-accent); color: var(--rs-on); text-align: end; }
a.rspager-next:hover { color: var(--rs-on); filter: brightness(1.07); }
.rspager-next.is-locked { background: var(--rs-amber-soft); border: 1px dashed var(--rs-amber); color: var(--rs-amber); cursor: help; }
.rspager-btn:focus-visible { outline: 0; box-shadow: var(--focus, 0 0 0 3px color-mix(in srgb, var(--rs-accent) 35%, transparent)); }
.rspager-txt { display: flex; flex-direction: column; min-width: 0; }
.rspager-txt small { font-size: 11.5px; font-weight: 600; opacity: .85; }
.rspager-txt b { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rspager-arrow { font-size: 18px; line-height: 1; flex: none; }
[dir="rtl"] .rspager-arrow { transform: scaleX(-1); }            /* Back points to the start side, Next to the end side */
.rspager-pos { color: var(--rs-muted); font-size: 12.5px; white-space: nowrap; }
.rspager-gap { flex: 1 1 0; }
.rspager .rs-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 720px) {
  .rspager { position: sticky; bottom: 0; z-index: 8; margin: 16px 0 0; padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--rs-surface); box-shadow: 0 -8px 18px -12px rgba(10, 30, 20, .4); }
  .rspager-pos { display: none; }
  .rspager-btn { max-width: 49%; padding: 6px 12px; }
  .rspager-txt b { font-size: 13px; }
}
@media print { .rspager { display: none !important; } }
