/* Opmate: a reply as the operator saw it, styled one way for the chat page, the plant log and the admin viewer
   (PR 4 of docs/CODE_REVIEW.md, P4). Loaded after the design system block and before each page's own rules, so a page's
   own rule wins where the two meet (the chat page's narrow-screen card rows, the viewer's paragraph spacing); the few
   rules here that each page's paragraph rule would otherwise beat are written against the box they sit in. */

/* RP_20: the register's own words, in a neutral box: it marks where the text comes from, not how bad it is */
.register { background: var(--bg-subtle); border: 1px solid var(--border-input); border-radius: var(--r-lg); padding: 12px 14px; font-size: 14px; color: var(--text); }
div.register p { margin: 0; }
.register p + p { margin-top: 6px; }
.register-head { display: flex; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; margin-bottom: 6px; font-size: 12px; }
.register-heading { font-weight: 600; color: var(--text-secondary); }
.register-src { color: var(--text-muted); }
/* a Watercalcs page worth opening: a link, not a calculation */
.msg-links { display: flex; gap: 8px; flex-wrap: wrap; }
.msg-links a { text-decoration: none; }
/* RP_19: calculation cards */
.calc-card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); min-width: 0; }
.calc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 12px; flex-wrap: wrap; padding: 12px 16px 0; }
.calc-title { font-size: 15px; font-weight: 600; margin: 0; color: var(--text); }
.calc-meta { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }
.calc-core { font-size: 12px; color: var(--text-muted); white-space: nowrap; padding-top: 2px; }
.calc-hero { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; padding: 8px 16px 12px; border-bottom: 1px solid var(--border); }
.calc-val { font-family: var(--font-mono); font-size: 28px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
.calc-val small { font-family: inherit; font-size: 14px; font-weight: 400; color: var(--text-muted); margin-left: 6px; }
.calc-lim { font-size: 13px; color: var(--text-secondary); }
.calc-second { flex-basis: 100%; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.calc-second-val { font-family: var(--font-mono); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.calc-second-val small { font-family: inherit; font-size: 13px; font-weight: 400; color: var(--text-muted); margin-left: 5px; }
/* the rows share their columns (Jase, 20 Oct 2026): name, number (right-aligned, boxes the same width), unit, where it came from */
.calc-inputs { margin: 0; padding: 4px 16px; display: grid; grid-template-columns: fit-content(14em) max-content max-content minmax(0, 1fr); column-gap: 12px; }
.calc-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; row-gap: 2px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; }
.calc-row dd.mono:not(.calc-edit) { padding-right: 11px; }
.calc-row .calc-unit { white-space: nowrap; }
.calc-row:first-child { border-top: 0; }
.calc-row dt { color: var(--text); }
.calc-row dd { margin: 0; }
.calc-row dd.mono { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc-src { color: var(--text-secondary); }
.calc-src.assumed { color: var(--text-muted); font-style: italic; }
.calc-inverse { margin: 0; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13px; }
.calc-note { margin: 0; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
.calc-method { border-top: 1px solid var(--border); padding: 0 16px; font-size: 13px; }
.calc-method summary { cursor: pointer; padding: 9px 0; color: var(--text-secondary); font-weight: 500; }
.calc-card .calc-method p { margin: 0 0 8px; color: var(--text); overflow-wrap: anywhere; }
.calc-method .calc-assumption { color: var(--text-secondary); }
.calc-foot { border-top: 1px solid var(--border); padding: 10px 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.calc-foot .btn { height: 36px; font-size: 13px; text-decoration: none; }
/* the operator's own reading, changed on the card and re-run (the chat page only) */
.calc-edit { display: flex; align-items: center; justify-content: flex-end; gap: 5px; border: 1px solid var(--border-input); border-radius: 10px; height: 34px; padding: 0 10px; background: var(--bg); }
.calc-edit:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
.calc-edit input { width: 7ch; border: 0; background: transparent; font: inherit; text-align: right; outline: none; padding: 0; color: var(--text); }
.calc-unit { color: var(--text-secondary); font-family: var(--font-sans); font-size: 12px; }
.calc-stale { display: none; margin: 0; padding: 8px 16px 0; font-size: 12.5px; color: var(--warning-text); }
.calc-card.dirty .calc-stale, .calc-card.superseded .calc-stale { display: block; }
.calc-rerun { display: none; }
.calc-card.dirty .calc-rerun { display: inline-flex; }
.calc-note { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--border); }
.calc-note input { flex: 1 1 200px; min-width: 0; height: 36px; border: 1px solid var(--border-input); border-radius: 10px; padding: 0 10px; font: inherit; font-size: 14px; background: var(--bg); color: var(--text); }
.calc-note input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
.calc-note .btn { height: 36px; font-size: 13px; }
.calc-saved { margin: 0; font-size: 13px; color: var(--text-secondary); }
.calc-card.superseded { opacity: 0.7; }
.calc-card.superseded .calc-inputs, .calc-card.superseded .calc-inverse, .calc-card.superseded .calc-method,
.calc-card.superseded .calc-foot { display: none; }
.calc-card.superseded .calc-stale { color: var(--text-secondary); padding-bottom: 12px; }
/* each page keeps its own narrow-screen overrides for the cards (the chat page at 560 px, the viewer at 768 px) */
/* a Watercalcs tool switched off at this plant: its badge over the one line saying so */
.msg-off .badge { margin-bottom: 6px; }
.msg-off p { margin: 0; color: var(--text-secondary); }
/* A link drawn as a button ("Open in Watercalcs", "Open the … in Watercalcs") keeps its own text colour on hover:
   the design system's a:hover turns link text blue, which on the blue button made the words vanish (Jase, 26 Oct
   2026) */
a.btn:hover, a.btn:focus-visible { color: #fff; }
a.btn.secondary:hover, a.btn.secondary:focus-visible { color: var(--text); }
/* ... and a long one ("Open the chlorine storage and dosing system design in Watercalcs") wraps onto a second line on
   a phone instead of running off the screen (Jase, 26 Oct 2026); one line stays the usual height */
a.btn { white-space: normal; height: auto; min-height: var(--h-control); max-width: 100%; text-align: center;
        line-height: 1.3; padding-top: 8px; padding-bottom: 8px; overflow-wrap: anywhere; }

/* v107 RP_138 (9): "Show more" under a reply */
.reply-more { margin-top: 8px; }
.reply-more > summary { cursor: pointer; color: var(--text-secondary); font-size: 14px; min-height: 44px; display: flex; align-items: center; }
.reply-more > :not(summary) { margin-top: 8px; }
