/* =========================================================================
   System elements (system.js) and package cards (packages.js)

   They are styled as the parts of the editor they sit beside: the tree's
   role rows, the inspector's groups and tables, the solid card on the
   canvas, the Results drawer's tables. Colours come from tokens.css so both
   themes follow.
   ========================================================================= */

/* ---------------------------------------------------------- model tree */

#tree .sys-sep { margin-top: 10px; }
#tree .sys-sec.bad > .nm::after,
#tree .sys-row.bad .nm::after,
#tree .tr.package.bad .nm::after {
    content: "!"; display: inline-block; margin-left: 6px; width: 13px; height: 13px; line-height: 13px;
    border-radius: 50%; background: var(--danger); color: var(--on-fill); font-size: 9px; font-weight: 700; text-align: center;
}
#tree .role-row .kind.sys-ic { width: 3px; height: 12px; }
#tree .role-row .kind.sys-env { background: var(--amber); }
#tree .role-row .kind.sys-hum { background: var(--cool); }
#tree .role-row .kind.sys-ctrl { background: var(--brand); }
#tree .role-row .kind.sys-cycle { background: var(--fluid); }
#tree .role-row .kind.sys-scn { background: var(--ink-mid); }
#tree .sys-row.sel { background: var(--brand-pale); }
#tree .dot.package { background: var(--board); border-radius: var(--radius); }
#tree .tr.package.over .meta { color: var(--danger); font-weight: 600; }
.kind.package { background: var(--board); }

/* ---------------------------------------------------------- inspector */

.sys-ends { display: flex; align-items: center; gap: 8px; }
.sys-tag {
    display: inline-block; font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .04em;
    padding: 1px 5px; border-radius: var(--radius); background: var(--brand-pale); color: var(--brand-deep);
}
.sys-sub { font-size: 12px; color: var(--ink-soft); margin: 2px 0 8px; line-height: 1.4; }
.sys-problems {
    margin: 4px 0 10px; padding: 7px 9px; border: 1px solid var(--bad-line); border-left: 3px solid var(--danger);
    background: var(--bad-pale); border-radius: var(--radius); font-size: 12px; color: var(--ink);
}
.sys-problems p { margin: 0; line-height: 1.4; }
.sys-problems p + p { margin-top: 4px; }
.sys-error { color: var(--danger); font-size: 12px; }
.sys-readout { font-size: 12px; color: var(--ink-mid); margin: 2px 0 4px; min-height: 16px; }
.sys-readout b { color: var(--ink); }
.sys-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.sys-actions .file-btn { display: inline-flex; align-items: center; }
#inspector .field-row.wrap { flex-wrap: wrap; }
#inspector .field label .u, .rt th .u { color: var(--ink-faint); font-weight: 400; font-size: 11px; }
.check-line { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.check-line input { margin: 0; }
.sys-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; max-height: 180px; overflow: auto;
    padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--field); }
.sys-checks label { display: flex; align-items: center; gap: 6px; font-size: 12px; min-width: 0; }
.sys-checks label input { flex: none; margin: 0; }
.sys-tabs { margin: 10px 0 8px; flex-wrap: wrap; }
.sys-tabs .seg-btn { font-size: 11.5px; padding: 4px 8px; }
.sys-tabbody .pgroup:first-child { margin-top: 0; }

