/* Entity page templates — stacked detail body (composer twin, no tabs) */

.entity-page-host {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0.25rem 0 1.5rem;
}

.entity-page-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #607d8b;
}

.entity-page-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.75rem;
}

.entity-page-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #eceff1;
}

.entity-page-card-icon {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.entity-page-card-label {
    font-size: 0.75rem;
    color: #78909c;
    margin-bottom: 0.15rem;
}

.entity-page-card-value {
    font-size: 1rem;
    font-weight: 600;
    color: #263238;
    word-break: break-word;
}

.entity-page-section {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #eceff1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    padding: 0.85rem 1.15rem 1.15rem;
}

.entity-page-section-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0 0 0.9rem;
    padding: 0.35rem 0 0.65rem 0.65rem;
    border-inline-start: 4px solid var(--epage-accent, #546E7A);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.entity-page-section-icon {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.entity-page-section-caption {
    min-width: 0;
}

/* Field grid — self-contained (not dependent on ModelDrivenDetailContent scoped styles) */
.entity-page-fields-rows {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.85rem 1rem;
    padding: 0.15rem 0;
    max-width: 100%;
}

.entity-page-fields-rows .model-detail-field-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    margin: 0;
    background: #fafbfc;
    border: 1px solid #eceff1;
    border-radius: 8px;
    box-sizing: border-box;
}

.entity-page-field-security-lock {
    margin-inline-start: 0.35rem;
    font-size: 0.7rem;
    color: #90a4ae;
    vertical-align: middle;
    opacity: 0.85;
}

/* Line lists — after field groups; tabs only when 2+ collections */
.entity-page-lists {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.entity-page-lists-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 0.65rem;
    padding: 0;
    border-bottom: 1px solid #eceff1;
}

.entity-page-lists-tab {
    appearance: none;
    border: none;
    background: transparent;
    color: #607d8b;
    font-size: 0.9rem;
    font-weight: 560;
    padding: 0.55rem 0.85rem;
    margin-bottom: -1px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-bottom: 2px solid transparent;
}

.entity-page-lists-tab:hover {
    color: #37474f;
    background: #f5f7f8;
}

.entity-page-lists-tab.is-active {
    color: var(--epage-list-accent, #546E7A);
    border-bottom-color: var(--epage-list-accent, #546E7A);
    background: #fff;
}

.entity-page-lists-panel {
    min-width: 0;
}

.entity-page-fields-rows .model-detail-field-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #78909c;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.3;
}

.entity-page-fields-rows .model-detail-field-value-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.entity-page-fields-rows .model-detail-field-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: #263238;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.entity-page-fields-rows .model-detail-field-value-empty {
    color: #90a4ae;
    font-style: italic;
    font-weight: 400;
}

.entity-page-field-annotations {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.35rem;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    line-height: 1.35;
    color: #78909c;
}

.entity-page-field-annotation {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    min-width: 0;
}

.entity-page-field-annotation-label {
    font-weight: 600;
    color: #90a4ae;
}

.entity-page-field-annotation-value {
    font-weight: 500;
    color: #607d8b;
    font-variant-numeric: tabular-nums;
}

.entity-page-field-annotation-sep {
    color: #b0bec5;
    user-select: none;
}

.entity-page-fields-rows .model-detail-field-edit-btn-composer:hover {
    background: #e0f2f1;
    border-color: #00897b;
    color: #00695c;
}

.entity-page-fields-rows .model-detail-field-edit-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    background: #fff;
    color: #78909c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0.9;
    transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.entity-page-fields-rows .model-detail-field-row:hover .model-detail-field-edit-btn {
    opacity: 1;
}

.entity-page-fields-rows .model-detail-field-edit-btn:hover {
    background: #fff3e0;
    border-color: #f57c00;
    color: #e65100;
}

.entity-page-fields-rows .model-detail-field-ref-link {
    color: #e65100;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
    font-weight: 500;
}

.entity-page-fields-rows .model-detail-field-ref-link:hover {
    opacity: 0.88;
}

.entity-page-fields-rows .rz-label {
    margin: 0;
    display: block;
    min-width: 0;
}

.entity-page-collection-hint {
    margin: 0;
    color: #607d8b;
    font-size: 0.9rem;
}

@media (max-width: 640px) {
    .entity-page-cards {
        grid-template-columns: 1fr 1fr;
    }

    .entity-page-fields-rows {
        grid-template-columns: 1fr;
    }
}
