/* AVstackr executive summary modal — the summary window's own rules on Project Details.
   ========================================================================
   The author-facing shell (frame, header, body, notices, panel, field register, footer, buttons,
   links, badges, chips and numbers) serves the executive summary, estimate and proposal windows in
   author-modal.css, as `am-` classes; that file carries the register, the colour token table and
   the --am-radius-* steps declared on .am-modal, which the rules here use. This file holds only what the summary window uses, every
   class `esm-` prefixed: the modal element wears `am-modal esm-modal is-setup` or `is-draft`, the
   rooms pane `am-panel esm-rooms`. A plain stylesheet rather than a scoped .razor.css, because the
   rooms pane is the SummaryRoomPicker component and Summernote draws the editor outside any
   component's scope. Colours are --app-* tokens only; no literal colours and no important flags.

   Promotion rule: a class used by a second author-facing window moves to author-modal.css as `am-`.

   Layout: the owner's "room focus" mockup of 2026-11-16. The draft look is two columns edge to edge
   under the header: the room list on the left (its own sunken column, scrolling on its own, run
   buttons in its foot) and one editor pane on the right showing the open item — a room, the
   Introduction, or the whole summary read-only.

   Type here: room names 14px/500; status pills 12px/500; item counts 12px in the monospace stack;
   pane title 18px/600; draft body 15px/1.65 with h3/h4 16px/600 and h2 18px/600.
   ======================================================================== */

/* Set up: one column, rooms only. Draft: rooms beside the editor. */
.esm-modal.is-setup { width: 840px; }
.esm-modal.is-draft { width: 1160px; }

/* The draft look's columns run edge to edge under the header, so its body carries no padding of its own; a notice
   above the columns keeps the shell's inset. */
.esm-modal.is-draft .am-body {
    padding: 0;
    gap: 0;
}
.esm-modal.is-draft .am-body > .am-notice { margin: 16px var(--am-pad) 0; }

/* Draft look: rooms beside the editor pane, one fixed-height row. The rooms column, the picker's root and the list
   form one flex chain with min-height 0 at every link, or the list never scrolls; the pane and its editor frame do
   the same. */
.esm-columns {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-rows: 640px;
}

/* ── rooms ──────────────────────────────────────────────────────────────── */

.esm-rooms {
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 16px;
}

/* In the draft look the rooms pane is a column of the window rather than a panel inside it. */
.esm-modal.is-draft .esm-rooms {
    padding: 20px 20px 16px;
    border: 0;
    border-right: 1px solid var(--app-border-hairline);
    border-radius: 0;
}

.esm-rooms-picker {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    gap: 12px;
}

/* "Rooms" with All / None at the right, the count line beneath. */
.esm-rooms-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.esm-rooms-heading {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.esm-rooms-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--app-text-strong);
}

.esm-rooms-count {
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-label);
}

.esm-rooms-links {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.esm-rooms-addalt {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-label);
    cursor: pointer;
}

.esm-rooms-list {
    min-height: 0;
    overflow-y: auto;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Whole summary and Introduction, above the rooms and ruled off from them. */
.esm-doc-rows {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--app-border-hairline);
}

.esm-doc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    font: inherit;
    text-align: left;
    color: var(--app-text-data);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--am-radius-btn);
    cursor: pointer;
}

.esm-doc-icon {
    flex: 0 0 auto;
    width: 16px;
    font-size: 14px;
    text-align: center;
    color: var(--app-text-label);
}

.esm-doc-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.esm-doc-name {
    flex: 1 1 auto;
    font-size: 14px;
    font-weight: 500;
    color: var(--app-text-strong);
}

.esm-doc-aside {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-label);
}

/* One room: the tick box, then the open-row button (or, with no draft, the tick box's label) holding two lines. The
   two are siblings, so a click on one never reaches the other. */
.esm-room {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--am-radius-btn);
}

.esm-room-tick {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
    accent-color: var(--app-accent-fill);
    cursor: pointer;
}

.esm-room-open {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    font: inherit;
    text-align: left;
    color: var(--app-text-data);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.esm-doc-row:hover,
.esm-room:hover { background: var(--app-surface-hover); }

/* The open item: the accent's tint and border, as in the mockup. */
.esm-doc-row.is-focused,
.esm-room.is-focused {
    background: color-mix(in srgb, var(--app-accent-fill) 10%, transparent);
    border-color: color-mix(in srgb, var(--app-accent-fill) 35%, transparent);
}

/* Names wrap, however long: nothing in the list is cut off. */
.esm-room-name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
    color: var(--app-text-strong);
}
.esm-room-name .am-chip {
    margin-left: 8px;
    vertical-align: 1px;
}

/* The second line: the status pill, then the item count. */
.esm-room-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.esm-pill {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    border-radius: calc(var(--am-radius-tool) - 4px);
}
.esm-pill.is-drafted {
    color: var(--app-status-ok);
    background: color-mix(in srgb, var(--app-status-ok) 12%, transparent);
}
.esm-pill.is-absent {
    color: var(--app-text-label);
    background: color-mix(in srgb, var(--app-text-label) 12%, transparent);
}
.esm-pill.is-writing {
    color: var(--app-accent-border);
    background: color-mix(in srgb, var(--app-accent-border) 12%, transparent);
}

