/* ==========================================================================
   INFORMATION MODEL — SHARED UI LAYER STYLES
   File: App.Web/wwwroot/css/informationmodel.css

   Owner: Core.InformationModel.UI (shared RCL)
   Consumed by: any module that renders InformationModel surfaces
                (currently Module.RdsWorkspace; future modules may extend)

   Allowed concerns (HR-UI8 / §6A.3 RdsWorkspace Contract):
     • Workspace shells    — three-column grid, surface panels, drawer wrappers
     • Hierarchy surfaces  — tree rows, indentation levels, expand/collapse cues
     • Node selection      — selected/hovered/multi-selected node highlight tokens
     • AG Grid (shared)    — column-group headers, cell renderers, inline-edit pills,
                             error indicators, read-only overlay, lock-state dimming
     • Cytoscape (shared)  — node shapes, edge styles, selection ring, right-click menu
     • Indicator cards     — compact metric card, deviation badge, status dot
     • Status badges       — lock state, workflow stage, sync state chips

   Forbidden here (use the consuming module's own CSS file instead):
     • Module-specific colours or brand overrides
     • Any class names prefixed with a specific module name (e.g. .rds-*)

   Load order in App.razor (§6A.3):
     site.css → layout.css → components.css → … → informationmodel.css → rdsworkspace.css
   ========================================================================== */

/* ==========================================================================
   WORKSPACE SHELL — three-column layout, drawer wrappers, center surface
   Added in S0.4 (page shell). Consumed by Module.RdsWorkspace.
   ========================================================================== */

/* Root shell added inside MudMainContent — fills the printable viewport */
.infomodel-workspace-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.infomodel-workspace-shell .informationmodel-body-host {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Body row: left-drawer + center + right-drawer laid out by MudLayout */
.infomodel-workspace-shell .workspace-layout {
    flex: 1;
    min-height: 0;
    position: relative;
}

/* MudMainContent fills between the two MudDrawers */
.infomodel-workspace-shell .workspace-main-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    padding: 0;
}

/* ==========================================================================
   STABLE 3-ROW CENTER LAYOUT
   .center-shell            — flex column, fills workspace-main-content
     .center-main-region    — flex:1, height-growing row
       .center-diagram-host — fills main region, no scroll (Cytoscape)
       .center-table-host   — fills main region, overflow allowed (AG Grid)
     .center-bottom-row     — auto height, surface-switch tabs
   ========================================================================== */

.infomodel-workspace-shell .center-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.infomodel-workspace-shell .center-main-region {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--infomodel-workspace-canvas-bg, #f3f1ec);
}

/* Diagram host: no scrollbars — canvas owns its own viewport */
.infomodel-workspace-shell .center-diagram-host {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Table host: both axes scrollable for AG Grid */
.infomodel-workspace-shell .center-table-host {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* Analysis host */
.infomodel-workspace-shell .center-analysis-host {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Model host */
.infomodel-workspace-shell .center-model-host {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Floor plan host */
.infomodel-workspace-shell .center-floorplan-host {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Inactive view — completely hidden; the active view gets the full flex:1 (HR-RDS-CS2) */
.infomodel-workspace-shell .center-view-hidden {
    display: none !important;
}

/* Bottom surface-switch row */
.infomodel-workspace-shell .center-bottom-row {
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    gap: 0;
}

/* Surface tab button (HR-RDS-CS1) */
.infomodel-workspace-shell .center-view-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 20px;
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    border-top: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    justify-content: center;
}

.infomodel-workspace-shell .center-view-tab:hover:not(:disabled) {
    color: var(--color-grey-200);
}

.infomodel-workspace-shell .center-view-tab.active {
    color: var(--color-primary);
    border-top-color: var(--color-primary);
    border-top-width: medium;
}

.infomodel-workspace-shell .center-view-tab:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==========================================================================
   SIDE PANEL TABS + CONTENT
   ========================================================================== */

/* Drawer tab navigation strip */
.infomodel-workspace-shell .workspace-tabs {
    display: flex;
    align-items: center;
    height: 66px;
    gap: var(--space-4);
    border-bottom: 2px solid var(--color-border-subtle);
    flex-shrink: 0;
    overflow: hidden;
}

.infomodel-workspace-shell .tab-button {
    flex: 1;
    min-height: 64px;
    padding: var(--space-8) var(--space-12);
    font-size: 13px;
    line-height: 1.15;
    font-weight: 600;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    white-space: normal;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.infomodel-workspace-shell .tab-button:hover {
    background: var(--color-grey-50);
    color: var(--color-text-primary);
}

.infomodel-workspace-shell .tab-button.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Scrollable body inside a drawer */
.infomodel-workspace-shell .workspace-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-10);
}

/* Toggle button at trailing end of workspace-tabs */
.infomodel-workspace-shell .workspace-panel-toggle {
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.infomodel-workspace-shell .workspace-panel-toggle:hover {
    opacity: 1;
}

/* Mini/collapsed drawer — hide labels, center toggle */
.infomodel-workspace-shell .workspace-left-panel.mud-drawer--closed .tab-button,
.infomodel-workspace-shell .workspace-right-panel.mud-drawer--closed .tab-button {
    display: none;
}

.infomodel-workspace-shell .workspace-left-panel.mud-drawer--closed .workspace-panel-toggle,
.infomodel-workspace-shell .workspace-right-panel.mud-drawer--closed .workspace-panel-toggle {
    margin: auto;
}

.infomodel-workspace-shell .workspace-left-panel.mud-drawer--closed .workspace-content,
.infomodel-workspace-shell .workspace-right-panel.mud-drawer--closed .workspace-content {
    display: none;
}

/* Empty-state card for "no building selected" */
.infomodel-workspace-shell .infomodel-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--color-text-muted);
    text-align: center;
    padding: var(--space-40);
}

.infomodel-workspace-shell .infomodel-empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.infomodel-workspace-shell .infomodel-empty-state p {
    font-size: 0.875rem;
    margin: 0;
}

/* ==========================================================================
   NODE PROPERTIES CARD SHAPE (shared)
   Used by RDS Properties tab cards in slice 1.14.
   ========================================================================== */

.infomodel-node-prop-card,
.infomodel-workspace-shell .infomodel-node-prop-card {
    padding: 0;
    overflow: hidden;
}

.infomodel-workspace-shell .informationmodel-empty-state-card {
    margin: auto;
    max-width: 360px;
    text-align: center;
    padding: var(--space-32);
}

.infomodel-workspace-shell .informationmodel-empty-state-card h3 {
    margin: 0 0 var(--space-8);
}

.infomodel-workspace-shell .informationmodel-empty-state-card p {
    margin: 0;
}

.infomodel-workspace-shell .informationmodel-empty-state-icon {
    font-size: 1.75rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-8);
    opacity: 0.7;
}

.infomodel-workspace-shell .informationmodel-field {
    margin-bottom: var(--space-12);
}

.infomodel-workspace-shell .informationmodel-field:last-child {
    margin-bottom: 0;
}

.infomodel-workspace-shell .informationmodel-input {
    width: 100%;
    max-width: 100%;
}

.infomodel-workspace-shell .informationmodel-input-invalid {
    border-color: var(--color-error);
}

.infomodel-workspace-shell .informationmodel-validation-message {
    margin-top: var(--space-4);
    color: var(--color-error);
    font-size: 0.75rem;
}

.infomodel-workspace-shell .informationmodel-required-marker {
    color: var(--color-error);
}

.infomodel-workspace-shell .informationmodel-actions {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

.infomodel-workspace-shell .informationmodel-actions--end {
    justify-content: flex-end;
}

.infomodel-workspace-shell .informationmodel-icon-button {
    border: none;
    background: transparent;
    color: var(--color-primary);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    min-height: 22px;
    cursor: pointer;
}

.infomodel-workspace-shell .informationmodel-icon-button:hover {
    color: var(--color-primary-dark, var(--color-brand-primary-dark));
}

.infomodel-workspace-shell .informationmodel-icon-button-danger {
    color: var(--color-error);
}

.infomodel-workspace-shell .informationmodel-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.infomodel-workspace-shell .informationmodel-inline-spinner {
    margin-right: var(--space-4);
}

.infomodel-workspace-shell .informationmodel-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-24) 0;
}

.infomodel-workspace-shell .informationmodel-flex-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.infomodel-workspace-shell .informationmodel-section-header {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    padding-bottom: var(--space-1);
    border-bottom: 1px solid var(--color-border-subtle);
}

.infomodel-node-prop-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.infomodel-node-prop-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.infomodel-node-prop-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 1px dashed var(--color-border);
    font-size: 0.8125rem;
}

.infomodel-node-prop-row:last-child {
    border-bottom: none;
}

.infomodel-node-prop-row > span:first-child {
    color: var(--color-text-muted);
}

.infomodel-node-prop-row > span:last-child {
    text-align: right;
}

.infomodel-node-prop-group-title {
    margin: 8px 0 4px;
    font-weight: 600;
    font-size: 0.8125rem;
}

/* ==========================================================================
   COLLAPSIBLE INFO CARD — right-panel card pattern (S3.1)
   Combine with .app-card in markup: <div class="app-card infomodel-card">
   This modifier suppresses the hover-lift, tightens margin, and delegates
   padding control to the header and body children.

   State modifiers (applied to .infomodel-card root):
     .infomodel-card--collapsed  — body hidden; chevron points down
     .infomodel-card--expanded   — body visible; chevron points up (default)
     .infomodel-card--editing    — active edit session for this card
   ========================================================================== */

/* Modifier: no padding, no hover lift, tighter bottom gap for dense panel */
/* Left stripe matches IDS Creator card pattern (4 px, brand-primary). */
.infomodel-card {
    padding: 0;
    overflow: hidden;
    margin-bottom: var(--space-8);
    border-left: 4px solid var(--color-brand-primary);
}

.infomodel-card:hover {
    box-shadow: var(--shadow-sm); /* freeze — no lift in a dense right panel */
}

/* Edit-mode: accent border signals an active edit section.
   Re-assert left stripe after the border-color shorthand (which would override it). */
.infomodel-card--editing {
    border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
    border-left-color: var(--color-brand-primary);
}

/* ── Card header ──────────────────────────────────────────────────────────── */

.infomodel-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-8) var(--space-12);
    cursor: pointer;
    user-select: none;
    background: var(--color-grey-50);
    border-bottom: 1px solid transparent;
    min-height: 36px;
    transition: background-color 0.15s ease;
}

.infomodel-card-header:hover {
    background: var(--color-grey-100);
}

/* Edit-mode header: subtle primary tint + separator */
.infomodel-card--editing .infomodel-card-header {
    background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface));
    border-bottom-color: color-mix(in srgb, var(--color-primary) 20%, var(--color-border));
}

/* Chevron icon — rotates to indicate expanded/collapsed */
.infomodel-card-chevron {
    flex-shrink: 0;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
    transition: transform 0.15s ease;
}

/* Default (expanded): chevron at its natural position — no transform needed */

/* Collapsed: flip chevron-up to point down */
.infomodel-card--collapsed .infomodel-card-chevron {
    transform: rotate(180deg);
}

/* Card section title */
.infomodel-card-title {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Count badge next to the title — sized to match the 0.8125rem title line height */
.infomodel-card-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3em;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
    color: var(--color-primary);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
}

.infomodel-card-badge[hidden],
.infomodel-card-badge.hidden {
    display: none;
}

/* Trailing action slot: + / pencil in view mode; check / x in edit mode */
.infomodel-card-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-shrink: 0;
}

/* S2 fix: action icons inside the card header match the title font-size (0.8125rem) */
.infomodel-workspace-shell .infomodel-card-header .informationmodel-icon-button {
    font-size: 0.8125rem;
    min-width: 1.5em;
    min-height: 1.5em;
}

/* Add-property button uses a larger glyph so it reads clearly next to the title */
.infomodel-workspace-shell .infomodel-card-header .infomodel-card-add-btn {
    font-size: 1.15rem;
    min-width: 1.6em;
    min-height: 1.6em;
}

/* ==========================================================================
   NODE INFORMATION HEADER (S3) — stacked blue name + gray node type
   Replaces the generic .infomodel-card-title for the node info card.
   Markup:
     <div class="infomodel-node-info-header">
       <span class="infomodel-node-info-name">Room 101</span>
       <span class="infomodel-node-info-type">Space</span>
     </div>
   ========================================================================== */

.infomodel-node-info-header {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}

