/* ==========================================================================
   ROOMDATASHEET MODULE STYLES
   Extends components.css, layout.css, site.css
   Saved at App.Web/wwwroot/css per styling-css.agent rules
   ========================================================================== */

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.roomdatasheet-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.roomdatasheet-content {
    flex: 1;
    overflow-y: auto;
}

.roomdatasheet-page {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-20);
}

/* Page content wrapper with consistent margins */
.roomdatasheet-page-content {
    padding: var(--space-24);
}

/* ==========================================================================
   INDICATORS (Simple style with white card and blue font)
   ========================================================================== */

.indicator-section {
    margin-bottom: var(--space-24);
}

.indicator-section h2 {
    margin-bottom: var(--space-16);
}

.indicator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-16);
}

.indicator-card {
    background: var(--color-white);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-medium);
    padding: var(--space-16);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.indicator-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
}

.indicator-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--color-brand-primary);
}

/* Status indicator cards with colored borders (for AnalysisPage) */
.indicator-card.status-badge-fulfilled {
    border: 2px solid var(--color-success);
    border-radius: var(--radius-medium);
}

.indicator-card.status-badge-under {
    border: 2px solid var(--color-error);
    border-radius: var(--radius-medium);
}

.indicator-card.status-badge-over {
    border: 2px solid var(--color-warning);
    border-radius: var(--radius-medium);
}

/* Background colors for IST/SOLL comparison indicators (ExecutedPage) */
.indicator-card.indicator-too-little {
    background-color: var(--color-error-light);
}

.indicator-card.indicator-in-tolerance {
    background-color: var(--color-success-light);
}

.indicator-card.indicator-too-much {
    background-color: var(--color-warning-light);
}

/* ==========================================================================
   TABLE CELL BACKGROUND COLORS (for IST values)
   ========================================================================== */

.cell-too-little {
    background-color: var(--color-error-light) !important;
}

.cell-in-tolerance {
    background-color: var(--color-success-light) !important;
}

.cell-too-much {
    background-color: var(--color-warning-light) !important;
}

/* Saving state - green background for visual feedback */
.saving {
    background-color: var(--color-success-light) !important;
    transition: background-color 0.2s ease-in-out;
}

/* ==========================================================================
   TABLES
   ========================================================================== */

.table td input.app-input,
.table td select.app-input {
    box-sizing: border-box;
}

.table td input.app-input {
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.table td select.app-input {
    margin-right: 0;
}

.table td:last-child {
    padding-right: var(--space-12);
}

.table td.saving input.app-input {
    background-color: var(--color-success-light) !important;
    transition: background-color 0.5s ease-out;
}

/* Reserve space for status message to prevent table jumping */
.status-message-placeholder {
    min-height: 58px;
    margin-bottom: var(--space-16);
}

/* ==========================================================================
   SOLL/IST GRID CELL (ExecutedPage — read-only SOLL column)
   ========================================================================== */

.cell-soll {
    background-color: var(--color-background);
    color: var(--color-text-muted);
}

.rds-cell-input {
    width: 80%;
}

/* ==========================================================================
   FILTER SECTION (moved from RoomProgramPage + ExecutedPage <style> blocks)
   ========================================================================== */

.rds-filter-section {
    background: var(--color-background);
    padding: var(--space-16);
    border-radius: var(--radius-medium);
    margin-bottom: var(--space-20);
}

.rds-column-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-10);
    margin-top: var(--space-10);
}

.rds-column-toggle-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* ==========================================================================
   PROGRAM TABLE (moved from RoomProgramPage <style> block)
   ========================================================================== */

.rds-program-table {
    min-width: 1200px;
}

.rds-program-table th {
    position: sticky;
    top: 0;
    background: var(--color-surface);
    z-index: 10;
    font-weight: 600;
    white-space: nowrap;
}

.rds-program-table td {
    white-space: nowrap;
}

.rds-table-container {
    overflow-x: auto;
    max-width: 100%;
}

/* ==========================================================================
   EDITABLE INPUT (moved from RoomProgramPage <style> block)
   ========================================================================== */

.editable-input {
    width: 80%;
    border: 1px solid var(--color-border);
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-small);
    transition: border-color 0.2s, background-color 0.5s;
}

