/* Lead stage track (Lead details) and the Leads table quick change (lead-stage.mjs). Shared tokens only, so Light,
   Dark, System and Glass render the same component. The stage pill itself lives with the Calibre scale in calibre.css.
   Each stop paints with its status tone (--sc from calibre.css's STATUS COLOUR MAP: Quotation is violet, never the
   brand accent); outside Calibre the route accent stays the fallback. */
#lead-dialog ol.stage-track{display:flex;flex-wrap:wrap;align-items:flex-start;margin:6px 0 16px;padding:12px 8px 10px;list-style:none;border:0}
#lead-dialog .stage-track .stage-step{position:relative;flex:1 1 0;min-inline-size:0;display:flex;justify-content:center;gap:0;font-size:inherit;color:inherit;text-align:center}
#lead-dialog .stage-track .stage-step::before{content:"";position:absolute;inset-block-start:11px;inset-inline-end:50%;inline-size:100%;block-size:2px;border-radius:2px;background:var(--border-subtle,#e4e6ea);z-index:0}
#lead-dialog .stage-track .stage-step:first-child::before,#lead-dialog .stage-track .stage-step.lost::before{content:none}
#lead-dialog .stage-track .stage-step:is(.is-done,.is-current):not(.lost)::before{background:var(--sc,var(--route-accent,var(--accent)))}
#lead-dialog .stage-node{position:relative;z-index:1;display:grid;justify-items:center;gap:6px;min-inline-size:0;max-inline-size:100%;margin:0;padding:0 4px 2px;border:0;border-radius:10px;background:none;box-shadow:none;
 color:var(--text-muted);font:inherit;font-size:12.5px;line-height:1.3;text-align:center;min-block-size:0;block-size:auto}
#lead-dialog .stage-node>i{display:grid;place-items:center;inline-size:22px;block-size:22px;box-sizing:border-box;border-radius:50%;border:1.5px solid var(--border-strong,#c4c8d0);background:var(--surface,#fff);color:var(--sc,var(--route-accent,var(--accent)));
 transition:border-color var(--motion-micro,140ms) var(--ease-out,ease),box-shadow var(--motion-micro,140ms) var(--ease-out,ease),background-color var(--motion-micro,140ms) var(--ease-out,ease)}
