/* LifeOS button contract v1.3. Hover derives from the resting fill, never from the variant name alone. */
:root{--button-rest-bg:transparent;--button-light-hover:#EBE6D8;--button-dark-hover:var(--purple);--button-dark-text:var(--ink);--button-selected-bg:var(--ink);--button-selected-text:var(--cream);--button-selection-highlight:var(--ink);--button-disabled-opacity:.4;--button-press-bg:color-mix(in srgb,var(--purple) 84%,var(--ink));--button-duration:160ms}
body button,body button:focus,body button:focus-visible,body dialog h2:focus{outline:none;outline-offset:0;box-shadow:none}
body button{transition:background-color var(--button-duration) ease,color var(--button-duration) ease,border-color var(--button-duration) ease;filter:none;touch-action:manipulation}
body button[data-button]{--state-bg:var(--button-rest-bg);--state-fg:var(--ink);--hover-bg:var(--button-light-hover);--hover-fg:var(--ink);--pressed-bg:var(--button-light-hover);background:var(--state-bg);color:var(--state-fg)}
body button[data-button=filter]{border-color:var(--border)}
body form button[data-button=filter]{--state-bg:var(--cream);border-color:var(--muted)}
/* Only fully filled ink controls get purple interaction colors. */
body button[data-button=primary],
body button[data-button=navigation].active,
body button[data-button=calendar].range-endpoint,
body button[data-button=row][aria-pressed=true]{--state-bg:var(--button-selected-bg);--state-fg:var(--button-selected-text);--hover-bg:var(--button-dark-hover);--hover-fg:var(--button-dark-text);--pressed-bg:var(--button-press-bg)}
/* A dropdown trigger is an opener, not the selected value itself. It always stays light. */
body button[data-button=filter][aria-expanded=true]{--state-bg:var(--button-light-hover);border-color:var(--ink)}
body button[data-button=filter].is-applied{border-color:var(--ink)}
/* The current segment / menu choice has no new action on hover: keep its selected fill. */
body button[data-button=segment][aria-pressed=true],body button[data-button=option][aria-selected=true]{--state-bg:var(--ink);--state-fg:var(--cream);--hover-bg:var(--ink);--hover-fg:var(--cream);--pressed-bg:var(--ink);cursor:default}
body button[data-button=calendar].in-range{--state-bg:var(--button-light-hover)}
body button[data-button=calendar].outside-month{--state-fg:var(--muted)}
body button[data-button=calendar].range-endpoint{--state-fg:var(--cream)}
/* Text-only controls never acquire a background in any state. */
body button[data-button=tab],body button[data-button=text]{--state-bg:transparent;--state-fg:var(--muted);--hover-bg:transparent;--hover-fg:var(--ink);--pressed-bg:transparent}
body button[data-button=tab][aria-selected=true]{--state-fg:var(--ink);font-weight:500}
body button[data-button=tab][aria-selected=true]::after{content:'';position:absolute;inset:auto 0 -1px;height:2px;background:var(--ink)}
@media(hover:hover){
 body button[data-button]:where(:not(:disabled):not([aria-disabled=true]):not([aria-busy=true])):hover{--state-bg:var(--hover-bg);--state-fg:var(--hover-fg)}
 body button[data-button=filter]:hover{border-color:var(--ink)}
}
body button[data-button]:focus-visible{--state-bg:var(--hover-bg);--state-fg:var(--hover-fg)}
body button[data-button=filter]:focus-visible{border-color:var(--ink)}
body button[data-button=segment][aria-pressed=true]:focus-visible,body button[data-button=option][aria-selected=true]:focus-visible{text-decoration:underline;text-underline-offset:4px}
body button[data-button=tab]:focus-visible,body button[data-button=text]:focus-visible{text-decoration:underline;text-underline-offset:6px}
body button[data-button]:where(:not(:disabled):not([aria-disabled=true]):not([aria-busy=true])):active{--state-bg:var(--pressed-bg);--state-fg:var(--hover-fg)}
body button[data-button]:is(:disabled,[aria-disabled=true],[aria-busy=true]){opacity:var(--button-disabled-opacity);cursor:default;pointer-events:none}
body button[data-button=primary]:is(:disabled,[aria-disabled=true],[aria-busy=true]){--state-bg:var(--ink);--state-fg:var(--cream)}
body button[data-button=primary][aria-busy=true]::before{content:'';width:14px;height:14px;border:1px solid currentColor;border-right-color:transparent;border-radius:50%;animation:button-loading .8s linear infinite}
@keyframes button-loading{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){body button{transition:none}body button[data-button][aria-busy=true]::before{animation:none}}
body .period-switch button.icon-button{width:var(--control-height);height:var(--control-height)}
body .date-modes button,body button.text-button,body button[role=tab]{min-height:var(--control-height)}

/* Selected destinations/choices with no new action do not advertise another click. */
body button[data-button=navigation].active{--hover-bg:var(--ink);--hover-fg:var(--cream);--pressed-bg:var(--ink);cursor:default}
body button[data-button=tab][aria-selected=true]{cursor:default}
body button[data-button=navigation].active:focus-visible{text-decoration:underline;text-underline-offset:4px}

/* Geometry follows visible content, not arbitrary per-page padding. Optical inset:
   text 20px, icon 12px. Shape and spacing never change between states. */
body button:is([data-button=primary],[data-button=secondary],[data-button=filter],[data-button=ghost]){display:inline-flex;align-items:center;justify-content:center;gap:var(--button-contentGap);min-height:var(--button-height);padding-inline:var(--button-textInset)}
body button:is([data-button=primary],[data-button=secondary],[data-button=filter],[data-button=ghost]):is([data-content=leading],[data-content=both]){padding-left:var(--button-iconInset)}
body button:is([data-button=primary],[data-button=secondary],[data-button=filter],[data-button=ghost]):is([data-content=trailing],[data-content=both]){padding-right:var(--button-iconInset)}
body button[data-button=primary]{min-height:var(--button-primaryHeight)}
body button[data-button=icon]{width:var(--button-height);height:var(--button-height);padding:0;display:inline-grid;place-items:center;flex-shrink:0}
body button[data-button] i{flex-shrink:0}
body button[data-button=tab][aria-selected=true]::after{height:var(--line-selected-width)}
/* Every ghost action has its own pill shape, including standalone actions outside known classes. */
body button[data-button=ghost]{border-radius:var(--radius-pill)}
/* Sidebar rows share a left edge; generic ghost-action centering must not override it. */
body .sidebar button[data-button=ghost]{justify-content:flex-start}
