# Specification: Phase 7 Monolithic Stabilization

## 1. Current State Audit
*   **Window Management:** `render_text_viewer_window` (gui_2.py:3843) uses ID `###Text_Viewer_Unified`. Call site at line 1226 is direct. Registry key is `"Text Viewer"`.
*   **Rendering Logic:** Discussion entries are currently delegated to `src/discussion_entry_renderer.py`, which is causing `ImportError` and `access violation` crashes in unit tests due to mock patching limits.
*   **Markdown Tables:** Content is vertically squashed because the `begin_group` width is determined by small header buttons, not the full panel.
*   **MiniMax Support:** `run_discussion_compression` exists but may have routing nuances or base URL mismatches with the M3 model.

## 2. Functional Requirements
*   **Monolithic Restoration:** Move `render_discussion_entry`, `render_discussion_entry_read_mode`, and `render_thinking_trace` back into `src/gui_2.py`. Remove `src/discussion_entry_renderer.py`.
*   **Definitive Docking Fix:** Standardize the Text Viewer ID to `###Text_Viewer_Unified` across all GUI and state logic. Ensure it is never called via `_render_window_if_open`.
*   **Full-Width Markdown:** Implement a dummy horizontal expansion in the monolithic `render_discussion_entry` to ensure tables and text blocks utilize the full panel width.
*   **Theme Integration:** Move all `vec4` color literals from rendering functions into `src/theme_2.py`. Expose them via `theme.get_role_tint()` and `theme.get_color(name)`.
*   **Stable ID Stack:** Ensure `src/imgui_scopes.py` uses explicit string conversion for all IDs to prevent memory corruption in `nanobind`.

## 3. Non-Functional Requirements
*   **Incremental TDD:** Every task MUST have a corresponding failing test in `tests/` before implementation.
*   **MMA Delegation:** All code changes must be performed by Tier 3 Workers via `mma_exec.py`.

## 4. Acceptance Criteria
*   Application launches and renders without any `ImportError`.
*   Text Viewer docks reliably without flickering or duplication.
*   Markdown tables are full-width and readable.
*   All existing GUI unit tests pass.