/* Tables edited in place: a header, one row per item, a remove button. */
.rt-wrap { overflow-x: auto; margin: 2px 0 4px; }
table.rt { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: auto; }
table.rt th { text-align: left; font-weight: 600; font-size: 11px; color: var(--ink-mid); padding: 3px 4px;
    border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.rt td { padding: 2px 3px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.rt td.num, table.rt th.num { text-align: right; font-family: var(--mono); font-size: 11.5px; }
table.rt input[type="number"], table.rt input[type="text"], table.rt select {
    width: 100%; min-width: 52px; box-sizing: border-box; height: 24px; font-size: 12px; padding: 0 5px;
}
table.rt select { padding-right: 24px; }
table.rt input[type="checkbox"] { margin: 0 4px; }
table.rt input:disabled, table.rt select:disabled { opacity: .45; }
table.rt .rt-tools { width: 1%; white-space: nowrap; text-align: right; }
.rt-btn { padding: 0 5px; height: 22px; min-width: 22px; font-size: 12px; line-height: 20px; color: var(--ink-soft); }
.rt-btn:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
.rt-btn[data-rt-up]:hover:not(:disabled), .rt-btn[data-rt-down]:hover:not(:disabled) { color: var(--brand); border-color: var(--brand); }
.rt-add { margin-top: 4px; font-size: 12px; padding: 3px 10px; }
table.rt tr.rt-empty td { color: var(--ink-faint); font-style: italic; padding: 6px 4px; }
table.rt.sys-ovr tr.off td:not(:first-child) { opacity: .5; }

/* Small tables of results in the inspector and the drawer. */
table.sys-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.sys-table th { text-align: left; font-size: 11px; color: var(--ink-mid); font-weight: 600; padding: 3px 6px; border-bottom: 1px solid var(--rule); }
table.sys-table td { padding: 3px 6px; border-bottom: 1px solid var(--rule); }
table.sys-table .num { text-align: right; font-family: var(--mono); }
table.sys-table tr.warn td { color: var(--danger); }
table.sys-table td.hi { font-weight: 700; color: var(--warm-deep); }
table.sys-table tr[data-sys-link], table.sys-table tr[data-pkg-link] { cursor: pointer; }
table.sys-table tr[data-sys-link]:hover td, table.sys-table tr[data-pkg-link]:hover td { background: var(--field); }
#inspector .rows .v.warn { color: var(--danger); font-weight: 600; }

/* Charts. */
.sys-chart { margin-top: 6px; }
.sys-svg { width: 100%; height: auto; display: block; background: var(--field); border: 1px solid var(--rule); border-radius: var(--radius); }
.sys-svg .ax { stroke: var(--rule-firm); stroke-width: 1; }
.sys-svg text { font-family: var(--mono); font-size: 8px; fill: var(--ink-soft); }
.sys-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 4px 0; font-size: 11px; color: var(--ink-mid); }
.sys-legend i { display: inline-block; width: 10px; height: 3px; margin-right: 4px; vertical-align: middle; border-radius: 1px; }
.sys-legend .u { color: var(--ink-faint); margin-left: auto; }

/* ---------------------------------------------------------- Insert panel */

.chip.action.sys .chip-ic { stroke: var(--brand); }
.chip.action.package .chip-ic { stroke: var(--board); }
.chip.action .chip-ic .fill { fill: currentColor; }
label.chip.file-chip { cursor: pointer; }

/* ---------------------------------------------------------- run settings */

.run-check { margin: 6px 0 2px; }

/* ---------------------------------------------------------- results drawer */

.system-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; padding: 4px 0; }
.system-results.rpane-off { display: none; }
.system-results > .hint { grid-column: 1 / -1; }
.sys-card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); padding: 8px 10px; min-width: 0; }
.sys-card h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--ink); }
.sys-card p { margin: 0 0 4px; font-size: 12px; line-height: 1.45; }
.sys-card:first-child:has(table th + th + th + th + th) { grid-column: 1 / -1; }

/* ---------------------------------------------------------- package cards */