.editable-input:focus {
    outline: none;
    border: 1px solid var(--color-primary);
    background-color: var(--color-background);
}

.editable-input.saving {
    background-color: var(--color-success-light) !important;
    border-color: var(--color-success);
}

/* ==========================================================================
   ANALYSIS ROW COLORS (moved from AnalysisPage <style> block)
   ========================================================================== */

.rds-row-fulfilled { background-color: var(--color-success-light) !important; }
.rds-row-under     { background-color: var(--color-error-light) !important; }
.rds-row-over      { background-color: var(--color-warning-light) !important; }

/* ==========================================================================
   TOLERANCE LEGEND SPANS (SettingsPage)
   ========================================================================== */

.rds-tolerance-color-under  { background-color: var(--color-error-light); }
.rds-tolerance-color-within { background-color: var(--color-success-light); }
.rds-tolerance-color-over   { background-color: var(--color-warning-light); }

/* ==========================================================================
   WIDTH HELPERS
   ========================================================================== */

.rds-form-narrow    { max-width: 300px; }
.rds-form-medium    { max-width: 500px; }
.rds-building-select { width: 300px; }

/* ==========================================================================
   COLUMN WIDTH HELPERS (ManagerPage tables)
   ========================================================================== */

.rds-col-actions { width: 80px; }
.rds-col-name    { width: 220px; }
.rds-col-count   { width: 100px; text-align: center; }

/* ==========================================================================
   MISC MODULE HELPERS
   ========================================================================== */

.rds-table-subheader {
    background-color: var(--color-background);
    font-weight: 600;
}

.rds-divider {
    border-top: 1px solid var(--color-border);
    margin: var(--space-16) 0;
}

/* Building default IFC hint row */
.rds-building-ifc-default-row {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    padding: var(--space-8) var(--space-12);
    background: var(--color-info-light, #e8f4fd);
    border: 1px solid var(--color-info, #17a2b8);
    border-radius: var(--radius-small);
    font-size: 0.9rem;
}

.rds-logo-preview {
    height: 40px;
    object-fit: contain;
}

.rds-input-grow {
    flex: 1;
    min-width: 200px;
}

.rds-page-header-icon {
    height: 32px;
    margin-right: var(--space-8);
}

.rds-input-code {
    width: 120px;
}

/* ==========================================================================
   Import / Export section (Session 5)
   ========================================================================== */

.rds-import-export-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-24);
}

@media (max-width: 900px) {
    .rds-import-export-grid {
        grid-template-columns: 1fr;
    }
}

.rds-import-export-subcard {
    padding: var(--space-16);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-background);
}

.rds-import-export-subcard h5 {
    margin: 0 0 var(--space-12) 0;
    font-weight: 600;
}

.rds-import-export-field {
    margin-bottom: var(--space-12);
}

.rds-import-export-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: var(--space-4);
    color: var(--color-text-muted, #666);
}

/* IFC mapping editor
   ========================================================================== */

.rds-ifc-mapping-editor {
    margin-top: var(--space-12);
}

.rds-ifc-mapping-header,
.rds-ifc-mapping-row {
    display: grid;
    grid-template-columns: 200px 140px 1fr;
    gap: var(--space-8);
    align-items: center;
    margin-bottom: var(--space-8);
}

.rds-ifc-mapping-header {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-muted, #666);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-4);
}

.rds-ifc-mapping-col-target {
    font-size: 0.9rem;
}

/* Grid columns 2 and 3 of the mapping row — kind selector and path selector */
.rds-ifc-mapping-col-kind {
    min-width: 0;
}

.rds-ifc-mapping-col-path {
    min-width: 0;
}

/* Import error/warning list (Session 6)
   ========================================================================== */

.rds-import-error-list {
    max-height: 180px;
    overflow-y: auto;
    margin-top: var(--space-8);
    font-size: 0.85rem;
    font-family: var(--font-mono, monospace);
}

