/* ─────────────────────────────────────────────────────────────────────────────
   Flow component — shared "control-logic made visible" primitives.

   Used by the data-entry apps (transcribe, mt, expense) that all run the same
   hidden flow: capture → AI reads it → you confirm → save. These classes turn
   that flow into an on-screen step rail + one-line instruction banner, and mark
   AI-filled fields so users review rather than blindly trust.

   Token-driven: everything resolves through --md-* (light + dark) from
   /css/shared.css. Per-app accent comes from --flow-accent (default: primary),
   set on any ancestor. Namespaced `flow-` to coexist with Tailwind and md-*.

   Consumed by /js/shared/flow-rail.js (createFlowRail → setStep).
───────────────────────────────────────────────────────────────────────────── */

/* per-app accent hook — apps set --flow-accent / --flow-accent-soft on a wrapper */
.flow-scope { --flow-accent: var(--md-primary); --flow-accent-soft: var(--md-primary-container); }

/* ── Instruction banner (one plain-language line: what happens next) ── */
.flow-howto {
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-shape-md);
  padding: 12px 14px;
}
.flow-howto-lead {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--md-on-surface);
}
.flow-howto-lead .material-symbols-outlined {
  font-size: 18px;
  color: var(--flow-accent, var(--md-primary));
  flex-shrink: 0;
  margin-top: 1px;
}
.flow-howto .flow-rail { margin-top: 12px; }

/* ── Step rail ── */
.flow-rail { display: flex; align-items: flex-start; gap: 0; }
.flow-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  position: relative;
  min-width: 0;
}
.flow-step-num {
  width: 26px;
  height: 26px;
  border-radius: var(--md-shape-full);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  background: var(--md-surface);
  border: 1.5px solid var(--md-outline);
  color: var(--md-on-surface-variant);
  z-index: 1;
  transition: background var(--md-duration-s) var(--md-easing-standard),
              border-color var(--md-duration-s) var(--md-easing-standard),
              color var(--md-duration-s) var(--md-easing-standard);
}
.flow-step-label {
  font-size: 11px;
  line-height: 1.3;
  color: var(--md-on-surface-variant);
  max-width: 10ch;
}
/* connector line between steps */
.flow-step::before {
  content: "";
  position: absolute;
  top: 13px;
  left: -50%;
  width: 100%;
  height: 1.5px;
  background: var(--md-outline-variant);
  z-index: 0;
}
.flow-step:first-child::before { display: none; }

/* active step */
.flow-step.is-active .flow-step-num {
  background: var(--flow-accent, var(--md-primary));
  border-color: var(--flow-accent, var(--md-primary));
  color: var(--md-on-primary);
}
.flow-step.is-active .flow-step-label { color: var(--md-on-surface); font-weight: 600; }
/* completed step */
.flow-step.is-done .flow-step-num {
  background: var(--flow-accent-soft, var(--md-primary-container));
  border-color: var(--flow-accent, var(--md-primary));
  color: var(--flow-accent, var(--md-primary));
}
.flow-step.is-active::before,
.flow-step.is-done::before { background: var(--flow-accent, var(--md-primary)); }

/* ── AI-filled field marker (review, don't blindly trust) ── */
.flow-ai-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--flow-accent, var(--md-primary));
  text-transform: uppercase;
  vertical-align: middle;
}
.flow-ai-tag::before { content: "✷ "; }
/* apply to an input/select/textarea (or its wrapper) that AI populated */
.flow-ai-filled {
  border-color: var(--flow-accent, var(--md-primary)) !important;
  background: color-mix(in srgb, var(--flow-accent, var(--md-primary)) 8%, var(--md-surface)) !important;
}
/* When the AI-filled element is a native <select> upgraded to a custom
   dropdown, the native select is display:none — surface the highlight on the
   visible trigger instead. initializeCustomSelects() nests the hidden <select>
   as a direct child of .custom-select-wrapper, so :has() reaches the trigger
   without any JS coupling to the widget internals. */
.custom-select-wrapper:has(> select.flow-ai-filled) .custom-select-trigger {
  border-color: var(--flow-accent, var(--md-primary)) !important;
  background: color-mix(in srgb, var(--flow-accent, var(--md-primary)) 8%, var(--md-surface)) !important;
}

/* ── AI info banner (soft, accent-tinted) ── */
.flow-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: var(--md-shape-sm);
  background: color-mix(in srgb, var(--flow-accent, var(--md-primary)) 12%, var(--md-surface));
  color: var(--flow-accent, var(--md-primary));
}
.flow-banner .material-symbols-outlined { font-size: 18px; }

@media (max-width: 380px) {
  .flow-step-label { font-size: 10px; }
}