/* Width is PKG_W in packages.js; the height grows with the surfaces. */
#world .package-object {
    position: absolute;
    width: 212px;
    box-sizing: border-box;
    padding: 9px 12px 8px;
    background: var(--panel);
    border: 1px solid var(--rule-firm);
    border-left: 3px solid var(--board);
    cursor: grab;
    user-select: none;
    touch-action: none;
}
#world .package-object.selected { border-color: var(--brand); border-left-color: var(--board); }
#world .package-object.selected::before {
    content: ""; position: absolute; inset: -4px; border: 1px dashed var(--brand); pointer-events: none;
}
#world .package-object.multi-sel { outline: 2px solid var(--brand); outline-offset: 2px; }
#world .package-object.bad { border-color: var(--danger); }
#world .package-object.dragging { cursor: grabbing; box-shadow: var(--float-shadow); }
#world .package-object .pkg-head { display: flex; align-items: center; gap: 6px; }
#world .package-object .pkg-tag {
    font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .04em; padding: 1px 4px;
    border-radius: var(--radius); background: var(--board-pale); color: var(--board-deep);
}
#world .package-object .pkg-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#world .package-object .pkg-meta { font-family: var(--mono); font-size: 9.5px; color: var(--ink-soft); margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#world .package-object .pkg-state { font-size: 10.5px; margin-top: 2px; color: var(--ink-mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#world .package-object .pkg-state.over { color: var(--danger); font-weight: 600; }
#world .package-object .pkg-ports { list-style: none; margin: 0; padding: 0; }
#world .package-object .pkg-ports li {
    pointer-events: none;
    position: absolute; right: 16px; left: 12px; font-size: 11px; line-height: 16px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right;
}
#world .package-object .pkg-ports li.merged { color: var(--ink-soft); right: 12px; }
#world .package-object .pkg-ports .v { font-family: var(--mono); font-size: 10px; color: var(--ink-soft); }
#world .port-node.package { border-color: var(--board); background: var(--panel); }
#world .port-node.package:hover { border-color: var(--board-deep); }

/* Rows as cards: an item of a list whose fields do not fit a table row. */
.rt-cards { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 4px; }
.rt-card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--field); padding: 5px 7px 7px; }
.rt-card-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11.5px; font-weight: 600;
    color: var(--ink-mid); margin-bottom: 4px; }