.infomodel-node-info-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.infomodel-node-info-type {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    font-weight: 400;
    text-transform: none;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Level-2 rows are hidden at level 1 (partial expand) */
.infomodel-node-info--level1 .infomodel-node-info-level2 {
    display: none;
}

/*
 * Save (✓) and cancel (✗) colour modifiers.
 * Apply alongside the existing .informationmodel-icon-button class
 * (defined above in this file under WORKSPACE SHELL):
 *   <button class="informationmodel-icon-button infomodel-card-save-btn">
 */
.infomodel-card-save-btn {
    color: var(--color-success) !important;
}

.infomodel-card-save-btn:hover {
    color: var(--color-success-text) !important;
}

.infomodel-card-cancel-btn {
    color: var(--color-text-muted) !important;
}

.infomodel-card-cancel-btn:hover {
    color: var(--color-error) !important;
}

/* ── Card body ────────────────────────────────────────────────────────────── */

.infomodel-card-body {
    padding: var(--space-8) var(--space-12);
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

/* Body is hidden when the card is collapsed */
.infomodel-card--collapsed .infomodel-card-body {
    display: none;
}

/* ==========================================================================
   PROPERTY ROW LAYOUT — Name · Unit · Value (S3.1)
   Used inside .infomodel-card-body for compact property-value display.

   Markup pattern:
     <div class="infomodel-prop-row">
       <span class="infomodel-prop-row-name">Net Area</span>
       <span class="infomodel-prop-row-unit">m²</span>
       <span class="infomodel-prop-row-value">42.5</span>
     </div>

   For a per-layer sub-row (same property, different value layer), add
   .infomodel-prop-row--layer to the row div. The layer name becomes the label.
   ========================================================================== */

.infomodel-prop-row {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    padding: 2px 0;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--color-border-light);
}

.infomodel-prop-row:last-child {
    border-bottom: none;
}

/* Layer sub-row: indented, slightly smaller text, uses layer name as label */
.infomodel-prop-row--layer {
    padding-left: var(--space-12);
}

.infomodel-prop-row--layer .infomodel-prop-row-name {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Property/layer name — stretches, muted, truncates */
.infomodel-prop-row-name {
    flex: 1;
    min-width: 0;
    color: var(--color-text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.infomodel-prop-heading {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
}

/* Property name: primary label — bold, normal text color */
.infomodel-prop-property {
    color: var(--color-text);
    font-weight: 600;
}

/* Pset name: secondary label — smaller and muted, below property name */
.infomodel-prop-pset {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

/* Unit chip — compact, sits between name and value */
.infomodel-prop-row-unit {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    background: var(--color-grey-100);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-small);
    padding: 1px 4px;
    white-space: nowrap;
}

/* Value — right-aligned, truncates */
.infomodel-prop-row-value {
    flex-shrink: 0;
    min-width: 60px;
    max-width: 45%;
    text-align: right;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Value cell in edit mode — wider to accommodate an inline input */
.infomodel-prop-row-value--editing {
    min-width: 80px;
    max-width: 55%;
}

/* Compact MudTextField / MudSelect inside inline prop-row value cells */
.infomodel-prop-row-value--editing .mud-input-control {
    margin-bottom: 0;
    width: 100%;
}

.infomodel-prop-row-value--editing .mud-input-root,
.infomodel-prop-row-value--editing .mud-input-root-outlined {
    font-size: 0.8125rem;
    min-height: 0;
    height: 22px;
    overflow: hidden;
}

.infomodel-prop-row-value--editing .mud-input-outlined,
.infomodel-prop-row-value--editing .mud-input-slot {
    font-size: 0.8125rem;
    padding-top: 1px;
    padding-bottom: 1px;
    line-height: 1.2;
}

/* Select chevron — keep it within the compact row */
.infomodel-prop-row-value--editing .mud-input-adorned-end {
    padding-right: 4px;
}

.infomodel-prop-row-value--editing .mud-input-adorned-end .mud-icon-root {
    font-size: 1rem;
}

/* MudSelect fills the full editing cell width (same as MudTextField) */
.infomodel-prop-row-value--editing .mud-select {
    width: 100%;
}

.infomodel-prop-row-value--node-sourced {
    font-style: italic;
    color: var(--color-text-muted);
}

.infomodel-ifc-node-sourced-chip {
    margin-left: 8px;
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.infomodel-ifc-node-sourced-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.infomodel-ifc-node-sourced-value {
    margin-top: 6px;
    font-style: italic;
    color: var(--color-text-muted);
}

.infomodel-ifc-card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

.infomodel-inline-link-btn {
    margin-top: 4px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-primary-600);
    text-decoration: underline;
    cursor: pointer;
}

.infomodel-ifc-copy-btn {
    margin-left: 4px;
}

/* ==========================================================================
   CYTOSCAPE HOST — shared InformationModel diagram tokens + host layout
   ========================================================================== */

:root {
    --infomodel-workspace-canvas-bg: #f3f1ec;
    --infomodel-node-group-bg: #f5f5f5;
    --infomodel-node-group-border: #b0b0b0;
    --infomodel-node-room-bg: #dbeafe;
    --infomodel-node-room-border: #60a5fa;
    --infomodel-node-text: #1f2937;
    --infomodel-node-selected: #f59e0b;
    --infomodel-edge-primary: #9ca3af;
    --infomodel-edge-secondary: #6b7280;
}

.infomodel-diagram-host {
    width: 100%;
    height: 100%;
    min-height: 0;
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--infomodel-workspace-canvas-bg, #f3f1ec);
    display: flex;
    flex-direction: column;
}

.infomodel-diagram-host-expanded {
    min-width: 1400px;
}

.informationmodel-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    flex-wrap: wrap;
}

.informationmodel-toolbar-button.mud-button-root {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 6px;
}

.informationmodel-toolbar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    font-weight: 700;
    line-height: 1;
}

.informationmodel-toolbar-divider {
    width: 1px;
    height: 28px;
    margin: 0 4px;
    background: var(--color-border);
}

.informationmodel-toolbar-dropdown {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.informationmodel-toolbar-label {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.informationmodel-toolbar-select {
    height: 32px;
    min-width: 58px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0 6px;
}

.informationmodel-search-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.informationmodel-search-input {
    min-width: 260px;
    max-width: 420px;
    width: 100%;
    height: 34px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0 10px;
    background: var(--color-surface);
    color: var(--color-text);
}

.infomodel-cy-container {
    width: 100%;
    flex: 1;
    min-height: 0;
}

/* ==========================================================================
   FLOOR PLAN HOST — shared InformationModel floor plan host styling
   ========================================================================== */

.infomodel-floorplan-host {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex: 1;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: var(--infomodel-workspace-canvas-bg, #f3f1ec);
}

.infomodel-floorplan-toolbar {
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    padding: 10px 12px;
    flex-wrap: nowrap;
}

.infomodel-floorplan-toolbar-section {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    min-width: 0;
}

.infomodel-floorplan-toolbar-section--filters {
    flex: 1 1 auto;
    flex-wrap: wrap;
    overflow: visible;
    gap: 0.35rem 0.5rem;
}

.infomodel-floorplan-toolbar-section--filters .informationmodel-toolbar-dropdown {
    min-width: 7rem;
    max-width: 11rem;
}

.infomodel-floorplan-toolbar-section--filters .informationmodel-toolbar-select {
    max-width: 11rem;
}

.infomodel-floorplan-toolbar-section--actions {
    flex: 0 0 auto;
    margin-left: auto;
}

.infomodel-floorplan-toolbar-inline-actions {
    display: inline-flex;
    align-items: flex-end;
    gap: 6px;
}

.infomodel-floorplan-toolbar-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.infomodel-floorplan-toolbar-button:hover:not(:disabled) {
    background: var(--color-grey-50);
}

.infomodel-floorplan-toolbar-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.infomodel-floorplan-toolbar-button:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
}

.infomodel-floorplan-toolbar .informationmodel-toolbar-dropdown {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 120px;
    max-width: 180px;
}

.infomodel-floorplan-toolbar .informationmodel-toolbar-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.infomodel-floorplan-toolbar .informationmodel-toolbar-select {
    width: 100%;
    min-width: 120px;
    height: 34px;
    padding: 5px 8px;
    color: var(--color-text-primary);
}

.infomodel-floorplan-host--with-sidebars {
    display: flex;
    flex-direction: column;
}

.infomodel-floorplan-main {
    display: flex;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.infomodel-floorplan-host--with-sidebars .infomodel-floorplan-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0;
    align-items: stretch;
}

.infomodel-floorplan-sidebar {
    display: flex;
    min-height: 0;
    min-width: 0;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #dee2e6);
}

.infomodel-floorplan-sidebar--left {
    border-right: none;
    width: minmax(220px, 280px);
}

.infomodel-floorplan-sidebar--left.infomodel-floorplan-sidebar--collapsed {
    width: 2rem;
}

.infomodel-floorplan-sidebar--right {
    border-left: none;
    width: minmax(200px, 260px);
    flex-direction: row;
}

.infomodel-floorplan-sidebar--right.infomodel-floorplan-sidebar--collapsed {
    width: 2rem;
}

.infomodel-floorplan-sidebar-body {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

.infomodel-floorplan-sidebar-toggle {
    flex: 0 0 2rem;
    width: 2rem;
    border: none;
    background: var(--color-grey-50, #f5f5f5);
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.infomodel-floorplan-sidebar-toggle:hover {
    background: var(--color-grey-100, #eee);
    color: var(--color-text-primary);
}

.infomodel-floorplan-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    position: relative;
}

.infomodel-floorplan-host:not(.infomodel-floorplan-host--with-sidebars) .infomodel-floorplan-main {
    flex-direction: column;
}

.infomodel-floorplan-host:not(.infomodel-floorplan-host--with-sidebars) .infomodel-floorplan-view {
    flex: 1;
}

/* Embedded Model surface (transparent center — TC parent iframe shows through) */
.infomodel-embedded-model-host {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex: 1;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.infomodel-embedded-model-toolbar {
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    padding: 10px 12px;
    flex-wrap: nowrap;
    pointer-events: auto;
}

.infomodel-embedded-model-toolbar-section {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    min-width: 0;
}

.infomodel-embedded-model-toolbar-section--labels {
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

.infomodel-embedded-model-toolbar-section--labels .informationmodel-toolbar-dropdown {
    min-width: 7rem;
    max-width: 11rem;
}

.infomodel-embedded-model-toolbar-section--tools {
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.35rem 0.5rem;
    min-width: 0;
}

.infomodel-embedded-model-toolbar-section--tools .informationmodel-toolbar-dropdown {
    min-width: 7rem;
    max-width: 11rem;
}

.infomodel-embedded-model-toolbar-section--status {
    flex: 0 0 auto;
    margin-left: auto;
    align-self: center;
}

.infomodel-embedded-model-toolbar-section--filters {
    flex: 1 1 auto;
    flex-wrap: wrap;
    overflow-x: auto;
    overflow-y: visible;
    gap: 0.35rem 0.5rem;
}

.infomodel-embedded-model-toolbar-section--filters .informationmodel-toolbar-dropdown {
    min-width: 7rem;
    max-width: 11rem;
}

.infomodel-embedded-model-toolbar-section--filters .informationmodel-toolbar-select {
    max-width: 11rem;
}

.infomodel-embedded-model-toolbar-section--actions {
    flex: 0 0 auto;
    margin-left: auto;
}

.infomodel-embedded-model-toolbar-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.infomodel-embedded-model-toolbar-button:hover:not(:disabled) {
    background: var(--color-grey-50);
}

.infomodel-embedded-model-toolbar-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.infomodel-embedded-model-toolbar-button:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
}

.infomodel-embedded-model-toolbar .informationmodel-toolbar-dropdown {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 120px;
    max-width: 180px;
}

.infomodel-embedded-model-toolbar .informationmodel-toolbar-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.infomodel-embedded-model-toolbar .informationmodel-toolbar-select {
    width: 100%;
    min-width: 120px;
    height: 34px;
    padding: 5px 8px;
    color: var(--color-text-primary);
}

.infomodel-embedded-model-host--with-sidebars {
    display: flex;
    flex-direction: column;
}

.infomodel-embedded-model-main {
    display: flex;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.infomodel-embedded-model-host--with-sidebars .infomodel-embedded-model-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0;
    align-items: stretch;
}

.infomodel-embedded-model-sidebar {
    display: flex;
    min-height: 0;
    min-width: 0;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #dee2e6);
    pointer-events: auto;
}

.infomodel-embedded-model-sidebar--left {
    border-right: none;
    width: minmax(220px, 280px);
}

.infomodel-embedded-model-sidebar--left.infomodel-embedded-model-sidebar--collapsed {
    width: 2rem;
}

.infomodel-embedded-model-sidebar--right {
    border-left: none;
    width: minmax(200px, 260px);
    flex-direction: row;
}

.infomodel-embedded-model-sidebar--right.infomodel-embedded-model-sidebar--collapsed {
    width: 2rem;
}

.infomodel-embedded-model-sidebar-body {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

.infomodel-embedded-model-sidebar-toggle {
    flex: 0 0 2rem;
    width: 2rem;
    border: none;
    background: var(--color-grey-50, #f5f5f5);
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.infomodel-embedded-model-sidebar-toggle:hover {
    background: var(--color-grey-100, #eee);
    color: var(--color-text-primary);
}

.infomodel-embedded-model-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    position: relative;
    background: transparent;
    pointer-events: none;
}

.infomodel-embedded-model-view--embedded-viewer {
    pointer-events: auto;
    overflow: hidden;
    background: var(--color-surface-default, #fff);
}

.infomodel-embedded-model-viewer-iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 280px;
    border: 0;
}

.infomodel-embedded-model-viewer-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 280px;
    padding: 1.5rem;
    background: var(--color-surface-subtle, #f4f5f7);
    border: 1px dashed var(--color-border-muted, #c5c9d0);
    border-radius: 4px;
}

.thatopen-viewer-host--embedded {
    width: 100%;
    height: 100%;
    min-height: 280px;
}

.thatopen-viewer-container--embedded {
    min-height: 280px;
}

.infomodel-embedded-model-viewer-placeholder__text {
    margin: 0;
    max-width: 28rem;
    text-align: center;
    color: var(--color-text-muted, #5c6370);
    font-size: 0.95rem;
    line-height: 1.45;
}

.infomodel-embedded-model-host:not(.infomodel-embedded-model-host--with-sidebars) .infomodel-embedded-model-main {
    flex-direction: column;
}

.infomodel-embedded-model-host:not(.infomodel-embedded-model-host--with-sidebars) .infomodel-embedded-model-view {
    flex: 1;
}

.infomodel-floorplan-svg-container {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

.infomodel-floorplan-svg-container svg {
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
    user-select: none;
}

.infomodel-floorplan-svg-container [data-ifc-guid] {
    cursor: pointer;
    stroke-width: 0.25;
}

.infomodel-floorplan-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    pointer-events: none;
}

.infomodel-floorplan-polygon--highlighted:not(.infomodel-floorplan-polygon--selected) {
    stroke: #1E88E5;
    stroke-width: 1.5;
}

.infomodel-floorplan-polygon--selected {
    fill: #1E88E5 !important;
    stroke: #0D47A1;
    stroke-width: 2;
}

.infomodel-floorplan-label {
    fill: #FFFFFF;
    stroke: rgba(0, 0, 0, 0.55);
    font-family: var(--font-family-base, system-ui, sans-serif);
    font-weight: 600;
    paint-order: stroke fill;
    pointer-events: none;
    user-select: none;
}

.infomodel-floorplan-label-picker {
    position: relative;
}

.infomodel-floorplan-label-picker-details {
    position: relative;
}

.infomodel-floorplan-label-picker-button {
    width: 100%;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.infomodel-floorplan-label-picker-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    z-index: 200;
    min-width: 11rem;
    padding: 0.35rem 0.5rem;
    background: var(--color-surface-elevated, #fff);
    border: 1px solid var(--color-border, #cfd8dc);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.infomodel-floorplan-label-picker-option {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.35rem;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

.infomodel-floorplan-label-picker-option input[type="checkbox"] {
    width: 0.85rem;
    height: 0.85rem;
    margin: 0;
    flex-shrink: 0;
}

/* Floor plan color legend (right sidebar) */
.rds-floorplan-legend-panel {
    height: 100%;
    min-height: 0;
    border: none;
    box-shadow: none;
}

.rds-floorplan-legend-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

.rds-floorplan-legend-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.15rem 0;
    font-size: 0.78rem;
    line-height: 1.25;
}

.rds-floorplan-legend-swatch {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.rds-floorplan-legend-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   AG GRID HOST — shared InformationModel matrix host styling
   ========================================================================== */

.infomodel-matrix-host {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--infomodel-workspace-canvas-bg, #f3f1ec);
}

.infomodel-matrix-grid {
    flex: 1;
    min-height: 0;
    width: 100%;
}

/* AG Grid CSS variable overrides — compound selector (specificity 0,2,0) beats the
   AG Grid CDN .ag-theme-alpine rule (0,1,0) that loads AFTER this stylesheet, and
   beats the global idstools.css .ag-theme-alpine rule for grid-specific properties.
   --ag-header-background-color applies consistently to BOTH header row levels
   (regular and group), replacing the old .ag-header-group-cell explicit background
   rule that only tinted the top row and left the second row a different grey. */
.ag-theme-alpine.infomodel-matrix-grid {
    --ag-header-background-color: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
    --ag-header-foreground-color: var(--color-text-primary);
    --ag-border-color: var(--color-border);
    --ag-row-hover-color: var(--color-grey-50);
    --ag-foreground-color: var(--color-black);
    --ag-data-color: var(--color-black);
}

.infomodel-matrix-host:not(.infomodel-matrix-host--vertical-lines) .infomodel-matrix-grid .ag-cell,
.infomodel-matrix-host:not(.infomodel-matrix-host--vertical-lines) .infomodel-matrix-grid .ag-header-cell,
.infomodel-matrix-host:not(.infomodel-matrix-host--vertical-lines) .infomodel-matrix-grid .ag-header-group-cell {
    border-right-color: transparent !important;
}

.infomodel-matrix-host.infomodel-matrix-host--vertical-lines .infomodel-matrix-grid .ag-cell,
.infomodel-matrix-host.infomodel-matrix-host--vertical-lines .infomodel-matrix-grid .ag-header-cell,
.infomodel-matrix-host.infomodel-matrix-host--vertical-lines .infomodel-matrix-grid .ag-header-group-cell {
    border-right: 1px solid var(--color-border) !important;
}

.infomodel-matrix-grid .ag-header-group-cell-label,
.infomodel-matrix-grid .ag-header-cell .ag-header-cell-label,
.infomodel-matrix-grid .ag-header-cell .ag-header-cell-text {
    white-space: normal !important;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.05em;
    color: var(--color-text-primary);
}

.infomodel-matrix-grid .ag-header-cell .ag-header-cell-label {
    display: flex;
    align-items: center;
    height: 100%;
}

.infomodel-matrix-grid .ag-header-group-cell .ag-header-group-cell-label {
    display: flex;
    align-items: center;
    height: 100%;
}

.infomodel-matrix-grid .ag-row.infomodel-row-locked {
    opacity: 1;
}

.infomodel-matrix-grid .ag-row.infomodel-child-entity-row .ag-cell:not(.infomodel-matrix-hierarchy-cell) {
    font-size: 0.95em;
}

/* Body cell text — explicitly black, scoped to InformationModel matrix only.
   .ag-cell targets body rows only; .ag-header-cell and .ag-header-group-cell
   are not matched, so headers remain Primary Blue via --ag-header-foreground-color
   set on .ag-theme-alpine.infomodel-matrix-grid above.  This explicit rule is
   necessary because AG Grid Alpine v31 reads an internal --ag-data-color variable
   for cell text rather than --ag-foreground-color, making CSS-variable-only
   overrides unreliable. */
.infomodel-matrix-grid .ag-cell,
.infomodel-matrix-grid .ag-cell .ag-cell-value {
    color: var(--color-black) !important;
}

.infomodel-matrix-grid .ag-cell.infomodel-cell-locked {
    background: transparent;
    color: var(--color-black) !important;
}

.infomodel-matrix-grid .ag-cell.infomodel-cell-error {
    box-shadow: inset 0 0 0 2px var(--color-danger);
}

.infomodel-matrix-grid .ag-cell.infomodel-cell-deviation-under {
    background: color-mix(in srgb, var(--color-danger) 18%, transparent) !important;
}

.infomodel-matrix-grid .ag-cell.infomodel-cell-deviation-within {
    background: color-mix(in srgb, var(--color-success) 18%, transparent) !important;
}

.infomodel-matrix-grid .ag-cell.infomodel-cell-deviation-over {
    background: color-mix(in srgb, var(--color-warning) 20%, transparent) !important;
}

.infomodel-matrix-stale-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    background: color-mix(in srgb, var(--color-warning) 14%, var(--color-surface));
    color: var(--color-text);
}

.infomodel-matrix-stale-banner__text {
    font-size: 0.875rem;
    font-weight: 500;
}

.infomodel-matrix-stale-banner__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.infomodel-matrix-stale-banner__action {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8125rem;
    cursor: pointer;
}

.infomodel-matrix-stale-banner__action--primary {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* ==========================================================================
   MATRIX HIERARCHY COLUMNS — real AG Grid rowSpan styling
   ========================================================================== */

.infomodel-matrix-grid .infomodel-matrix-hierarchy-cell.ag-cell-span {
    display: flex;
    align-items: flex-start;
    overflow: visible;
    background: var(--color-grey-50) !important;
    color: var(--color-black) !important;
    line-height: 1.3;
    padding-top: var(--space-4);
    border-right: 1px solid var(--color-border) !important;
    border-bottom: 1px solid var(--color-border) !important;
}

.infomodel-matrix-host:not(.infomodel-matrix-host--vertical-lines) .infomodel-matrix-grid .infomodel-matrix-hierarchy-cell.ag-cell-span {
    border-right-color: transparent !important;
}

/* ==========================================================================
   MATRIX SUM ROW
   ========================================================================== */

.infomodel-matrix-sum-row {
    font-weight: 600;
    background-color: var(--color-grey-50, #f5f5f5);
    border-top: 2px solid var(--color-grey-200, #e0e0e0);
}

.infomodel-grid-cell-emphasis {
    font-style: italic;
}

.infomodel-grid-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.5rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
}

.infomodel-grid-badge--success {
    background: color-mix(in srgb, #10b981 16%, white);
    color: #047857;
}

.infomodel-grid-badge--warning {
    background: color-mix(in srgb, #f59e0b 18%, white);
    color: #b45309;
}

.infomodel-grid-badge--muted {
    background: color-mix(in srgb, #64748b 14%, white);
    color: #475569;
}
/* ==========================================================================
   INFORMATION MODEL RULE EDITOR — shared rule editor surfaces
   ========================================================================== */

.infomodel-rule-editor-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-4, 1rem);
    min-height: 0;
}

.infomodel-rule-editor-library {
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 0.75rem);
}

.infomodel-rule-editor-filter-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-2, 0.5rem);
    align-items: end;
}

.infomodel-rule-editor-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3, 0.75rem);
}

.infomodel-rule-editor-actions {
    display: flex;
    gap: var(--space-2, 0.5rem);
}

.infomodel-rule-editor-layout {
    /* outer wrapper — grid is applied on the MudDropContainer child */
}

/* MudDropContainer renders as a single div; we give it the two-column layout */
.infomodel-rule-editor-drop-container {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 3fr);
    gap: var(--space-4, 1rem);
    align-items: start;
}

.infomodel-rule-editor-toolbox {
    position: sticky;
    top: 1rem;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 0.75rem);
}

.infomodel-rule-editor-toolbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2, 0.5rem);
}

.infomodel-rule-editor-toolbox-card {
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-md, 0.5rem);
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2, 0.5rem);
    font-weight: 600;
    text-align: center;
}

.infomodel-rule-editor-toolbox-card--blue {
    background: #edf4ff;
}

.infomodel-rule-editor-toolbox-card--green {
    background: #ebfaef;
}

.infomodel-rule-editor-toolbox-card--orange {
    background: #fff4e8;
}

.infomodel-rule-editor-toolbox-card--red {
    background: #ffeef0;
}

.infomodel-rule-editor-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 0.75rem);
    min-height: 0;
}

.infomodel-rule-editor-definition {
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-md, 0.5rem);
    padding: var(--space-4, 1rem);
    display: flex;
    flex-direction: column;
    gap: var(--space-4, 1rem);
}

.infomodel-rule-editor-save-wrap {
    position: sticky;
    top: 0.5rem;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
}

.infomodel-rule-editor-definition-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: var(--space-3, 0.75rem);
}

.infomodel-rule-editor-definition-full {
    grid-column: 1 / -1;
}

.infomodel-rule-editor-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 0.75rem);
    min-height: 40vh;
}

.infomodel-rule-editor-step-card {
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-md, 0.5rem);
    overflow: hidden;
}

.infomodel-rule-editor-step-header {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
    padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
    background: var(--color-grey-50, #f8f9fa);
}

.infomodel-rule-editor-step-action-select {
    max-width: 180px;
}

.infomodel-rule-editor-step-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3, 0.75rem);
    padding: var(--space-3, 0.75rem);
}