.rds-import-error-row {
    padding: 2px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.rds-import-error-row:last-child {
    border-bottom: none;
}

/* Inline title + help button row (Session 7 Change 7)
   ========================================================================== */

.rds-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.rds-title-row h1,
.rds-title-row h2,
.rds-title-row h3 {
    margin-bottom: 0;
}

/* Action buttons group at the trailing end of a title row */
.rds-title-row-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

/* Collapsible section header (Session 7 Change 2)
   ========================================================================== */

.rds-section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.rds-section-header-row h3 {
    margin-bottom: 0;
}

.rds-collapse-btn {
    background: none;
    border: none;
    padding: var(--space-4);
    cursor: pointer;
    color: var(--color-text-secondary, #666);
    line-height: 1;
    font-size: 1.1rem;
    border-radius: var(--radius-small);
    transition: background-color 0.15s;
}

.rds-collapse-btn:hover {
    background-color: var(--color-hover-bg, rgba(0,0,0,0.05));
}

/* Inline filter row with fixed-width controls (Session 7 Changes 4, 6)
   ========================================================================== */

.rds-filter-inline-row {
    display: flex;
    align-items: flex-end;
    gap: var(--space-16);
    flex-wrap: wrap;
    margin-bottom: var(--space-12);
}

.rds-filter-control-fixed {
    width: 300px;
    flex-shrink: 0;
}

.rds-filter-control-fixed label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: var(--space-4);
}

/* Compact contextual filter controls (Target Area / Planned Net / Status)
   placed between the Room Type dropdown and search field */
.rds-filter-control-compact {
    flex-shrink: 0;
    min-width: 140px;
}

.rds-filter-control-compact label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted, #666);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-4);
    white-space: nowrap;
}

/* Narrow (auto-sized) filter control — for action buttons aligned to bottom */
.rds-filter-control-narrow {
    flex-shrink: 0;
    align-self: flex-end;
}

/* Button + refresh button inline row (Import/Export section)
   ========================================================================== */

.rds-import-export-btn-row {
    display: flex;
    align-items: center;
    gap: var(--space-8, 8px);
}

.rds-import-progress-row {
    display: flex;
    align-items: center;
    gap: var(--space-8, 8px);
    padding: var(--space-8, 8px) 0;
    color: var(--color-text-secondary, #555);
    font-size: 14px;
}

/* ==========================================================================
   DISTRIBUTION TABLE (Session 6 — Inventory feature)
   ========================================================================== */

.rds-dist-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-16);
    align-items: flex-end;
    margin-bottom: var(--space-16);
}

.rds-dist-filter-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 180px;
}

.rds-dist-filter-item label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.rds-dist-tolerance-row {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    flex-wrap: wrap;
    margin-bottom: var(--space-12);
    padding: var(--space-8) var(--space-12);
    background: var(--color-background);
    border-radius: var(--radius-small);
    border: 1px solid var(--color-border-subtle);
}

.rds-dist-table {
    min-width: 1100px;
}

.rds-dist-table th {
    position: sticky;
    top: 0;
    background: var(--color-surface);
    z-index: 10;
    font-weight: 600;
    white-space: nowrap;
}

.rds-dist-table .rds-dist-editable {
    width: 80px;
    border: 1px solid var(--color-border);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-small);
    transition: border-color 0.2s, background-color 0.5s;
    text-align: center;
}

.rds-dist-table .rds-dist-editable:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: var(--color-background);
}

.rds-dist-table .rds-dist-editable.saving {
    background-color: var(--color-success-light) !important;
    border-color: var(--color-success);
}

.rds-dist-comment-input {
    width: 140px;
}

.rds-dist-status-missing { color: var(--color-text-secondary); font-weight: 600; }
.rds-dist-status-ok      { color: var(--color-success);        font-weight: 600; }
.rds-dist-status-under   { color: var(--color-error);          font-weight: 600; }
.rds-dist-status-over    { color: var(--color-warning-dark, #b45309); font-weight: 600; }

.rds-dist-tolerance-input {
    width: 80px;
}

.rds-dist-export-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--space-8);
}

/* ==========================================================================
   LIST TAB — two-panel layout (Session 7 — Inventory feature)
   ========================================================================== */

.rds-list-top-bar {
    margin-bottom: var(--space-8);
}

.rds-table-no-pad {
    padding: 0;
}

.rds-list-layout {
    display: flex;
    gap: var(--space-16);
    align-items: flex-start;
}

@media (max-width: 900px) {
    .rds-list-layout {
        flex-direction: column;
    }

    .rds-list-tree-panel {
        width: 100% !important;
    }
}

.rds-list-tree-panel {
    width: 280px;
    flex-shrink: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-medium);
    padding: var(--space-12);
    max-height: 70vh;
    overflow-y: auto;
}

.rds-list-table-panel {
    flex: 1;
    min-width: 0;
}

/* Tree nodes */
.rds-tree-building {
    margin-bottom: var(--space-8);
}

.rds-tree-building-header,
.rds-tree-roomtype-header,
.rds-tree-room-row {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    padding: 2px 0;
    cursor: default;
    user-select: none;
}

.rds-tree-building-header {
    font-weight: 600;
}

.rds-tree-roomtype-header {
    padding-left: var(--space-16);
    font-weight: 500;
}

.rds-tree-room-row {
    padding-left: calc(var(--space-16) * 2);
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.rds-tree-expand-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--color-text-muted);
    line-height: 1;
    font-size: 0.8rem;
    width: 14px;
    flex-shrink: 0;
}

.rds-tree-room-row .rds-tree-expand-btn {
    visibility: hidden;  /* leaf nodes — placeholder to keep alignment */
}

.rds-list-search-row {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}

.rds-list-search-row input {
    flex: 1;
}

.rds-list-scope-info {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
}

.rds-list-table th {
    position: sticky;
    top: 0;
    background: var(--color-surface);
    z-index: 10;
    font-weight: 600;
    white-space: nowrap;
}

.rds-list-rooms-count {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

.rds-list-export-btn {
    margin-left: auto;
}

.rds-list-template-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-8);
    margin-top: var(--space-8);
    padding-top: var(--space-8);
    border-top: 1px solid var(--color-border-subtle);
}

.rds-list-template-filter-label {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.rds-list-template-filter-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

/* ── IFC import section (Session 10) ─────────────────────────────────── */
.rds-ifc-import-section {
    margin-top: var(--space-16);
}

.rds-ifc-import-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-8);
}

.rds-ifc-import-title {
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

.rds-ifc-import-file-info {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.rds-ifc-import-actions {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    margin-top: var(--space-12);
}

.rds-ifc-import-hint {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* Label + select row for room-id field selection */
.rds-ifc-import-room-id-row {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    flex-wrap: wrap;
    margin-bottom: var(--space-8);
}

/* ── InventoryIfcMappingEditor component (Session 10) ─────────────────── */
.rds-ifc-map-editor {
    margin-top: var(--space-12);
}

.rds-ifc-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-8);
}

.rds-ifc-map-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.rds-ifc-map-loading {
    display: flex;
    justify-content: center;
    padding: var(--space-12);
}

.rds-ifc-map-empty {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    padding: var(--space-8) 0;
}

.rds-ifc-map-table {
    width: 100%;
    margin-bottom: var(--space-8);
}

.rds-ifc-map-add-form {
    margin-top: var(--space-8);
    background: var(--color-surface-alt, var(--color-surface));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-12);
}

.rds-ifc-map-form-row {
    display: flex;
    gap: var(--space-12);
    flex-wrap: wrap;
    margin-bottom: var(--space-8);
}

.rds-ifc-map-form-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 180px;
    flex: 1;
}

.rds-ifc-map-form-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.rds-ifc-map-form-actions {
    display: flex;
    gap: var(--space-8);
    align-items: center;
}

/* ── Packages placeholder ─────────────────────────────────────────────── */
.rds-packages-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 320px;
}

.rds-packages-placeholder-inner {
    text-align: center;
    max-width: 480px;
    padding: var(--space-32);
    color: var(--color-text-secondary);
}

.rds-packages-placeholder-icon {
    font-size: 3.5rem;
    color: var(--color-primary-muted, #ccc);
    display: block;
    margin-bottom: var(--space-16);
}

.rds-packages-placeholder-inner h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-8);
    color: var(--color-text-primary);
}