.rt-card-head .rt-tools { display: inline-flex; gap: 3px; }
.rt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; }
.rt-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rt-field.wide { grid-column: 1 / -1; }
.rt-field label { font-size: 11px; color: var(--ink-mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-field input[type="number"], .rt-field input[type="text"], .rt-field select { width: 100%; box-sizing: border-box; height: 26px; font-size: 12px; }
.rt-field input[type="checkbox"] { align-self: flex-start; margin: 5px 0 0; }
.rt-none { font-size: 12px; color: var(--ink-faint); font-style: italic; margin: 4px 0; }
.sys-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.sys-tabs .seg-btn { padding: 4px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sys-sub b { color: var(--ink); font-weight: 600; }
table.rt.sys-ovr td:first-child { min-width: 96px; }
table.rt.sys-ovr select { min-width: 74px; }
.sys-note { font-size: 12px; color: var(--ink-mid); background: var(--field); border-left: 3px solid var(--amber);
    padding: 6px 8px; margin: 6px 0; line-height: 1.45; }
.link-btn { border: none; background: none; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font-size: inherit; }
input.rt-missing { border-color: var(--danger); background: var(--bad-pale); }
#inspector .field-row > .field:only-child { flex: 1 1 100%; }
#inspector .field-row > .field:only-child select { width: 100%; }

/* -- Package models: the topology diagram, and a chip's package on a board -- */
.pkg-diagram { margin: 8px 0 2px; padding: 6px 6px 4px; border: 1px solid var(--rule); border-radius: var(--radius);
    background: var(--panel); }
.pkg-diagram svg { display: block; width: 100%; height: auto; max-height: 150px; }
.pkg-diagram .pd-r { stroke: var(--ink-mid); stroke-width: 1.2; }
.pkg-diagram .pd-r.missing { stroke: var(--danger); stroke-dasharray: 3 3; }
.pkg-diagram .pd-v { font: 9px var(--mono); fill: var(--ink-mid); text-anchor: middle; paint-order: stroke;
    stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }
.pkg-diagram .pd-l { font-size: 9.5px; fill: var(--ink); text-anchor: middle; }
.pkg-diagram .pd-n { stroke: var(--ink); stroke-width: 1.2; fill: var(--panel); }
.pkg-diagram .pd-junction { fill: var(--warm); stroke: var(--warm); }
.pkg-diagram .pd-internal { fill: var(--ink-faint); stroke: var(--ink-mid); }
.pkg-diagram .pd-board, .pkg-diagram .pd-board_inner, .pkg-diagram .pd-board_outer,
.pkg-diagram .pd-leads { fill: var(--board); stroke: var(--board-deep); }
.pkg-diagram .pd-ambient { fill: var(--cool-pale); stroke: var(--cool); }
.pkg-diagram .pd-port { fill: var(--brand); stroke: var(--brand); }
.pkg-diagram .pd-open { fill: none; stroke: var(--ink-faint); stroke-dasharray: 2 2; }
.pkg-diagram figcaption { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--ink-mid); margin-top: 2px; }
.pkg-diagram .pd-key i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 3px 0 8px; vertical-align: -1px; }
.pkg-diagram .pd-key i.pd-board { background: var(--board); }
.pkg-diagram .pd-key i.pd-ambient { background: var(--cool-pale); border: 1px solid var(--cool); }
.pkg-diagram .pd-key i.pd-port { background: var(--brand); }

.pcpk { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--rule); }
.pcpk .pgroup h3 { margin-top: 2px; }
.pcpk-source { font-size: 12px; color: var(--ink-mid); margin: 0 0 6px; line-height: 1.4; }
.pcpk-source b { color: var(--ink); font-weight: 600; }
.pcpk-from { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.pcpk-from select { flex: 1 1 140px; min-width: 0; width: auto; }
.pcpk-from .file-btn { display: inline-flex; align-items: center; font-size: 12px; white-space: nowrap; }
table.pcpk-split { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
table.pcpk-split th { text-align: left; font-weight: 600; font-size: 11px; color: var(--ink-mid); padding: 3px 4px;
    border-bottom: 1px solid var(--rule-firm); }
table.pcpk-split td { padding: 3px 4px; border-bottom: 1px solid var(--rule); }
table.pcpk-split .num { text-align: right; font-family: var(--mono); font-size: 11.5px; }
.pcb-part.packaged { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--board-pale) 70%, transparent); }
.pkg-diagram .pd-key { white-space: nowrap; }
.pcpk-source .k { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); margin-right: 4px; }
table.pcpk-split td:first-child, table.pcpk-split th { white-space: nowrap; }
.pcpk-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 10px 0 4px; background: var(--rule); }
.pcpk-bar span { display: block; min-width: 2px; }
.pcpk-bar .pd-board, .pcpk-bar-key i.pd-board { background: var(--board); }
.pcpk-bar .pd-ambient, .pcpk-bar-key i.pd-ambient { background: var(--cool); }
.pcpk-bar .pd-port, .pcpk-bar-key i.pd-port { background: var(--brand); }
.pcpk-bar-key { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--ink-mid); }
.pcpk-bar-key i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* ---------------------------------------------------------- refrigeration cards (refrigcards.js) */

/* Width is RF_W in refrigcards.js; the height follows the ports. */
#world .rf-card {
    position: absolute;
    width: 188px;
    box-sizing: border-box;
    padding: 7px 12px 6px;
    background: var(--panel);
    border: 1px solid var(--rule-firm);
    border-top: 3px solid var(--refrig);
    border-radius: var(--radius);
    cursor: grab;
    user-select: none;
    touch-action: none;
    z-index: 1;
}
#world .rf-card[data-type="compressor"], #world .rf-card[data-type="pump"] { border-top-color: var(--rf-vapour); }
#world .rf-card[data-type="condenser"], #world .rf-card[data-type="gas_cooler"] { border-top-color: var(--rf-vapour); }
#world .rf-card[data-type="evaporator"] { border-top-color: var(--rf-liquid); }
#world .rf-card[data-type="expansion_valve"], #world .rf-card[data-type="flash_tank"] { border-top-color: var(--rf-mix); }
#world .rf-card:hover { border-color: var(--refrig); }
#world .rf-card.selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
#world .rf-card.in-selected-system { box-shadow: 0 0 0 2px var(--refrig-pale), 0 0 0 3px var(--refrig); }
#world .rf-card.dragging { cursor: grabbing; box-shadow: var(--float-shadow); z-index: 3; }
#world .rf-card.warn { border-color: var(--amber-line); }
#world .rf-card.bad { border-color: var(--danger); }
#world .rf-card .rf-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
#world .rf-card .rf-glyph, .rf-ins-head .rf-glyph {
    width: 20px; height: 20px; flex: none; fill: none; stroke: var(--refrig); stroke-width: 1.5;
    stroke-linecap: round; stroke-linejoin: round;
}
#world .rf-card .rf-glyph .lq, .rf-ins-head .rf-glyph .lq { stroke: var(--rf-liquid); stroke-width: 2.2; }
#world .rf-card .rf-name { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#world .rf-card .rf-tag {
    font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .04em; padding: 1px 4px;
    border-radius: var(--radius); background: var(--refrig-pale); color: var(--refrig-deep);
}
#world .rf-card .rf-meta { font-family: var(--mono); font-size: 9.5px; color: var(--ink-soft); margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#world .rf-card .rf-read { font-size: 11px; margin-top: 3px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#world .rf-card .rf-read:empty::before { content: "–"; }
#world .rf-card .rf-read.solved { color: var(--ink); font-weight: 600; }
#world .rf-card.warn .rf-read.solved { color: var(--amber); }
#world .rf-card.bad .rf-read.solved { color: var(--danger); }
#world .rf-card .rf-ports { list-style: none; margin: 0; padding: 0; }
#world .rf-card .rf-ports li {
    pointer-events: none; position: absolute; font-size: 10px; line-height: 16px; color: var(--ink-soft); white-space: nowrap;
}
#world .rf-card .rf-ports li.in { left: 13px; }
#world .rf-card .rf-ports li.out { right: 13px; }

/* The system badge above its cards: name, fluid, state; drag it to move the system. */
#world .rf-badge {
    position: absolute; display: flex; align-items: center; gap: 7px; height: 26px; box-sizing: border-box;
    padding: 0 10px 0 8px; border: 1px solid var(--rule-firm); border-radius: 13px; background: var(--panel);
    font-size: 11.5px; white-space: nowrap; cursor: grab; user-select: none; touch-action: none; z-index: 1;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .04);
}
#world .rf-badge:hover { border-color: var(--refrig); }
#world .rf-badge.selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
#world .rf-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex: none; }
#world .rf-badge.ok .dot { background: var(--ok); }
#world .rf-badge.warn .dot, #world .rf-badge.open .dot { background: var(--amber); }
#world .rf-badge.bad .dot { background: var(--danger); }
#world .rf-badge strong { font-weight: 600; color: var(--ink); }
#world .rf-badge .fl { font-family: var(--mono); font-size: 10px; padding: 1px 5px; border-radius: var(--radius);
    background: var(--refrig-pale); color: var(--refrig-deep); }
#world .rf-badge .st { color: var(--ink-mid); }
#world .rf-badge.bad .st { color: var(--danger); }
#world .rf-badge.open .st, #world .rf-badge.warn .st { color: var(--amber); }

/* Port handles: an inlet is hollow, an outlet filled; the wall is a square under the card. */
#world .port-node.refrig { border-color: var(--refrig); background: var(--panel); width: 16px; height: 16px; margin: 1px; }
#world .port-node.refrig.outlet { background: var(--refrig); }
#world .port-node.refrig.wall { border-radius: 3px; border-color: var(--warm); background: var(--panel); }
#world .port-node.refrig.wall.coupled { background: var(--warm); }
#world .port-node.refrig:hover { border-color: var(--refrig-deep); }
#world .port-node.refrig.link-target { border-color: var(--refrig); box-shadow: 0 0 0 4px var(--refrig-pale); }
#draft-wire.refrig { stroke: var(--refrig); stroke-width: 3; stroke-dasharray: none; }

