Skip to content

refactor(ui): CSS architecture debt cleanup (post #430 converge) #476

Description

@Astro-Han

Background

The #430 converge series (motion / typography / spacing) is fully merged and token governance is complete. The post-converge CSS architecture cleanup is tracked here; the React-side cleanup is tracked separately in #477.

Verified against main at 2791ea4c on 2026-07-04, after #480, #485, #487, #508, and #512 merged.

Scope

This issue is CSS-only. Token governance is already done (radius / z-index / color / shadow / motion / typography / spacing all have converge contracts). This issue covers CSS engineering structure, cascade safety, strict parser hygiene, and stylesheet maintainability, not token values or visual redesign.

High-priority CSS cleanup from the original audit is now effectively complete. The only remaining item is a low-priority directionality hygiene pass, which should be done only if we decide it is worth the review cost.

Completed

P0 — CSS parse hygiene is done

Done in #480fix(ui-css): clean renderer css hygiene.

What changed:

  • Fixed the strict parser failure in styles/settings/nav-sidebar.css.
  • Added a renderer CSS parse contract over the renderer CSS tree.
  • Deleted dead html[data-theme...] CSS selectors.
  • Deleted the --font-sans / --font-mono self-referential declarations.
  • Added narrow regression assertions so data-theme selectors and font-token self references do not return.

Expected visual impact: none.

P0/P1 — Cascade strategy and input focus resets are done

Done in #485refactor(ui-css): settle cascade and important resets.

What changed:

  • Settled the renderer cascade strategy so local feature styles no longer depend on mixed layered / unlayered override paths.
  • Moved embedded bare-field focus/ring behavior into explicit chrome-less input / textarea paths instead of page-level !important resets.
  • Narrowed and locked the renderer !important audit.
  • Kept visual behavior stable with CSS contracts and targeted smoke coverage.

Expected visual impact: none intended.

P1 — module-pages.css ownership split is done

Done in #487refactor(ui-css): split module styles.

What changed:

  • Split the old catch-all module-pages.css into focused child stylesheets under styles/module-pages/.
  • Kept the parent stylesheet as an ordered manifest.
  • Added ownership contracts so module-page styles do not absorb global/shared/chat/settings selectors again.
  • Moved cross-owner styles back to their real owners during review.

Expected visual impact: none.

Remaining

P2 — Logical vs physical properties are optional / deferred

The original audit found mixed physical and logical CSS properties (padding-left vs padding-inline, margin-left vs margin-inline, border-left vs border-inline-start). This remains low impact for the current Electron desktop app because there is no active RTL support requirement.

Recommended handling:

  • Do not start a broad mechanical pass unless we decide directionality hygiene is worth a dedicated review.
  • If we do it, keep it to one CSS-only PR with a small allowlist for semantic physical directions, for example a left accent rail.
  • Do not bundle it with visual polish or Tailwind migration.

Close criteria

This issue can be closed once we either:

  • decide to defer the logical/physical property pass, or
  • land one small follow-up PR for that pass.

Out of scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions