/* xFM UI — sistema visual compartido por las aplicaciones web. */
:root {
    --xfm-bg: #f6f8fb;
    --xfm-surface: #ffffff;
    --xfm-panel: #ffffff;
    --xfm-border: #dce3ec;
    --xfm-text: #172033;
    --xfm-muted: #5d6b82;
    --xfm-primary: #1669c9;
    --xfm-primary-strong: #0f56a7;
    --xfm-primary-soft: #eaf3ff;
    --xfm-success: #16835a;
    --xfm-warning: #a86108;
    --xfm-danger: #c2364d;
    --bg: var(--xfm-bg);
    --surface: var(--xfm-surface);
    --panel: var(--xfm-panel);
    --border: var(--xfm-border);
    --text: var(--xfm-text);
    --muted: var(--xfm-muted);
    --primary: var(--xfm-primary);
    --danger: var(--xfm-danger);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
body { background: var(--xfm-bg); color: var(--xfm-text); line-height: 1.5; }
a { color: var(--xfm-primary); }

.topbar {
    min-height: 64px;
    height: auto;
    padding: .65rem 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid var(--xfm-border);
    box-shadow: 0 1px 2px rgb(23 32 51 / 4%);
}
.brand { color: #172033; font-size: 19px; letter-spacing: -.02em; }
.brand span, .project-name, .muted { color: var(--xfm-muted); }
.topbar-actions { flex-wrap: wrap; gap: .5rem; }
.topbar .project-selector, .culture-selector, .language-select {
    width: auto;
    min-height: 38px;
    padding: .4rem .65rem;
    color: var(--xfm-text);
    background: #fff;
    border-color: var(--xfm-border);
    border-radius: 8px;
}
.culture-selector option { color: var(--xfm-text); background: #fff; }

.sidebar {
    background: #fff;
    border-right-color: var(--xfm-border);
    box-shadow: 1px 0 2px rgb(23 32 51 / 2%);
}
.sidebar a, .sidebar span:not(.menu-caption) { color: #4d5d75; border-radius: 8px; }
.sidebar a:hover, .sidebar a.active { color: #104f99; background: var(--xfm-primary-soft); }
.menu-caption { color: #78879c; font-size: 10px; letter-spacing: .08em; }
.main-content { background: var(--xfm-bg); padding: 2rem; }

h1, h2, h3 { color: var(--xfm-text); letter-spacing: -.02em; }
h1 { font-size: clamp(1.55rem, 2vw, 2rem); line-height: 1.2; }
h2 { font-size: 1.1rem; line-height: 1.35; }
.page-heading { margin-bottom: 1rem; }
.lead { max-width: 70ch; color: var(--xfm-muted); }

.panel, .lookup-panel, .selection-card, .membership-members, .cards article, .login-card {
    background: var(--xfm-surface);
    border-color: var(--xfm-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgb(23 32 51 / 3%), 0 5px 16px rgb(23 32 51 / 3%);
}
.cards article { transition: box-shadow .16s ease, transform .16s ease; }
.cards article:hover { box-shadow: 0 8px 24px rgb(23 32 51 / 8%); transform: translateY(-1px); }
.panel-title { padding-bottom: .75rem; border-bottom: 1px solid #edf1f6; }

button, .rz-button, .button-link {
    min-height: 38px;
    padding: .45rem .75rem;
    color: #fff;
    background: var(--xfm-primary);
    border: 1px solid var(--xfm-primary);
    border-radius: 8px;
    box-shadow: none;
    font-size: .875rem;
    font-weight: 650;
}
button:hover:not(:disabled), .rz-button:hover:not(:disabled), .button-link:hover { background: var(--xfm-primary-strong); border-color: var(--xfm-primary-strong); }
.secondary, .secondary-button, .link-button { color: #1b579e; background: #fff; border-color: #b8cbe3; }
.secondary:hover:not(:disabled), .secondary-button:hover:not(:disabled), .link-button:hover:not(:disabled) { color: #0f4d94; background: var(--xfm-primary-soft); border-color: #8db5e2; }
.danger-button, .danger { color: var(--xfm-danger); background: #fff; border-color: #efb9c4; }
.danger-button:hover:not(:disabled), .danger:hover:not(:disabled) { color: #9e1d35; background: #fff0f2; border-color: #e38597; }
button:disabled { opacity: .5; }

input, select, textarea, .rz-textbox, .rz-dropdown, .rz-numeric-input input, .assignment-select, .role-select {
    min-height: 38px;
    color: var(--xfm-text) !important;
    background: #fff !important;
    border: 1px solid #bdc9d8 !important;
    border-radius: 8px;
    font: inherit;
}
.rz-numeric { display: flex; min-height: 38px; overflow: hidden; border: 1px solid #bdc9d8; border-radius: 8px; background: #fff; }
.rz-numeric .rz-numeric-input { min-height: 36px; border: 0 !important; border-radius: 0 !important; }
.rz-numeric .rz-numeric-button { display: flex; align-items: center; justify-content: center; min-width: 2rem; min-height: 0; height: 18px; padding: 0; color: #fff !important; background: var(--xfm-primary) !important; border: 0 !important; border-left: 1px solid #0f5cad !important; border-radius: 0 !important; }
.rz-numeric .rz-numeric-button:first-of-type { inset-block-start: 0 !important; inset-block-end: auto !important; }
.rz-numeric .rz-numeric-button:last-of-type { inset-block-start: auto !important; inset-block-end: 0 !important; border-top: 1px solid #0f5cad !important; border-radius: 0 0 7px 0 !important; }
.rz-numeric .rz-numeric-button:hover:not(:disabled) { background: var(--xfm-primary-strong) !important; }
textarea { min-height: 6rem; padding: .55rem .65rem; }
.form-field label { color: #46556d; font-size: .8rem; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid #82b9f5;
    outline-offset: 2px;
}

.rz-datatable, .rz-data-grid { background: #fff !important; border-color: var(--xfm-border) !important; border-radius: 10px; overflow: hidden; }
.rz-datatable-thead th, .rz-datatable-thead th *, .rz-data-grid th, .rz-data-grid th *, .rz-datatable-thead th.rz-sortable-column {
    color: #24344d !important;
    background: #f5f8fc !important;
    border-color: var(--xfm-border) !important;
    font-size: .78rem;
    font-weight: 750 !important;
}
.rz-datatable-data td, .rz-data-grid td { color: #26364f !important; background: #fff !important; border-color: #e7edf4 !important; font-size: .875rem; }
.rz-datatable-data td *, .rz-data-grid td * { color: #26364f !important; }
.rz-datatable-data td .link-button, .rz-data-grid td .link-button { color: #1b579e !important; }
.rz-datatable-data td .danger, .rz-data-grid td .danger { color: var(--xfm-danger) !important; }
/* Las acciones de una fila son secundarias; la acción principal queda en la barra de la vista. */
.rz-datatable-data td button:not(.danger):not(.danger-button), .rz-data-grid td button:not(.danger):not(.danger-button), .rz-datatable-data td .rz-button:not(.danger):not(.danger-button), .rz-data-grid td .rz-button:not(.danger):not(.danger-button) { color: #1b579e !important; background: #ffffff !important; border-color: #b8cbe3 !important; }
.rz-datatable-data td button:not(.danger):not(.danger-button) *, .rz-data-grid td button:not(.danger):not(.danger-button) *, .rz-datatable-data td .rz-button:not(.danger):not(.danger-button) *, .rz-data-grid td .rz-button:not(.danger):not(.danger-button) * { color: #1b579e !important; }
.rz-datatable-data td button:not(.danger):not(.danger-button):hover, .rz-data-grid td button:not(.danger):not(.danger-button):hover, .rz-datatable-data td .rz-button:not(.danger):not(.danger-button):hover, .rz-data-grid td .rz-button:not(.danger):not(.danger-button):hover { background: var(--xfm-primary-soft) !important; border-color: #8db5e2 !important; }
.rz-datatable-data tr:hover td, .rz-data-grid tr:hover td { background: #f7fbff !important; }
.rz-paginator { background: #fff !important; border-color: var(--xfm-border) !important; }
.rz-cell-filter input { background: #fff !important; }

.lookup-list-item, .lookup-list-item:hover {
    color: #26364f;
    background: #fff;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
}
.lookup-list-item small, .lookup-list-item em { color: #596b83; }
.lookup-list-item:hover:not(.selected) { color: #234b78 !important; background: #f2f7fd !important; border-color: #c6dbf2 !important; }
.lookup-list-item:hover:not(.selected) small, .lookup-list-item:hover:not(.selected) em { color: #52708f !important; }
.lookup-list-item.selected { color: #173f6b !important; background: #dceeff !important; border-color: #82afe0 !important; }
.lookup-list-item.selected small, .lookup-list-item.selected em { color: #315d8e !important; }

/* Fichas de jerarquía: el nombre traducido nunca compite con el código. */
.hierarchy-list-item { display: flex; flex-direction: column; gap: .22rem; min-width: 0; font-size: .78rem; }
.hierarchy-list-item strong { min-width: 0; overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.hierarchy-list-meta { display: flex; min-width: 0; align-items: baseline; gap: .4rem; }
.hierarchy-list-meta small { min-width: 0; overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.hierarchy-list-meta em { flex: 0 0 auto; font-size: .7rem; font-style: normal; }
.panel-context { margin: -.45rem 0 .8rem; font-size: .78rem; line-height: 1.35; }
.association-help { margin: -.2rem 0 .7rem; font-size: .75rem; line-height: 1.35; }

/* Organización: tres áreas paralelas; la asignación queda a la derecha. */
.organization-layout { grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.1fr) minmax(320px, 1fr); align-items: stretch; }
.organization-layout > .organization-nodes { grid-column: 2; grid-row: 1; }
.organization-layout > .organization-assignment-panel { grid-column: 3; grid-row: 1; }
.organization-layout > .lookup-panel:first-child, .organization-layout > .organization-nodes { height: min(34rem, calc(100vh - 10rem)); display: flex; flex-direction: column; min-height: 22rem; }
.organization-layout > .lookup-panel:first-child .lookup-list-items, .organization-layout > .organization-nodes > .asset-type-tree { min-height: 0; flex: 1; overflow: auto; padding-right: .25rem; }
.organization-assignment-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1rem; align-items: end; }
.organization-assignment-form .form-field { margin: 0; }
.organization-assignment-confirm { grid-column: 1 / -1; justify-self: end; min-width: 10rem; }
@media (max-width: 900px) {
    .organization-layout > .organization-nodes, .organization-layout > .organization-assignment-panel { grid-column: auto; grid-row: auto; }
    .organization-assignment-form { grid-template-columns: 1fr; }
    .organization-assignment-confirm { justify-self: start; }
    .organization-layout > .lookup-panel:first-child, .organization-layout > .organization-nodes { height: auto; min-height: 0; }
    .organization-layout > .lookup-panel:first-child .lookup-list-items, .organization-layout > .organization-nodes > .asset-type-tree { overflow: visible; }
}

/* Tipos de activo: se reserva el ancho para la tabla de propiedades. */
.asset-types-layout { grid-template-columns: minmax(230px, .55fr) minmax(600px, 1.5fr); }
.property-row-actions { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: .35rem; min-width: max-content; white-space: nowrap; }
.property-row-actions button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.25rem; margin: 0; white-space: nowrap; }
.asset-types-layout .tree-item { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: .1rem .5rem; align-items: center; }
.asset-types-layout .tree-item strong { grid-column: 1; grid-row: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-types-layout .tree-item small { grid-column: 1; grid-row: 2; overflow: hidden; color: #596b83; text-overflow: ellipsis; white-space: nowrap; }
.asset-types-layout .tree-item em { grid-column: 2; grid-row: 1 / 3; color: #4b6380; font-size: .75rem; }
.asset-type-tree .tree-item:hover:not(.selected) { color: #234b78 !important; background: #f2f7fd !important; border-color: #c6dbf2 !important; }
.asset-type-tree .tree-item:hover:not(.selected) strong { color: #234b78 !important; }
.asset-type-tree .tree-item:hover:not(.selected) small, .asset-type-tree .tree-item:hover:not(.selected) em { color: #52708f !important; }
.asset-type-tree .tree-item.selected { color: #173f6b !important; background: #dceeff !important; border-color: #82afe0 !important; }
.asset-type-tree .tree-item.selected strong { color: #173f6b !important; }
.asset-type-tree .tree-item.selected small, .asset-type-tree .tree-item.selected em { color: #315d8e !important; }

/* Asociaciones de jerarquía organizativa. */
.organization-assignments article { background: #ffffff; border-color: #dbe4ee; border-radius: 8px; }
.organization-assignments article strong { color: #26364f; }
.organization-assignments article small { color: #596b83; }
.organization-assignments .badge { color: #1b579e; background: #eaf3ff; border-color: #8db5e2; }

.hierarchy-workspace { display: grid; grid-template-columns: minmax(360px, 460px) minmax(720px, 1fr); gap: 1rem; align-items: start; }
.hierarchy-tree-panel { width: 100%; max-width: none; overflow-x: auto; }
.hierarchy-inspector { position: sticky; top: 1rem; min-height: 14rem; padding: 1rem; }
.hierarchy-inspector h2 { margin: 0; }
.hierarchy-inspector .panel-title { align-items: start; gap: 1rem; }
.hierarchy-inspector .eyebrow { margin-bottom: .3rem; }
.hierarchy-tree-panel .asset-type-tree { margin-top: .85rem; }
.hierarchy-tree-panel .asset-type-tree ul { margin: .15rem 0 .15rem .35rem; padding-left: .4rem; }
.hierarchy-tree-panel .asset-type-tree li { grid-template-columns: 1.2rem minmax(0, 1fr); margin: .12rem 0; }
.hierarchy-tree-panel .asset-type-tree li > ul { grid-column: 2; }
.hierarchy-tree-panel .tree-row { grid-template-columns: 1.2rem minmax(0, 1fr); }
.hierarchy-tree-panel .tree-toggle, .hierarchy-tree-panel .tree-toggle-placeholder { width: 1.1rem; height: 1.25rem; font-size: 15px; }
.hierarchy-tree-panel .tree-item { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: .1rem .5rem; align-items: center; }
.hierarchy-tree-panel .tree-item strong { grid-column: 1; grid-row: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hierarchy-tree-panel .tree-item small { grid-column: 1; grid-row: 2; overflow: hidden; color: #596b83; text-overflow: ellipsis; white-space: nowrap; }
.hierarchy-tree-panel .tree-item em { grid-column: 2; grid-row: 1 / 3; color: #4b6380; font-size: .75rem; }
.hierarchy-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; margin: 1rem 0 0; }
.hierarchy-details div { min-width: 0; }
.hierarchy-details dt { color: #66768d; font-size: .75rem; font-weight: 700; }
.hierarchy-details dd { margin: .12rem 0 0; overflow: hidden; color: #26364f; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

.badge, .status-pill, .readonly-badge { border-radius: 999px; font-weight: 650; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1rem; }
.measurement-rule-actions { display: flex; flex-flow: row nowrap; align-items: center; justify-content: flex-start; gap: .75rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #edf1f6; }
.measurement-rule-preview-action, .measurement-rule-apply-action { display: flex; flex: 0 0 auto; }
.measurement-rule-preview-action { padding-right: .75rem; border-right: 1px solid #edf1f6; }
.measurement-rule-actions button { width: auto; white-space: nowrap; }
.measurement-exceptions-panel { overflow: hidden; }
.measurement-exceptions-grid { width: 100%; }
.measurement-exceptions-grid .measurement-category-select, .measurement-exceptions-grid .measurement-notes-input { width: 100%; min-width: 0; }
.measurement-exceptions-grid .measurement-save-button { width: 100%; padding-inline: .55rem; white-space: nowrap; }

/* Importación de activos */
.import-dropzone { position: relative; width: min(100%, 48rem); min-height: 8.25rem; margin: 1rem 0 .75rem; border: 2px dashed #a9c4e5; border-radius: .6rem; background: #f7fbff; transition: border-color .15s ease, background .15s ease; }
.import-dropzone:hover, .import-dropzone:focus-within { border-color: #1b72d0; background: #eef6ff; }
.import-dropzone.has-file { border-color: #2b8a5a; background: #f2fbf6; }
.import-dropzone input[type="file"] { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.import-dropzone input[type="file"]:disabled { cursor: wait; }
.import-dropzone-content { display: flex; min-height: 8.25rem; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; padding: 1rem; text-align: center; color: #52677f; }
.import-file-icon { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; color: #176ac3; background: #dcecff; font-size: 1.45rem; font-weight: 700; line-height: 1; }
.import-file-action { padding: .45rem .8rem; border-radius: .35rem; color: #fff; background: var(--xfm-primary); font-weight: 700; }
.import-file-hint { font-size: .875rem; }
.import-selected-file { display: flex; flex-wrap: wrap; gap: .3rem; align-items: baseline; margin: .75rem 0; color: #38536f; }
.import-selected-file > span:first-child { color: #24764d; font-weight: 700; }
.error { color: var(--xfm-danger); }
.success, .rule-success { color: var(--xfm-success); }
.system-footer { background: #fff; border-top-color: var(--xfm-border); }
.system-message.success { color: #0d6948; background: #ebf8f2; }
.system-message.error { color: #9e1d35; background: #fff0f2; }

.entity-modal { position: fixed; z-index: 1001; top: 50%; left: 50%; display: flex; flex-direction: column; width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); overflow: hidden; transform: translate(-50%, -50%); color: var(--xfm-text); background: #fff; border: 1px solid var(--xfm-border); border-radius: 12px; box-shadow: 0 20px 48px rgb(23 32 51 / 25%); }
.entity-modal header, .entity-modal footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; }
.entity-modal header { border-bottom: 1px solid #e7edf4; }
.entity-modal header h2 { margin: 0; }
.entity-modal-content { overflow-y: auto; padding: 1.25rem; }
.entity-modal-content .form-field { margin: 0 0 1rem; }
.entity-modal footer { justify-content: flex-end; border-top: 1px solid #e7edf4; }
.asset-editor-backdrop { position: fixed; z-index: 1200; inset: 0; background: rgb(23 38 58 / 48%); }
.asset-editor-modal { position: fixed; z-index: 1201; inset: 4vh max(1rem, calc((100vw - 1080px) / 2)); display: flex; flex-direction: column; max-width: 1080px; margin: auto; overflow: hidden; color: var(--xfm-text); background: #fff; border: 1px solid var(--xfm-border); border-radius: 12px; box-shadow: 0 20px 48px rgb(23 32 51 / 25%); }
.asset-editor-modal > header, .asset-editor-modal > footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; }
.asset-editor-modal > header { border-bottom: 1px solid #e7edf4; }
.asset-editor-modal > header h2 { margin: 0; }
.asset-editor-modal > header p { margin: .25rem 0 0; }
.asset-editor-modal > footer { justify-content: flex-end; border-top: 1px solid #e7edf4; }
.asset-editor-body { overflow-y: auto; padding: 1.1rem 1.25rem; }
.asset-editor-section + .asset-editor-section { margin-top: 1.15rem; padding-top: 1rem; border-top: 1px solid #e7edf4; }
.asset-editor-section h3 { margin: 0 0 .8rem; font-size: .95rem; }
.asset-editor-grid .editor-fieldset, .asset-editor-properties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .15rem 1rem; }
.asset-editor-properties .property { grid-template-columns: minmax(0, 1fr); }
.asset-editor-properties .property input, .asset-editor-properties .property select { width: 100%; }
.asset-editor-validation { margin-top: 1rem; padding: .75rem 1rem; border: 1px solid #efb9c4; border-radius: 8px; background: #fff0f2; }
.asset-editor-validation ul { margin: .35rem 0 0; padding-left: 1.25rem; }
.asset-information-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #e7edf4; }.asset-information-card h2 { margin: 0; }.asset-information-card header .muted { margin: .2rem 0 0; }.asset-information-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; margin: 1rem 0; }.asset-information-summary div, .asset-information-properties dl > div { min-width: 0; }.asset-information-summary dt, .asset-information-properties dt { color: #66768d; font-size: .75rem; font-weight: 700; }.asset-information-summary dd, .asset-information-properties dd { margin: .12rem 0 0; color: #26364f; overflow-wrap: anywhere; }.asset-information-properties { padding-top: .85rem; border-top: 1px solid #e7edf4; }.asset-information-properties h3 { margin: 0 0 .7rem; font-size: .95rem; }.asset-information-properties dl { display: grid; gap: .7rem; margin: 0; }.asset-information-properties dl > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; padding-bottom: .65rem; border-bottom: 1px solid #edf1f6; }.asset-information-properties dd { text-align: right; font-weight: 600; }.asset-information-properties small { color: #78879c; font-weight: 500; }@media (max-width: 650px) { .asset-information-summary { grid-template-columns: 1fr; }.asset-information-properties dl > div { grid-template-columns: 1fr; gap: .2rem; }.asset-information-properties dd { text-align: left; } }
.asset-information-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }.danger-button { color: var(--xfm-danger); background: #fff; border-color: #efb9c4; }.danger-button:hover:not(:disabled) { color: #9e1d35; background: #fff0f2; border-color: #e38597; }
.asset-selection-information > header > div:first-child { min-width: 0; flex: 1; }.asset-selection-information .asset-information-actions { flex-wrap: nowrap; }.asset-selection-information .asset-information-actions button { white-space: nowrap; }
.asset-information-locations { display: grid; gap: .75rem; margin: 1rem 0; padding-top: .85rem; border-top: 1px solid #e7edf4; }.asset-information-locations h3 { margin: 0; font-size: .95rem; }.asset-information-locations h4 { margin: 0 0 .35rem; color: #66768d; font-size: .75rem; }.asset-information-locations p { margin: 0; }.readonly-asset-tree { pointer-events: none; }.readonly-asset-tree .tree-filter { height: auto; max-height: 11rem; padding: .3rem; overflow: auto; border-color: #d7e1ec; background: #fff; }.readonly-asset-tree .tree-row { min-height: 1.55rem; grid-template-columns: 1.35rem minmax(0, 1fr); }.readonly-asset-tree .tree-toggle, .readonly-asset-tree .tree-toggle-placeholder { width: 1.1rem; height: 1.1rem; padding: 0; border-color: transparent; background: transparent; color: #1b579e; }.readonly-asset-tree .tree-node { min-height: 1.45rem; padding: .15rem .3rem; color: #34465e; font-size: .75rem; }.readonly-asset-tree .tree-node.selected { color: #104f99; background: #eaf3ff; box-shadow: inset 3px 0 0 var(--xfm-primary); }.mixed-value { grid-column: 1 / -1; }
.asset-selection-information .asset-information-summary { margin-bottom: .85rem; }
.required-marker { margin-left: .15rem; color: var(--xfm-danger); font-weight: 800; }.field-label-invalid { color: var(--xfm-danger) !important; }.field-label-invalid + input, .field-label-invalid + select { border-color: #dc7083 !important; background: #fff8f9 !important; }
.asset-context-editor .assignment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.asset-context-tree { display: flex; min-width: 0; min-height: 0; flex-direction: column; margin: 0; padding: .45rem .6rem .6rem; border-color: #d7e1ec; background: #fff; }
.asset-context-tree legend { color: #536982; }
.asset-context-tree > .muted { margin: 0 0 .45rem; font-size: .8rem; }
.asset-context-tree .tree-filter { height: 13rem; min-height: 0; overflow: auto; padding: .35rem; border-color: #d7e1ec; border-radius: 6px; background: #fff; }
.asset-context-tree .tree-node { min-height: 1.55rem; padding: .18rem .35rem; color: #34465e; font-size: .78rem; line-height: 1.25; }.asset-context-tree .tree-node:hover, .asset-context-tree .tree-node.selected { color: #104f99; background: #eaf3ff; }.asset-context-tree .tree-node.selected { box-shadow: inset 3px 0 0 var(--xfm-primary); }.asset-context-tree .tree-row { min-height: 1.65rem; grid-template-columns: 1.45rem minmax(0, 1fr); }.asset-context-tree .tree-toggle, .asset-context-tree .tree-toggle-placeholder { width: 1.2rem; min-width: 1.2rem; height: 1.2rem; min-height: 1.2rem; padding: 0; color: #1b579e; border-color: transparent; border-radius: 5px; background: transparent; font-size: 14px; line-height: 1; }.asset-context-tree .tree-toggle { display: inline-grid; place-items: center; }.asset-context-tree .tree-toggle:hover { color: #104f99; border-color: transparent; background: #eaf3ff; }
@media (max-width: 700px) { .asset-context-editor .assignment-grid { grid-template-columns: 1fr; } }
.asset-translation-backdrop { position: fixed; z-index: 1300; inset: 0; background: rgb(23 38 58 / 36%); }
.asset-translation-modal { position: fixed; z-index: 1301; top: 50%; left: 50%; display: flex; flex-direction: column; width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); overflow: hidden; transform: translate(-50%, -50%); color: var(--xfm-text); background: #fff; border: 1px solid var(--xfm-border); border-radius: 12px; box-shadow: 0 20px 48px rgb(23 32 51 / 25%); }
.asset-translation-modal > header, .asset-translation-modal > footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; }
.asset-translation-modal > header { border-bottom: 1px solid #e7edf4; }.asset-translation-modal > header h2 { margin: 0; }.asset-translation-modal > div { overflow-y: auto; padding: 1rem 1.25rem; }.asset-translation-modal > footer { justify-content: flex-end; border-top: 1px solid #e7edf4; }
@media (max-width: 700px) { .asset-editor-modal { inset: 0; border-radius: 0; } .asset-editor-grid .editor-fieldset, .asset-editor-properties { grid-template-columns: 1fr; } }

.translation-modal { color: var(--xfm-text); background: #fff; border-color: var(--xfm-border); border-radius: 12px; box-shadow: 0 20px 48px rgb(23 32 51 / 25%); }
.translation-modal .translation-key { color: #52647b; background: #f3f7fb; border: 1px solid #cbd9e8; }
.translation-modal .translation-key code { padding: .55rem .65rem; color: #28425f; background: #f3f7fb; border-color: #cbd9e8; border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .83rem; font-weight: 650; }
.translation-modal .translation-key-options { background: #fff; border-color: #dbe4ee; }
.translation-modal .translation-key-options button { color: #26364f; border-bottom-color: #e7edf4; }
.translation-modal .translation-key-options button:hover { background: #f2f7fd; }

/* Inventario WebClient: misma tabla clara que el sistema compartido. */
.inventory-list .asset-table { background: #fff; border-color: var(--xfm-border); border-radius: 8px; box-shadow: none; }
.inventory-list .asset-head { color: #3d506b; background: #f1f5fa; border-bottom: 1px solid var(--xfm-border); }
.inventory-list .asset-row { color: var(--xfm-text); background: #fff; border-top-color: #e8edf3; }
.inventory-list .asset-row > span:nth-child(3), .inventory-list .asset-row > span:nth-child(4) { color: #5d6b82; }
.inventory-list .asset-row:hover, .inventory-list .asset-row.selected { color: var(--xfm-text); background: var(--xfm-primary-soft); }
.inspector .property.property-full { grid-template-columns: minmax(0, 1fr); }
.inspector .property.property-full input, .inspector .property.property-full select { width: 100%; max-width: none; }

/* Ámbito de trabajo de WebClient: elimina los colores heredados del tema anterior. */
.workspace-scope { background: #f8fbff; border-color: #cfdae8; border-radius: 10px; }
.workspace-scope-toggle { color: #26364f; }
.workspace-scope-toggle:hover { background: #eaf3ff; }
.scope-status { background: #98a7ba; box-shadow: 0 0 0 2px #e2e9f1; }
.scope-status.active { background: var(--xfm-success); box-shadow: 0 0 0 2px #d8f0e6, 0 0 6px rgb(22 131 90 / 28%); }
.scope-clear { color: #536982; }
.scope-clear:hover { color: #0f4f96; background: #eaf3ff; }
.scope-state { color: #66768d; }
.sidebar .context-filters { background: transparent; }
.sidebar .filter-group { border-color: #d7e1ec; background: #fff; }
.sidebar .filter-group legend { color: #536982; }
.sidebar .tree-filter { background: #fff; border-color: #d7e1ec; }
.sidebar .tree-toggle { color: #1b579e; background: transparent; border-color: transparent; }
.sidebar .tree-toggle:hover { background: #eaf3ff; border-color: transparent; }
.sidebar .tree-toggle, .sidebar .tree-toggle-placeholder { width: 1.45rem; min-width: 1.45rem; height: 1.45rem; min-height: 1.45rem; padding: 0; border-radius: 5px; line-height: 1; }
.sidebar .tree-toggle { display: inline-grid; place-items: center; font-size: 1rem; }
.sidebar .tree-node { color: #34465e; }
.sidebar .tree-node:hover, .sidebar .tree-node.selected { color: #104f99; background: #eaf3ff; }
.sidebar .tree-node.selected { box-shadow: inset 3px 0 0 var(--xfm-primary); }
.scope-splitter span { background: #a8bdd4; box-shadow: 0 -3px 0 #dfe9f3, 0 3px 0 #dfe9f3; }
.scope-splitter:hover, .scope-splitter:focus, .scope-splitter.dragging { background: #eaf3ff; }
.scope-splitter:hover span, .scope-splitter:focus span, .scope-splitter.dragging span { background: #5d95d0; }
.filter-dimension-toolbar button { color: #1b579e; }
.filter-dimension-toolbar button:hover:not(:disabled) { background: #eaf3ff; }
.filter-dimension-toolbar button:disabled { color: #98a7ba; }

/* Árboles administrativos: mismo patrón compacto y claro que el ámbito de WebClient. */
.asset-type-tree { margin: 0; padding: 0; list-style: none; }
.asset-type-tree ul { margin: .1rem 0 .1rem .7rem; padding-left: .65rem; border-left: 1px solid #e0e8f1; list-style: none; }
.asset-type-tree li, .asset-type-tree .tree-row { grid-template-columns: 1.45rem minmax(0, 1fr); margin: .08rem 0; }
.asset-type-tree li > ul { grid-column: 2; }
.asset-type-tree .tree-toggle, .asset-type-tree .tree-toggle-placeholder { width: 1.45rem; min-width: 1.45rem; height: 1.45rem; min-height: 1.45rem; padding: 0; color: #1b579e; background: transparent; border-color: transparent; border-radius: 5px; font-size: 1rem; line-height: 1; }
.asset-type-tree .tree-toggle { display: inline-grid; place-items: center; }
.asset-type-tree .tree-toggle:hover { color: #104f99; background: #eaf3ff; border-color: transparent; }
.asset-type-tree .tree-item { min-height: 2.4rem; padding: .32rem .5rem; color: #34465e; border-color: transparent; border-radius: 6px; background: transparent; }
.asset-type-tree .tree-item:hover:not(.selected) { color: #104f99; background: #f2f7fd; border-color: transparent; }
.asset-type-tree .tree-item.selected { color: #104f99; background: #eaf3ff; border-color: transparent; box-shadow: inset 3px 0 0 var(--xfm-primary); }
.asset-type-tree .tree-item strong { color: inherit; }
.asset-type-tree .tree-item small, .asset-type-tree .tree-item em { color: #66768d; }

/* Las jerarquías administrativas usan la misma fila de una sola línea que Ámbito. */
.hierarchy-tree-panel .administrative-tree { margin-top: .75rem; }
.hierarchy-tree-panel .administrative-tree ul { margin: 0 0 0 .85rem; padding-left: .85rem; border-left: 0; }
.hierarchy-tree-panel .administrative-tree li { display: block; margin: 0; }
.hierarchy-tree-panel .administrative-tree .tree-row { display: grid; grid-template-columns: 1.45rem minmax(0, 1fr); align-items: center; min-height: 1.65rem; margin: 0; }
.hierarchy-tree-panel .administrative-tree .tree-toggle,
.hierarchy-tree-panel .administrative-tree .tree-toggle-placeholder { width: 1.2rem; min-width: 1.2rem; height: 1.2rem; min-height: 1.2rem; color: #1b579e; background: transparent; border-color: transparent; border-radius: 5px; font-size: .9rem; }
.hierarchy-tree-panel .administrative-tree .tree-toggle { display: inline-grid; place-items: center; }
.hierarchy-tree-panel .administrative-tree .tree-toggle:hover { color: #104f99; background: #eaf3ff; border-color: transparent; }
.hierarchy-tree-panel .administrative-tree .tree-node { display: block; width: 100%; min-width: 0; min-height: 1.55rem; padding: .18rem .35rem; overflow: hidden; color: #34465e; border: 0; border-radius: 4px; background: transparent; font: inherit; font-size: .78rem; font-weight: 400; line-height: 1.25; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.hierarchy-tree-panel .administrative-tree .tree-node:hover,
.hierarchy-tree-panel .administrative-tree .tree-node.selected { color: #104f99; background: #eaf3ff; }
.hierarchy-tree-panel .administrative-tree .tree-node.selected { box-shadow: inset 3px 0 0 var(--xfm-primary); }

/* Acceso */
.auth-page { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); min-height: 100vh; background: #fff; }
.auth-intro { display: flex; flex-direction: column; justify-content: space-between; min-height: 100%; padding: clamp(2rem, 7vw, 6rem); color: #f7fbff; background: radial-gradient(circle at 14% 15%, #2c83d9 0, #1457a6 33%, #0d2d5d 72%, #091b3a 100%); }
.auth-brand { color: #fff; font-size: 1.35rem; font-weight: 750; letter-spacing: -.03em; text-decoration: none; }
.auth-brand span { color: #a9d2fb; font-weight: 450; }
.eyebrow { margin: 0 0 .55rem; color: #5a718f; font-size: .7rem; font-weight: 750; letter-spacing: .1em; }
.auth-intro .eyebrow { color: #b9dcff; }
.auth-intro h1 { max-width: 12ch; margin: 0; color: #fff; font-size: clamp(2.3rem, 4.5vw, 4.5rem); line-height: 1.04; }
.auth-intro-copy > p:last-child { max-width: 38rem; margin: 1.4rem 0 0; color: #cee6fc; font-size: 1.05rem; }
.auth-benefits { display: grid; gap: .65rem; margin: 3rem 0 0; padding: 0; color: #dceefe; list-style: none; }
.auth-benefits li { display: flex; align-items: center; gap: .65rem; }
.auth-benefits span { display: inline-grid; width: 1.5rem; height: 1.5rem; place-items: center; color: #0a4a8f; background: #e7f3ff; border-radius: 50%; font-size: .9rem; font-weight: 800; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; max-width: 34rem; margin: 0 auto; padding: clamp(2rem, 7vw, 5rem) clamp(1.5rem, 6vw, 4rem); }
.auth-panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.auth-panel h2 { margin: 0; font-size: 1.75rem; }
.auth-panel-header > div > p:last-child { margin: .5rem 0 0; color: var(--xfm-muted); }
.auth-form { margin-top: 2rem; }
.auth-form .form-field { margin: 1.2rem 0; }
.auth-form input { padding: .65rem .75rem; }
.auth-submit { width: 100%; margin-top: .7rem; min-height: 44px; }
@media (max-width: 800px) { .auth-page { grid-template-columns: 1fr; } .auth-intro { min-height: auto; padding: 2rem 1.5rem; } .auth-intro-copy { margin-top: 3.5rem; } .auth-intro h1 { font-size: 2.3rem; } .auth-benefits { display: none; } .auth-panel { width: 100%; padding: 2.25rem 1.5rem 3rem; } }

@media (max-width: 1200px) {
    .topbar { padding: .6rem 1rem; }
    .main-content { padding: 1.25rem 1rem; }
    .sidebar { box-shadow: none; }
    .hierarchy-workspace { grid-template-columns: 1fr; }
    .hierarchy-tree-panel { max-width: none; }
    .hierarchy-inspector { position: static; }
}

/* Edición de tipos: selector gráfico simple, con JSON reservado a casos avanzados. */
.type-color-field > div { display: flex; align-items: center; gap: .65rem; }
.type-color-field input[type="color"] { width: 3.25rem; height: 2.3rem; padding: .18rem; cursor: pointer; }
.type-color-field code { color: #52647b; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem; }
.type-color-field small { display: block; margin-top: .3rem; color: #66768d; font-size: .78rem; }
.advanced-style { margin: .75rem 0 1rem; }
.advanced-style summary { color: #1b579e; cursor: pointer; font-size: .84rem; }
.advanced-style .form-field { margin: .7rem 0 0; }
.asset-types-layout .tree-item { grid-template-columns: .9rem minmax(0, 1fr) auto; }
.asset-types-layout .tree-item strong { grid-column: 2; }
.asset-types-layout .tree-item small { grid-column: 2; }
.asset-types-layout .tree-item em { grid-column: 3; }
.asset-type-color { grid-column: 1; grid-row: 1 / 3; width: .64rem; height: .64rem; align-self: center; border: 1px solid rgb(28 52 80 / 28%); border-radius: 50%; }
.property-color-preview { width: 2rem; height: 1.5rem; padding: .08rem; opacity: 1; }
.asset-types-layout .property-color-preview { width: 1.75rem; height: 1.4rem; padding: .06rem; }
.property-view-toggle { display: flex; align-items: center; gap: .45rem; margin: .45rem 0 .7rem; color: #52647b; font-size: .8rem; }
.property-view-toggle input { width: auto; margin: 0; }

/* Fichas legales vinculadas al inmueble, independientes de la jerarquía física. */
.normative-inventory { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #dce3ec; }
.normative-inventory h3 { margin: 0; font-size: .95rem; }
.normative-profile { margin: .65rem 0; padding: .65rem .75rem; border: 1px solid #d7e1ec; border-radius: 7px; background: #fbfdff; }
.normative-profile summary { color: #173f6b; cursor: pointer; font-size: .82rem; font-weight: 700; }
.normative-profile .form-field { margin: .55rem 0; }
.normative-profile .form-field label { font-size: .76rem; white-space: nowrap; }
.normative-profile input { width: 100%; }
.normative-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .1rem .8rem; }
@media (max-width: 760px) { .normative-fields { grid-template-columns: 1fr; } .normative-profile .form-field label { white-space: normal; } }
.normative-add { display: flex; gap: .5rem; align-items: end; margin-top: .8rem; }
.normative-add select { min-width: 0; flex: 1; }

/* Catálogo extenso: conserva código y traducción con la densidad del árbol de Ámbito. */
.asset-types-layout .asset-type-tree ul { margin: .05rem 0 .05rem .5rem; padding-left: .5rem; }
.asset-types-layout .asset-type-tree li,
.asset-types-layout .asset-type-tree .tree-row { grid-template-columns: 1.2rem minmax(0, 1fr); margin: 0; }
.asset-types-layout .asset-type-tree .tree-toggle,
.asset-types-layout .asset-type-tree .tree-toggle-placeholder { width: 1.2rem; min-width: 1.2rem; height: 1.2rem; min-height: 1.2rem; font-size: .9rem; }
.asset-types-layout .asset-type-tree .tree-item { min-height: 2rem; padding: .2rem .35rem; gap: 0 .4rem; }
.asset-types-layout .asset-type-tree .tree-item strong { font-size: .8rem; line-height: 1.15; }
.asset-types-layout .asset-type-tree .tree-item small { font-size: .7rem; line-height: 1.15; }
.asset-types-layout .asset-type-tree .tree-item em { font-size: .68rem; }
.asset-types-layout .asset-type-color { width: .55rem; height: .55rem; }
