# UnifiedWriter Style Contract

Target: UnifiedWriter dev-5.67.0 / app development policy v1.10.

UnifiedWriter declares package CSS through `PACKAGE_MANIFEST.json` so Host shells can load all required styles before mounting the Control.

## Manifest contract

```json
{
  "styles": {
    "required": ["themes/base/unified_writer.css"],
    "themes": {
      "flat": ["themes/flat/unified_writer.css"]
    },
    "hostOptional": ["demo/demo.css"]
  },
  "styleScope": {
    "rootClass": ".uwriter",
    "overlayClass": ".uwriter-floating-ui"
  }
}
```

## Root class

The runtime root element has the classes `uwriter ih-shell`. Package CSS must be scoped by `.uwriter` or `.uwriter.ih-shell`.

## Required CSS

`themes/base/unified_writer.css` contains structural layout, editor pages, menu geometry, panes, toolbar, dialogs, context menu, image/table handles, print rules, and current product diagnostics UI.

## Theme CSS

`themes/flat/unified_writer.css` is the default theme override target. Host shells should load it after the base CSS when the selected theme is `flat`.

## Forbidden selectors

Package CSS must not directly style `body`, `html`, `.toolbar`, `.tab`, `.grid`, or other generic Host-level selectors. Transient drag/resize classes are applied to `.uwriter`, not to `body`.

## Host order

1. Load Host common CSS.
2. Load UnifiedControl CSS when needed.
3. Read `PACKAGE_MANIFEST.json`.
4. Load `styles.required`.
5. Load selected `styles.themes[theme]`.
6. Configure RequireJS aliases.
7. Require `UnifiedWriter/main`.
8. Create and mount the Control.
