/* One-of-N switches: a rounded-rectangle track with a sliding thumb (the Grid | Cards shape the user picked),
   replacing the fully rounded pills. Applies to the shared segmented control and every standalone one-of-N group.
   The thumb keeps each theme's selection colour: yellow in Light (the yellow + blue two-tone), brand-soft with
   brand text in Dark and Grey Glass. */
:root{
 --sw-track:color-mix(in srgb,var(--subtle) 55%,var(--bg));--sw-border:var(--divider);
 --sw-thumb:var(--decorative);--sw-thumb-shadow:none;
 --sw-text:var(--muted);--sw-hover-text:var(--text);--sw-active-text:var(--on-decorative,var(--text));--sw-radius:var(--radius-control);--sw-thumb-radius:9px;
 --sw-slide:240ms;--sw-slide-ease:var(--motion-ease,cubic-bezier(.2,0,0,1));
}
html:is([data-theme=dark],[data-theme=grey-glass]){
 --sw-track:color-mix(in srgb,var(--text) 5%,var(--surface));--sw-thumb:var(--brand-soft);--sw-active-text:var(--brand);
}
html[data-theme=grey-glass]{--sw-thumb-shadow:inset 0 1px 0 var(--experience-edge)}

/* Tracks: the shared control and the standalone groups. */
html[data-theme] :is(.segmented:not(.settings-jump),.entry-person-chips,.private-filters,.loan-sheet-periods,.loan-sheet-metrics,.rate-whatif-mode,.loan-payment-modes){
 --seg-gap:2px;display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);align-items:stretch;gap:var(--seg-gap);
 box-sizing:border-box;width:100%;width:-webkit-fill-available;width:-moz-available;width:stretch;max-width:none;min-height:44px;padding:3px;border:1px solid var(--sw-border);border-radius:var(--sw-radius);background:var(--sw-track);box-shadow:none;
}
html[data-theme] :is(.segmented:not(.settings-jump),.entry-person-chips,.private-filters,.loan-sheet-periods,.loan-sheet-metrics,.rate-whatif-mode,.loan-payment-modes)>:is(button,[role=tab]){
 position:relative;min-width:0;min-height:36px;margin:0;padding:0 12px;justify-content:center;text-align:center;border:0;border-radius:var(--sw-thumb-radius);background:transparent;box-shadow:none;
 color:var(--sw-text);font-size:var(--text-xs);font-weight:500;
}
/* The 44px hit area reaches through the 3px track padding. */
html[data-theme] :is(.segmented:not(.settings-jump),.entry-person-chips,.private-filters,.loan-sheet-periods,.loan-sheet-metrics,.rate-whatif-mode,.loan-payment-modes)>:is(button,[role=tab])::after{content:"";position:absolute;inset:-4px -1px}
html[data-theme] :is(.segmented:not(.settings-jump),.entry-person-chips,.private-filters,.loan-sheet-periods,.loan-sheet-metrics,.rate-whatif-mode,.loan-payment-modes)>:is(button,[role=tab]):is([aria-pressed=true],[aria-selected=true],[aria-checked=true],[aria-current]){
 color:var(--sw-active-text);font-weight:600;
}
/* Thumb: one moving element at a time. The CSS thumb (::before) slides by transform; where a screen re-renders and
   runs the JS slider (filter-slide.js), that ghost IS the thumb while it moves (it copies the button's transparent
   background, so its colour is forced here) and the CSS thumb waits underneath until it lands. */
html[data-theme] .segmented:not(.settings-jump)::before{top:3px;bottom:3px;left:3px;width:calc((100% - 6px - (var(--n) - 1) * var(--seg-gap)) / var(--n));border-radius:var(--sw-thumb-radius);background:var(--sw-thumb);box-shadow:var(--sw-thumb-shadow);transition:transform var(--sw-slide) var(--sw-slide-ease)}
html[data-theme] :is(.segmented:not(.settings-jump),.private-filters,.loan-sheet-periods)>.filter-slide{z-index:0;border:0!important;border-radius:var(--sw-thumb-radius)!important;background:var(--sw-thumb)!important;box-shadow:var(--sw-thumb-shadow)!important}
html[data-theme] .segmented:not(.settings-jump):has(>.filter-slide)::before{opacity:0;transition:none}
html[data-theme] .segmented:not(.settings-jump)>.stats-seg-ind{top:3px;bottom:3px;border-radius:var(--sw-thumb-radius);background:var(--sw-thumb);box-shadow:var(--sw-thumb-shadow)}
/* :not(.settings-jump) only lifts this rule over the shared transparent-button rule above, so the raised thumb shows. */
html[data-theme] :is(.entry-person-chips,.loan-sheet-metrics,.rate-whatif-mode,.loan-payment-modes):not(.settings-jump)>button:is([aria-pressed=true],[aria-selected=true],[aria-checked=true]),
html[data-theme] :is(.private-filters,.loan-sheet-periods):not(:has(>.filter-slide))>button:is([aria-pressed=true],[aria-selected=true],[aria-checked=true]){background:var(--sw-thumb);box-shadow:var(--sw-thumb-shadow)}
/* Compare Grid | Cards sits beside its heading on every screen, so it keeps its own width (full width squeezed the
   "Category by month" title to a letter per line on phones). */
html[data-theme] .cc-switch.segmented{display:inline-grid;flex:none;width:auto}
/* A heading that shares a row with a switch never shrinks below about seven characters. */
html[data-theme] :has(>.segmented:not(.settings-jump))>:is(h1,h2,h3,h4){min-width:min(7em,50%)}
/* Phone Home: 8px between the month header row and Daily | Calendar (the sticky bar's padding, home-review.css). */
html[data-theme] .mobile-home-header+.view-tabs-bar>.view-tabs{margin-top:0}
/* Every switch spans its container with equal segments (the thumb is 1/N of the track). On a wide screen the ones
   that sit beside a heading or other controls keep their own width: Home Daily | Calendar, the Stats report view,
   Compare Grid | Cards and the Loans filters. */
@media (min-width:1024px){
 html[data-theme] :is(.view-tabs,.stats-view-switch,.private-filters).segmented,
 html[data-theme] .private-filters{display:inline-grid;width:auto}
}

/* Paid by: the caption sits outside the switch (above it on a phone, beside it on a wider sheet), and the account chip
   and the switch share the row in equal halves. */
html[data-theme] .entry-quickline:has(>.entry-paid-by){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:end;gap:8px}
html[data-theme] .entry-quickline:has(>.entry-paid-by)>.entry-account-chip{width:100%;max-width:none;min-height:44px}
html[data-theme] .entry-paid-by{display:grid;gap:4px;min-width:0}
html[data-theme] .entry-paid-label{color:var(--muted);font-size:var(--text-2xs);font-weight:500;line-height:1.2}
html[data-theme] .entry-paid-by>.entry-person-chips{margin:0}
@media (min-width:480px){
 html[data-theme] .entry-quickline:has(>.entry-paid-by){align-items:center}
 html[data-theme] .entry-paid-by{grid-template-columns:auto minmax(0,1fr);align-items:center;gap:8px}
}
html[data-theme] :is(.segmented:not(.settings-jump),.private-filters,.loan-sheet-periods,.loan-sheet-metrics)>:is(button,[role=tab]) :is(svg,.icon){width:16px;height:16px}
@media (hover:hover) and (pointer:fine){html[data-theme] :is(.segmented:not(.settings-jump),.entry-person-chips,.private-filters,.loan-sheet-periods,.loan-sheet-metrics,.rate-whatif-mode,.loan-payment-modes)>:is(button,[role=tab]):not([aria-pressed=true]):not([aria-selected=true]):not([aria-checked=true]):hover{color:var(--sw-hover-text)}}
@media (prefers-reduced-motion:reduce){html[data-theme] .segmented:not(.settings-jump)::before{transition:none}}
/* The rate what-if keeps its own layout (two text lines sit beside its options); its options are rounded rectangles, not pills. */
html[data-theme] .rate-whatif-rates>button{border-radius:var(--sw-thumb-radius)}