.esm-room-count {
    font-size: 12px;
    white-space: nowrap;
    color: var(--app-text-label);
}

.esm-room.is-off .esm-room-name { color: var(--app-text-label); }

/* Draft look: the inline warning, Update selected rooms (outlined, full width), Rewrite whole summary (a quiet text
   button) and the cost line under the list. */
.esm-rooms-foot {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 16px;
    border-top: 1px solid var(--app-border-hairline);
}

.esm-run-update,
.esm-run-rewrite { width: 100%; }

.esm-run-rewrite { height: 36px; }

/* The warning before a run that would replace unsaved edits: the message, then Continue and Cancel. */
.esm-confirm {
    flex: 0 0 auto;
    flex-wrap: wrap;
}

.esm-confirm-actions {
    display: inline-flex;
    gap: 16px;
}

.esm-cost {
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-label);
}

/* ── editor pane ────────────────────────────────────────────────────────── */

.esm-editor {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    gap: 16px;
    padding: 20px 24px 24px;
}

/* The open item's title, sub-line and the room's note on the left; Regenerate room and the arrows on the right. */
.esm-pane-head {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.esm-pane-titles {
    flex: 1 1 auto;
    min-width: 0;
}

.esm-pane-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
    color: var(--app-text-strong);
}

.esm-pane-sub {
    margin-top: 2px;
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-label);
}

/* The room's engineer note, moved here from the room rows. */
.esm-pane-note {
    margin-top: 4px;
    font-size: 13px;
    overflow-wrap: anywhere;
    color: var(--app-text-label);
}

.esm-pane-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.esm-arrow {
    width: 36px;
    padding: 0;
}

/* The frame holds the one Summernote editor (drawn as the host's next sibling) or the whole summary preview, and fills
   the rest of the pane; only its text area scrolls. Copy and Word sit over the right end of the toolbar row. */
.esm-frame {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.esm-frame > .note-editor {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.esm-frame .note-editing-area {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.esm-frame .note-editable {
    flex: 1 1 auto;
    overflow-y: auto;
}

/* Room at the toolbar's right end for Copy and Word. */
.esm-frame .note-toolbar { padding-right: 132px; }

.esm-tools {
    position: absolute;
    top: 6px;
    right: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* A toolbar button: 36px tall on the toolbar step, borderless like the toolbar's own. */
.esm-tool {
    height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: var(--app-text-data);
    background: transparent;
    border: 0;
    border-radius: var(--am-radius-tool);
    cursor: pointer;
}
.esm-tool:hover:not(:disabled) {
    color: var(--app-text-strong);
    background: var(--app-surface-hover);
}
.esm-tool:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* The whole summary: a strip in the toolbar's place carrying Copy and Word, over the read-only document. */
.esm-preview-frame {
    background: var(--app-surface-panel);
    border: 1px solid var(--app-border-hairline);
    border-radius: var(--am-radius-panel);
    overflow: hidden;
}

.esm-preview-bar {
    flex: 0 0 auto;
    height: 48px;
    background: var(--app-surface-sunken);
    border-bottom: 1px solid var(--app-border-hairline);
}

.esm-preview {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 20px;
    font-size: 15px;
    line-height: 1.65;
    color: var(--app-text-data);
}
.esm-preview h2 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}
.esm-preview h3,
.esm-preview h4 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

/* While the first draft is written, or after a failed run with no draft: the pane holds one centred line instead of
   the editor. */
.esm-editor-busy {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--app-text-label);
    background: var(--app-surface-sunken);
    border: 1px dashed var(--app-border-hairline);
    border-radius: var(--am-radius-panel);
}

/* Summernote keeps the theme's colours (the presets set them as important); only the radii, the
   button box and the draft's type change here. The status bar's
   vendor radius rule is .note-editor.note-frame .note-statusbar, so this one is matched as deep. */
.esm-editor .note-editor.note-frame { border-radius: var(--am-radius-panel); }

.esm-editor .note-toolbar {
    border-top-left-radius: calc(var(--am-radius-panel) - 1px);
    border-top-right-radius: calc(var(--am-radius-panel) - 1px);
}

.esm-editor .note-editor.note-frame .note-statusbar {
    border-bottom-left-radius: calc(var(--am-radius-panel) - 1px);
    border-bottom-right-radius: calc(var(--am-radius-panel) - 1px);
}

/* 36px tall and at least 36px wide; the font size menu's toggle shows the current size and a caret,
   so it runs wider. The vendor's joined-group rules (.note-btn-group > .note-btn:not(:first-child)
   and so on) outrank this one, so the inner edges of a group stay square. */
.esm-editor .note-btn {
    height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--am-radius-tool);
}

.esm-editor .note-editable {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.65;
}
.esm-editor .note-editable h2 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}
.esm-editor .note-editable h3,
.esm-editor .note-editable h4 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

/* ── focus ──────────────────────────────────────────────────────────────── */

.esm-tool:focus-visible,
.esm-doc-row:focus-visible,
.esm-room-open:focus-visible,
.esm-rooms-addalt input:focus-visible,
.esm-room-tick:focus-visible {
    outline: 2px solid var(--app-accent-border);
    outline-offset: 2px;
}