#lead-dialog .stage-node svg{inline-size:14px;block-size:14px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
#lead-dialog .stage-label{max-inline-size:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#lead-dialog .is-done .stage-node>i{border-color:var(--sc,var(--route-accent,var(--accent)));background:var(--sc,var(--route-accent,var(--accent)));color:var(--surface,#fff)}
#lead-dialog .is-current .stage-node{color:var(--text);font-weight:600}
#lead-dialog .is-current .stage-node>i{border-color:var(--sc,var(--route-accent,var(--accent)));box-shadow:0 0 0 4px color-mix(in srgb,var(--sc,var(--route-accent,var(--accent))) 18%,transparent)}
#lead-dialog .stage-step.won:not(.is-done):not(.is-current) .stage-node>i{color:var(--text-muted);border-style:dashed}
#lead-dialog .stage-step.lost{flex:0 0 auto;margin-inline-start:6px;padding-inline-start:10px;border-inline-start:1px solid var(--border-subtle,#e4e6ea)}
#lead-dialog .stage-step.lost .stage-node>i{color:var(--text-muted)}
#lead-dialog .stage-step.lost.is-current .stage-node>i{border-color:var(--text-muted);background:var(--text-muted);color:var(--surface,#fff);box-shadow:none}
#lead-dialog .stage-track[data-state=lost] .stage-step:not(.lost) .stage-node{opacity:.6}
/* Interactive: real buttons with hover, focus, pressed and disabled states. */
#lead-dialog button.stage-node{cursor:pointer}
#lead-dialog button.stage-node:hover:not(:disabled)>i{border-color:var(--sc,var(--route-accent,var(--accent)))}
#lead-dialog button.stage-node:hover:not(:disabled) .stage-label{color:var(--text)}
#lead-dialog button.stage-node:focus-visible{outline:none;box-shadow:var(--focus-ring,0 0 0 3px rgb(53 105 223 / .35))}
#lead-dialog button.stage-node:active:not(:disabled)>i{scale:.94}
#lead-dialog button.stage-node:disabled{cursor:not-allowed;opacity:1}
#lead-dialog .stage-note{flex:1 0 100%;margin:8px 0 0;font-size:12px;line-height:1.4;color:var(--warning,#8f5c0c);text-align:center}
#lead-dialog .stage-note:empty{display:none}
#lead-dialog .stage-track[data-changed=true] .is-current .stage-node>i{border-color:var(--warning,#8f5c0c);box-shadow:0 0 0 4px color-mix(in srgb,var(--warning,#8f5c0c) 18%,transparent)}
@media (max-width:480px){
 #lead-dialog ol.stage-track{padding-inline:2px}
 #lead-dialog .stage-node{padding-inline:2px;font-size:11px}
 #lead-dialog .stage-step:not(.is-current) .stage-label{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 #lead-dialog .stage-step.is-current{flex:1.8 1 0}
}
/* Leads table: the Stage chip is a quiet button; the chevron appears on hover, focus, touch and while open. */
#page-container .stage-change{display:inline-flex;align-items:center;gap:2px;margin:-3px;padding:3px;border:0;border-radius:999px;background:none;box-shadow:none;color:inherit;font:inherit;line-height:1;cursor:pointer;min-block-size:0;block-size:auto}
#page-container .stage-change .stage-chevron{inline-size:14px;block-size:14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;color:var(--text-muted);opacity:0;transition:opacity var(--motion-micro,140ms) var(--ease-out,ease)}
#page-container tr:hover .stage-change .stage-chevron,#page-container .stage-change:is(:focus-visible,[aria-expanded=true]) .stage-chevron{opacity:1}
#page-container .stage-change:hover .stage{filter:brightness(.97)}
#page-container .stage-change:focus-visible{outline:none;box-shadow:var(--focus-ring,0 0 0 3px rgb(53 105 223 / .35))}
#page-container .stage-change[aria-busy=true]{cursor:progress;opacity:.6}
@media (hover:none){#page-container .stage-change .stage-chevron{opacity:.8}}
.stage-menu{position:fixed;z-index:120;box-sizing:border-box;min-inline-size:200px;max-inline-size:calc(100vw - 16px);padding:6px;border:1px solid var(--menu-border,var(--border));border-radius:var(--menu-radius,12px);
 background:var(--menu-bg,var(--surface-raised,#fff));color:var(--text);box-shadow:var(--menu-shadow,0 8px 24px rgb(16 20 28 / .16));font-family:var(--font-ui,inherit);font-size:13px}
:root[data-appearance=glass] .stage-menu{-webkit-backdrop-filter:var(--c-glass-filter,blur(20px));backdrop-filter:var(--c-glass-filter,blur(20px))}
.stage-menu-title{margin:4px 8px 6px;font-size:11.5px;font-weight:600;color:var(--text-muted)}
.stage-menu-list{display:grid;gap:2px}
.stage-menu-item{display:flex;align-items:center;justify-content:space-between;gap:12px;inline-size:100%;min-block-size:var(--menu-item-height,36px);padding:4px 8px;border:0;border-radius:8px;background:none;color:inherit;font:inherit;text-align:start;cursor:pointer}
.stage-menu-item:is(:hover,:focus-visible){outline:none;background:var(--menu-hover,rgb(20 40 80 / .06))}
.stage-menu-item:focus-visible{box-shadow:inset 0 0 0 2px var(--sc,var(--route-accent,var(--accent)))}
.stage-menu-check{inline-size:16px;block-size:16px;flex:none;fill:none;stroke:var(--sc,var(--route-accent,var(--accent)));stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.stage-menu-hint{margin:6px 8px 2px;max-inline-size:240px;font-size:11.5px;line-height:1.4;color:var(--text-muted)}
@media (forced-colors:active){#lead-dialog .stage-node>i,.stage-menu{border:1px solid CanvasText}}
/* QA 14-Nov A12: the Leads row action is a named Edit/View button (it was an icon-only "more"). */
#page-container .proto .tool.lead-row-edit{width:auto;padding-inline:10px;font-size:13px;font-weight:600;white-space:nowrap;border:1px solid var(--line,var(--border))}
/* The Lead drawer's Create Quotation is a full action in its footer, beside Save. */
#lead-dialog .lead-create-quotation:not([hidden]){display:inline-flex;align-items:center;margin-inline-end:auto}