.infomodel-rule-editor-step-column {
    border: 1px dashed var(--color-border, #dee2e6);
    border-radius: var(--radius-sm, 0.25rem);
    padding: var(--space-2, 0.5rem);
    min-height: 64px;
}

.infomodel-rule-editor-step-column-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: var(--space-2, 0.5rem);
}

/* ── Drop zone ──────────────────────────────────────────────── */

.infomodel-rule-editor-drop-zone {
    min-height: 60px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 0.5rem);
}

/* ── Card structure (base before variants so category tints apply) ── */

.infomodel-rule-editor-card {
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-md, 0.5rem);
    background: var(--color-surface, #fff);
}

.infomodel-rule-editor-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2, 0.5rem);
    padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
    background: var(--color-grey-50, #f8f9fa);
}

.infomodel-rule-editor-card-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
}

.infomodel-rule-editor-operator-select {
    min-width: 96px;
}

.infomodel-rule-editor-card-body {
    padding: var(--space-3, 0.75rem);
}

/* ── Card color-coding ──────────────────────────────────────── */

.infomodel-rule-editor-card--blue  { border: 1px solid #c8daf8; border-left: 3px solid #5b8dee; background: #f5f9ff; }
.infomodel-rule-editor-card--green { border: 1px solid #b8e8bf; border-left: 3px solid #4caf50; background: #f3fcf5; }
.infomodel-rule-editor-card--orange{ border: 1px solid #f8d9b0; border-left: 3px solid #ffa726; background: #fff9f2; }
.infomodel-rule-editor-card--red   { border: 1px solid #f5c0c2; border-left: 3px solid #ef5350; background: #fff7f8; }

.infomodel-rule-editor-card-header--blue   { background: #edf4ff; }
.infomodel-rule-editor-card-header--green  { background: #ebfaef; }
.infomodel-rule-editor-card-header--orange { background: #fff4e8; }
.infomodel-rule-editor-card-header--red    { background: #ffeef0; }

.infomodel-rule-editor-card-target-row {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
    padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
    border-bottom: 1px solid var(--color-border, #dee2e6);
}

.infomodel-rule-editor-field-badge {
    display: inline-flex;
    margin: 0.125rem;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm, 0.25rem);
    background: #eef2f7;
    font-size: 0.75rem;
}

.infomodel-rule-editor-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2, 0.5rem);
}

.infomodel-rule-editor-database-value {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2, 0.5rem);
}

.infomodel-rule-editor-database-value .form-select,
.infomodel-rule-editor-database-value .app-input {
    flex: 1 1 8rem;
    min-width: 0;
}

@media (max-width: 1200px) {
    .infomodel-rule-editor-drop-container {
        grid-template-columns: 1fr;
    }

    .infomodel-rule-editor-toolbox {
        position: static;
    }

    .infomodel-rule-editor-definition-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .infomodel-rule-editor-filter-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ==========================================================================
   ADMIN / MANAGE SURFACES — forms outside the workspace shell
   ========================================================================== */

.infomodel-admin-surface select.app-input,
.infomodel-admin-surface .app-input.informationmodel-input {
    width: 100%;
    max-width: 100%;
}

.infomodel-rule-editor-page .informationmodel-field,
.infomodel-rule-editor-filter-row .informationmodel-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.infomodel-rule-editor-fields-grid .settings-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.infomodel-rule-editor-fields-grid .settings-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

/* ==========================================================================
   INFORMATION MODEL IMPORT UI — shared import / preview surfaces
   ========================================================================== */

.infomodel-import-section {
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: 6px;
    margin-bottom: 16px;
}

.infomodel-import-section-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border, #dee2e6);
    background: var(--color-bg-subtle, #f8f9fa);
    border-radius: 6px 6px 0 0;
}

.infomodel-import-section-header h5 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.infomodel-import-section-body {
    padding: 16px;
}

.infomodel-import-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.infomodel-import-col-left,
.infomodel-import-col-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.infomodel-import-upload-action {
    justify-content: flex-start;
    padding-top: 28px;
}

.infomodel-import-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-text-secondary, #495057);
    margin-bottom: 2px;
}

.infomodel-import-hint {
    font-size: 0.78rem;
    color: var(--color-text-muted, #6c757d);
}

.infomodel-import-radio-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.infomodel-import-radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.infomodel-import-tab-row {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--color-border, #dee2e6);
    padding-bottom: 2px;
}

.infomodel-import-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 6px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--color-text-secondary, #495057);
    border-radius: 4px 4px 0 0;
}

.infomodel-import-tab-btn:hover {
    color: var(--color-primary, #0d6efd);
    background: var(--color-bg-subtle, #f8f9fa);
}

.infomodel-import-tab-btn.active {
    color: var(--color-primary, #0d6efd);
    border-bottom-color: var(--color-primary, #0d6efd);
    font-weight: 600;
}

.infomodel-drop-zone {
    border: 2px dashed var(--color-border, #dee2e6);
    border-radius: 6px;
    padding: 24px 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.infomodel-drop-zone:hover:not(.disabled) {
    border-color: var(--color-primary, #0d6efd);
    background: var(--color-bg-subtle, #f8f9fa);
}

.infomodel-drop-zone.drag-over:not(.disabled) {
    border-color: var(--color-primary, #0d6efd);
    background: color-mix(in srgb, var(--color-primary, #0d6efd) 8%, transparent);
}

.infomodel-drop-zone.disabled {
    opacity: 0.55;
    cursor: default;
}

.infomodel-drop-zone.has-file {
    border-color: var(--color-success, #198754);
}

.infomodel-drop-zone-content {
    pointer-events: none;
}

.infomodel-drop-zone-content p {
    margin: 4px 0;
    font-size: 0.85rem;
}

.infomodel-drop-icon {
    font-size: 1.8rem;
    color: var(--color-text-muted, #6c757d);
}

.infomodel-import-icon-ok {
    color: var(--color-success, #198754);
}

.infomodel-import-rule-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.infomodel-file-input-hidden {
    display: none;
}

.infomodel-import-summary-table-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
}

.infomodel-import-summary-table {
    width: 100%;
    font-size: 0.82rem;
    border-collapse: collapse;
}

.infomodel-import-summary-table th,
.infomodel-import-summary-table td {
    padding: 5px 10px;
    border: 1px solid var(--color-border, #dee2e6);
}

.infomodel-import-summary-table thead th {
    background: var(--color-bg-subtle, #f8f9fa);
    font-weight: 600;
    text-align: center;
}

.infomodel-import-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    min-width: 50px;
}

.infomodel-import-num-create { color: var(--color-success, #198754); font-weight: 600; }
.infomodel-import-num-update { color: var(--color-primary, #0d6efd); font-weight: 600; }
.infomodel-import-num-link   { color: var(--color-info, #0dcaf0);    font-weight: 600; }
.infomodel-import-num-error  { color: var(--color-danger, #dc3545);  font-weight: 600; }

.infomodel-import-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.infomodel-import-filter-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 150px;
}

.infomodel-import-table-wrap {
    overflow-x: auto;
    margin-bottom: 12px;
    max-height: 480px;
    overflow-y: auto;
}

.infomodel-import-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}

.infomodel-import-table th,
.infomodel-import-table td {
    padding: 4px 8px;
    border: 1px solid var(--color-border, #dee2e6);
    vertical-align: top;
}

.infomodel-import-table thead th {
    position: sticky;
    top: 0;
    background: var(--color-bg-subtle, #f8f9fa);
    font-weight: 600;
    z-index: 1;
}

.infomodel-import-row-error td {
    background: #fff5f5;
}

.infomodel-import-key-cell {
    font-family: monospace;
    font-size: 0.75rem;
    max-width: 160px;
    word-break: break-all;
}

.infomodel-import-snapshot-cell {
    max-width: 200px;
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.infomodel-import-muted {
    color: var(--color-text-muted, #6c757d);
}

.infomodel-import-center {
    text-align: center;
}

.infomodel-import-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.infomodel-import-badge-success { background: #d1e7dd; color: #0a3622; }
.infomodel-import-badge-primary { background: #cfe2ff; color: #084298; }
.infomodel-import-badge-info    { background: #cff4fc; color: #055160; }
.infomodel-import-badge-warning { background: #fff3cd; color: #664d03; }
.infomodel-import-badge-error   { background: #f8d7da; color: #842029; }
.infomodel-import-badge-neutral { background: #e2e3e5; color: #41464b; }

.infomodel-import-msg {
    font-size: 0.75rem;
    padding: 2px 0;
    word-break: break-word;
}

.infomodel-import-msg-error   { color: var(--color-danger,  #dc3545); }
.infomodel-import-msg-warning { color: var(--color-warning-text, #856404); }

.infomodel-import-action-bar {
    display: flex;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border, #dee2e6);
    margin-top: 8px;
}

.infomodel-import-loading-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--color-text-secondary, #495057);
}

/* ==========================================================================
   MATRIX / TABLE EXPORT MODAL
   ========================================================================== */

.infomodel-export-modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.infomodel-export-option-group {
    border: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.infomodel-export-option-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    padding: 0;
}

.infomodel-export-radio-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.infomodel-export-radio-row label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.875rem;
    cursor: pointer;
}

/* ==========================================================================
   INFOMODEL NODE TREE — shared hierarchy tree component (InfoModelNodeTree)
   Added in FilterState Session 2.
   Consumed by: any InformationModel surface that needs a hierarchy tree.

   Module-specific overrides (colours, width, panel wrapper) go in the
   consuming module's own CSS (e.g. rdsworkspace.css).
   ========================================================================== */

.infomodel-node-tree {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-size: 0.875rem;
    user-select: none;
}

.infomodel-node-tree-empty,
.infomodel-node-tree-loading {
    padding: var(--space-3, 12px);
    font-size: 0.85rem;
    color: var(--color-text-muted, #9aa0a6);
}

/* ── Node row ──────────────────────────────────────────────────────────────── */

.infomodel-node-tree-node {
    display: flex;
    align-items: center;
    gap: var(--space-1, 4px);
    padding: 3px 6px 3px 0;
    padding-left: calc(var(--infomodel-tree-depth, 0) * 1.1rem);
    border-radius: var(--radius-small, 4px);
    cursor: pointer;
    min-height: 28px;
    box-sizing: border-box;
}

.infomodel-node-tree-node:hover {
    background: var(--color-bg-subtle, #f3f5f7);
}

.infomodel-node-tree-node--active {
    background: color-mix(in srgb, var(--color-primary, #005f9e) 14%, var(--color-surface, #fff));
    color: var(--color-primary-darken, #00437b);
    box-shadow: inset 3px 0 0 var(--color-primary, #005f9e);
}

.infomodel-node-tree-node--active:hover {
    background: color-mix(in srgb, var(--color-primary, #005f9e) 20%, var(--color-surface, #fff));
}

.infomodel-node-tree-node--quick-selected {
    background: color-mix(in srgb, var(--color-info, #0dcaf0) 12%, var(--color-surface, #fff));
}

.infomodel-node-tree-node--quick-selected:hover {
    background: color-mix(in srgb, var(--color-info, #0dcaf0) 18%, var(--color-surface, #fff));
}

.infomodel-node-tree-node--active.infomodel-node-tree-node--quick-selected {
    background: color-mix(in srgb, var(--color-primary, #005f9e) 18%, var(--color-info, #0dcaf0) 8%, var(--color-surface, #fff));
}

/* Unbound: node lacks an external binding (e.g. missing IFC GUID).
   The label is shown in muted gray; the row still supports selection. */
.infomodel-node-tree-node--unbound .infomodel-node-tree-label {
    color: var(--color-text-muted, #9aa0a6);
}

.infomodel-node-tree-node--unbound.infomodel-node-tree-node--active .infomodel-node-tree-label,
.infomodel-node-tree-node--unbound.infomodel-node-tree-node--quick-selected .infomodel-node-tree-label {
    color: var(--color-text-secondary, #666);
}

/* ── Expand / collapse toggle ─────────────────────────────────────────────── */

.infomodel-node-tree-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-text-secondary, #555);
    cursor: pointer;
    border-radius: var(--radius-small, 4px);
    font-size: 0.7rem;
    line-height: 1;
}

.infomodel-node-tree-toggle:hover {
    background: var(--color-bg-subtle, #f3f5f7);
}

/* Leaf nodes: toggle button is invisible but still reserves space for alignment */
.infomodel-node-tree-toggle--leaf {
    visibility: hidden;
    pointer-events: none;
}

/* ── Checkbox ─────────────────────────────────────────────────────────────── */

.infomodel-node-tree-checkbox {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--color-primary, #005f9e);
    cursor: pointer;
}

.infomodel-node-tree-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* ── Label ────────────────────────────────────────────────────────────────── */

.infomodel-node-tree-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    line-height: 1.4;
}