.rds-packages-placeholder-inner p {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ==========================================================================
   BCF MODAL (.rds-bcf-*) — Session 4
   ========================================================================== */

.rds-bcf-dialog {
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.rds-bcf-dialog .modal-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Search results dropdown inside BCF modal (assignee picker) */
.rds-bcf-dialog .search-results {
    max-height: 180px;
    overflow-y: auto;
}

/* Topic switcher dropdown row */
.rds-bcf-topic-switcher {
    border-bottom: 1px solid var(--color-border-subtle);
    padding-bottom: var(--space-12);
    margin-bottom: var(--space-12);
}

/* Room-context badge row shown below the topic switcher */
.rds-bcf-context-row {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}

.rds-bcf-context-label {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.rds-bcf-context-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    background: var(--color-primary-muted, #e8f0fe);
    color: var(--color-primary, #1a73e8);
    border-radius: var(--radius-small);
    padding: 2px var(--space-8);
}

/* Comments list inside the modal */
.rds-bcf-comments-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    margin-bottom: var(--space-12);
    max-height: 200px;
    overflow-y: auto;
}

.rds-bcf-comments-list .comment-item {
    background: var(--color-bg-subtle, #f8f9fa);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-small);
    padding: var(--space-8) var(--space-12);
}

.rds-bcf-comments-list .comment-meta {
    display: flex;
    gap: var(--space-8);
    margin-bottom: var(--space-4);
}

.rds-bcf-comments-list .comment-author {
    font-weight: 600;
    font-size: 0.8rem;
}

.rds-bcf-comments-list .comment-date {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.rds-bcf-comments-list .comment-text {
    font-size: 0.875rem;
    white-space: pre-wrap;
}

/* ==========================================================================
   NOTIFICATION PAGE (.rds-notification-*) — Session 5
   ========================================================================== */

.rds-notification-filters {
    flex-wrap: wrap;
    gap: var(--space-12);
    align-items: flex-end;
    margin-top: var(--space-12);
}

.rds-notification-grid-card {
    padding: 0;
    overflow: hidden;
}

.rds-notification-datagrid {
    width: 100%;
}

/* Cursor pointer for clickable rows */
.rds-notification-datagrid .mud-table-row {
    cursor: pointer;
}

/* Empty state */
.rds-notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-48, 48px) var(--space-24);
    color: var(--color-text-secondary);
}

.rds-notification-empty-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-12);
    color: var(--color-primary-muted, #ccc);
}

/* ==========================================================================
   BCF STATUS + PRIORITY BADGES — Session 5
   ========================================================================== */

.rds-bcf-status-badge,
.rds-bcf-priority-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-small, 4px);
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    background-color: var(--color-grey-400, #9e9e9e);
}

/* Status colours */
.rds-bcf-status-new {
    background-color: var(--bcf-status-new, #2f80ed);
}

.rds-bcf-status-in-progress {
    background-color: var(--bcf-status-in-progress, #f2b705);
}

.rds-bcf-status-waiting {
    background-color: var(--bcf-status-waiting, #e65f38);
}

.rds-bcf-status-done {
    background-color: var(--bcf-status-done, #27ae60);
}

.rds-bcf-status-closed {
    background-color: var(--bcf-status-closed, #2bb0c8);
}

/* Priority colours */
.rds-bcf-priority-critical {
    background-color: var(--color-danger, #d32f2f);
}

.rds-bcf-priority-high {
    background-color: var(--color-warning, #f57c00);
}

.rds-bcf-priority-normal {
    background-color: var(--color-primary, #1a73e8);
}

.rds-bcf-priority-low {
    background-color: var(--color-grey-500, #9e9e9e);
}

/* ==========================================================================
   BCF ROW BADGE — Session 6
   ========================================================================== */

/* Inline badge / button inside RoomProgram and Executed table rows */
.rds-bcf-row-badge {
    display: inline-block;
    padding: 2px 7px;
    border: none;
    border-radius: var(--radius-small, 4px);
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    cursor: pointer;
    background-color: var(--color-grey-400, #9e9e9e);
    line-height: 1.4;
}

.rds-bcf-row-badge:hover {
    filter: brightness(1.1);
}

/* Colours reuse the same custom properties as the full badges */
.rds-bcf-row-badge.rds-bcf-status-new         { background-color: var(--bcf-status-new, #2f80ed); }
.rds-bcf-row-badge.rds-bcf-status-in-progress { background-color: var(--bcf-status-in-progress, #f2b705); }
.rds-bcf-row-badge.rds-bcf-status-waiting     { background-color: var(--bcf-status-waiting, #e65f38); }
.rds-bcf-row-badge.rds-bcf-status-done        { background-color: var(--bcf-status-done, #27ae60); }
.rds-bcf-row-badge.rds-bcf-status-closed      { background-color: var(--bcf-status-closed, #2bb0c8); }


/* ── Settings: IFC file picker row ─────────────────────────────────────── */
.rds-ifc-file-picker-row {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    flex-wrap: wrap;
    margin-top: var(--space-4);
}

.rds-ifc-file-name {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* ── Export page ────────────────────────────────────────────────────────── */
.rds-export-config-row {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    flex-wrap: wrap;
    margin-bottom: var(--space-12);
}

.rds-export-mapping-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--space-8);
}

.rds-export-mapping-table th,
.rds-export-mapping-table td {
    padding: var(--space-6) var(--space-8);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

.rds-export-mapping-table th {
    font-weight: 600;
    background: var(--color-surface-alt, #f5f5f5);
}

.rds-export-run-row {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    flex-wrap: wrap;
    margin-top: var(--space-12);
}


/* ── RoomProgram: area-target contextual row (Session 4) ──────────────────── */
.rds-area-target-row {
    display: flex;
    align-items: flex-end;
    gap: var(--space-16);
    flex-wrap: wrap;
    padding: var(--space-8) 0;
    margin-top: var(--space-8);
    border-top: 1px solid var(--color-border);
}

.rds-area-target-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.rds-area-target-item label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted, #666);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rds-area-target-input-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.rds-area-target-input {
    width: 110px;
}

/* Read-only planned net sum styled identically to the editable target area input */
.rds-area-target-planned {
    background-color: var(--color-surface-alt, #f5f5f5);
    cursor: default;
}

/* Status field - same height/width as the target area and planned net sum inputs */
.rds-area-target-status-field {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 110px;
    min-height: 34px;
    box-sizing: border-box;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm, 4px);
}

/* Inline status colour variants (replaces indicator-card on the filter-row span) */
.rds-area-target-status-indicator-too-little {
    background-color: var(--color-error-light);
    border-color: var(--color-danger, #dc3545);
    color: var(--color-danger, #dc3545);
}

.rds-area-target-status-indicator-in-tolerance {
    background-color: var(--color-success-light);
    border-color: var(--color-success, #198754);
    color: var(--color-success, #198754);
}

.rds-area-target-status-indicator-too-much {
    background-color: var(--color-warning-light);
    border-color: var(--color-warning, #ffc107);
    color: var(--color-text-primary);
}

.rds-area-target-status-empty {
    border: 1px solid var(--color-border, #ccc);
    color: var(--color-text-muted, #999);
}

.rds-area-target-unit {
    font-size: 0.875rem;
    color: var(--color-text-muted, #666);
}

.rds-area-target-value {
    font-size: 1rem;
    font-weight: 600;
    padding: var(--space-4) 0;
}

.rds-area-target-badge {
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-sm, 4px);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ── RoomProgram view-mode toggle (Session 5) ──────────────────────────────── */
.rds-building-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: var(--space-12, 12px);
}

.rds-mode-btn-group {
    display: flex;
    gap: 0;
}

.rds-mode-btn {
    padding: var(--space-6, 6px) var(--space-16, 16px);
    border: 1px solid var(--color-border, #ccc);
    background: var(--color-surface, #fff);
    color: var(--color-text, #333);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.rds-mode-btn:first-child {
    border-radius: var(--radius-sm, 4px) 0 0 var(--radius-sm, 4px);
}

.rds-mode-btn:last-child {
    border-radius: 0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0;
    border-left: none;
}

.rds-mode-btn-active {
    background: var(--color-primary, #1976d2);
    color: #fff;
    border-color: var(--color-primary, #1976d2);
    font-weight: 600;
}

.rds-mode-btn:not(.rds-mode-btn-active):hover {
    background: var(--color-surface-hover, #f0f0f0);
}

/* ── RoomTypes overview table target-area inline edit (Session 5) ─────────── */
.rds-overview-target-input {
    width: 90px;
    text-align: right;
    padding: 2px 4px;
    border: 1px solid var(--color-border, #ccc);
    border-radius: var(--radius-sm, 4px);
    font-size: 0.875rem;
}

.rds-overview-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm, 4px);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ── Inventory 3-column grid (Session 6) ──────────────────────────────────── */
.rds-inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px 16px;
}

@media (max-width: 640px) {
    .rds-inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

.rds-inventory-check-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Session 7: utility classes used by IFC Export UI */
.app-form-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-4, 4px);
}

.app-muted {
    color: var(--mud-palette-text-secondary, #888);
    font-size: 0.875rem;
}

/* ── History: Row 1 — field + mode selector side by side ──────── */
.rds-history-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-16);
    align-items: flex-start;
    margin-bottom: var(--space-12);
}

.rds-history-controls-row > .app-form-row {
    flex: 1 1 200px;
}

/* ── History: Row 2 — date pickers + action buttons ──────────── */
.rds-history-date-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-8);
    align-items: flex-end;
    margin-bottom: var(--space-12);
}

.rds-history-date-actions-row > .app-form-row {
    flex: 0 0 auto;
}

.rds-history-action-buttons {
    display: flex;
    gap: var(--space-8);
    align-items: center;
    padding-bottom: 2px;
}

/* ── Export: Config two-row layout ───────────────────────────── */
.rds-export-config-two-rows {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}

.rds-export-config-input-row {
    display: flex;
    gap: var(--space-8);
    align-items: flex-end;
}

.rds-export-config-input-row > .app-form-row {
    flex: 1;
    min-width: 0;
}

/* ── Export: Building + IFC buttons on one row ───────────────── */
.rds-export-ifc-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-8);
    align-items: flex-end;
    margin-bottom: var(--space-4);
}

.rds-export-ifc-building-col {
    flex: 1 1 200px;
}

/* ── Export: Matching two-column grid ────────────────────────── */
.rds-export-matching-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-16);
    margin-bottom: var(--space-12);
}

/* ── Export: Output folder + filename on one row ─────────────── */
.rds-export-output-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-8);
    align-items: flex-end;
    margin-bottom: var(--space-12);
}

.rds-export-output-row > .app-form-row {
    flex: 1 1 200px;
}

/* Folder select + refresh icon inline */
.rds-export-folder-select-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* ── Simple inline modal overlay ──────────────────────────────────── */
.rds-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.rds-modal-dialog {
    background: var(--mud-palette-surface, #fff);
    border-radius: 8px;
    padding: 24px;
    min-width: 320px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.rds-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* ── IST cell with copy button ────────────────────────────────────── */
.rds-ist-cell {
    display: flex;
    align-items: center;
    gap: 2px;
}

.rds-ist-cell .rds-cell-input {
    flex: 1;
    min-width: 0;
}



.rds-copy-soll-btn {
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    color: var(--mud-palette-text-secondary, #888);
    border-radius: 3px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}

.rds-copy-soll-btn:hover {
    color: var(--mud-palette-primary, #1976d2);
}

/* ── Manager page: action button row ────────────────────────── */
.rds-action-btn-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
}

/* ── History page ────────────────────────────────────────────── */
.rds-history-date-picker {
    max-width: 200px;
}

/* ── History page: right-side form panel ─────────────────────── */
.rds-history-form-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── History page: compare-mode delta ────────────────────────── */
.rds-history-mode-group {
    display: flex;
    gap: 0;
}

.rds-history-delta {
    display: inline-block;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.rds-history-delta--positive {
    color: #1a5c2e;
    background-color: var(--color-success-light, #d4edda);
}

.rds-history-delta--negative {
    color: #7b1b1b;
    background-color: var(--color-error-light, #fde8e8);
}

.rds-history-delta--zero {
    color: var(--mud-palette-text-secondary, #6c757d);
    background-color: transparent;
}

.rds-history-delta--unchanged {
    color: var(--mud-palette-text-secondary, #6c757d);
    background-color: transparent;
}

.rds-history-delta--changed {
    color: #6b4c00;
    background-color: var(--color-warning-light, #fff3cd);
}