/* Refrigerant piping: solid, coloured by the state it carries once solved. */
#wires .wire.refrig { stroke: var(--refrig); stroke-width: 3; fill: none; stroke-linejoin: round; stroke-linecap: round; }
#wires .wire.refrig.liquid { stroke: var(--rf-liquid); stroke-width: 3.5; }
#wires .wire.refrig.mix { stroke: var(--rf-mix); stroke-dasharray: 7 3; }
#wires .wire.refrig.vapour { stroke: var(--rf-vapour); }
#wires .wire.refrig.super { stroke: var(--rf-super); stroke-width: 3.5; }
#wires .wire.refrig.selected { stroke: var(--brand); stroke-width: 4.5; }
#wires .wire.refrig.mix.flowing { animation: fluid-flow 1.4s linear infinite; }
@media (prefers-reduced-motion: reduce) { #wires .wire.refrig.mix.flowing { animation: none; } }
#wires .arrow.refrig { fill: var(--refrig); }
#wires .arrow.refrig.liquid { fill: var(--rf-liquid); }
#wires .arrow.refrig.mix { fill: var(--rf-mix); }
#wires .arrow.refrig.vapour { fill: var(--rf-vapour); }
#wires .arrow.refrig.super { fill: var(--rf-super); }
#wires text.rf-label { fill: var(--ink-mid); font-family: var(--mono); font-size: 9.5px; }
#wires .rf-coupling { stroke-dasharray: 2 4; stroke-width: 2.4; }
#wires .arrow.coupling-arrow { fill: var(--warm); }

/* The palette and the inspector */
.chip.tile.refrig .chip-ic { stroke: var(--refrig); }
.chip.tile.refrig .chip-ic .lq { stroke: var(--rf-liquid); stroke-width: 2.2; }
.chip.action.refrig .chip-ic { stroke: var(--refrig); }
.rf-templates .chip-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rf-ins-head { display: flex; gap: 8px; align-items: center; margin: 2px 0 8px; }
.rf-ins-head div { display: flex; flex-direction: column; min-width: 0; }
.rf-ins-head strong { font-size: 13.5px; }
.rf-ins-head span { font-size: 11.5px; color: var(--ink-soft); }
.rf-status { font-size: 12px; font-weight: 600; padding: 5px 8px; margin: 2px 0 8px; border-radius: var(--radius);
    background: var(--field); border-left: 3px solid var(--ink-faint); }
.rf-status.ok { border-left-color: var(--ok); }
.rf-status.warn, .rf-status.open { border-left-color: var(--amber); color: var(--amber-deep); }
.rf-status.bad { border-left-color: var(--danger); color: var(--danger); }
.rf-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.rf-pair { display: flex; gap: 4px; }
.rf-pair > * { min-width: 0; flex: 1; }
.rf-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rf-table td { padding: 2px 0; border-bottom: 1px solid var(--rule); }
.rf-table td.num { text-align: right; font-family: var(--mono); font-size: 11.5px; }
.rf-limits { margin: 6px 0 0; padding-left: 16px; font-size: 11.5px; line-height: 1.45; }
.rf-limits li.error { color: var(--danger); }
.rf-limits li.warning { color: var(--amber); }
.rf-err { color: var(--danger); font-size: 12px; }
.rf-doc summary { cursor: pointer; font-size: 12px; color: var(--ink-mid); margin-top: 8px; }
.rf-doc pre { white-space: pre-wrap; font-size: 11px; line-height: 1.45; max-height: 260px; overflow: auto;
    background: var(--field); padding: 6px 8px; border-radius: var(--radius); }

/* Four domains in the Insert panel: each tab as wide as its word. */
#domain-row .seg-btn { flex: 1 1 auto; padding: 6px 3px; font-size: 11.5px; text-overflow: clip; }
#tree .dot.refrig { background: var(--refrig); border-radius: 50%; }
.kind.refrig { background: var(--refrig); }
#world .rf-card.multi-sel { outline: 2px solid var(--brand); outline-offset: 2px; }
#world .rf-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
